May 25, 2011

udp port forward

Option 1: user-application based udp port forwarding

Ivan Tikhonov wrote a simple udp_redirect.c program to do just this. I like it.

The link:


Option 2 is to use iptables.

You will need to set the middle computer (Linux) to
1. NAT
2. port forward to the local computer

iptables -t nat -A POSTROUTING -j MASQUERADE -o eth0
iptables -t nat -A PREROUTING -p udp -i eth0 --dport 161  -j DNAT --to

Then set the local computer's default gateway to the middle computer:

route add default gw

If you are looking for TCP port forwarding, I use and recommend the open source program rinetd. It works on both Windows and Linux, and supports multiple TCP connections, and is very stable. The link:

No comments:

Post a Comment