tags:

views:

13

answers:

0

In http://stackoverflow.com/questions/3878303/c-udp-socket-port-multiplexing, I found that using DNAT PREROUTING, I can redirect the packets for a particular UDP port and listen to packets being received on it.

iptables -t nat -A PREROUTING -i <iface> -p <proto> --dport <dport>
    -j REDIRECT --to-port <newport>

Unfortunately this works ONLY for packets received at this port. How can I get the packets being sent from this port?