PDA

View Full Version : [all variants] howto forward port in localhost in TCP and UDP using iptables



highfly22
November 4th, 2008, 09:00 AM
Hi,
I need iptables do something like
sudo ssh -L 139:localhost:22139 haiwei@localhost
but only allow the localhost access this port.

And how to configure iptables to implement UDP port forward?
Cause SSH only support tcp port forward.

I try this, but it doesn't work:
sudo iptables -t nat -A PREROUTING -p tcp -d 127.0.0.1 --dport 139 -j DNAT --to 127.0.0.1:22139

thanks,
Haiwei

widor
November 4th, 2008, 12:20 PM
What output do you get from the following?

sudo iptables -L FORWARD -nv
sudo iptables -t nat -L -nv