NAT with iptables

Set up IP FORWARDing and Masquerading

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE

iptables --append FORWARD --in-interface eth1 -j ACCEPT

Enables packet forwarding by kernel

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

Apply the configuration

service iptables restart

désert/Linux/NAT (last edited 2019-05-09 03:35:28 by localhost)