Friday, 13 May 2011

Linux Port Forwarding Using iptables.

Step 1: Setup a linux gateway server with public ip address.


Step 2: Find the service type which need the port forwading.

Eg: HTTP ( Port 80, TCP).

Public ip address : XXX.XXX.XXX.XXX
Local ip address :

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d XXX.XXX.XXX.XXX --dport 80 -j DNAT --to
/sbin/iptables -A FORWARD -p tcp -i eth0 -d --dport 80 -j ACCEPT

No comments:

Post a Comment