image

How to NAT All traffic on network interface to other interface
In this case eth0 interface have public IP and eth1 have local IP and we want to use use eth1 as a gateway.

# echo 1 > /proc/sys/net/ipv4/ip_forward

# /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i eth0 -o eth1 -m state –state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

# iptables-save > /etc/iptable_backup

Leave a Reply