Monday, July 11, 2011

PORT FORWARDING with IPTABLES in LINUX

These are the Iptable rules required for port forwarding xxx.xxx.xxx.xxx:8888 to 192.168.0.2:80
/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx
–dport 8888 -j DNAT –to 192.168.0.2:80

/sbin/iptables -A FORWARD -p tcp -i eth0 -d 192.168.0.2 –dport 80 -j ACCEPT
# iptables -t nat -L
Here rdp 75.144.218.185:13389 will forward to 192.168.1.5 port 3389 here 3389 is rdp port
/etc/sysconfig/iptables

-A PREROUTING -d 75.144.218.185 -i eth1 -p tcp -m tcp –dport 13389 -j DNAT –to-destination 192.168.1.5:3389
-A PREROUTING -d 75.144.218.185 -i eth1 -p tcp -m tcp –dport 80 -j DNAT –to-destination 192.168.1.5:8

No comments:

Post a Comment