GNU, linux based systems, free software and other computer related things...

IP FORWARDING using NAT with IPTABLES

In this example:

  • we have a LAN connected to eth0 interface.
  • our LAN connects to Internet via ppp0 interface.
  • we mask our local lan IP addresses using NAT.

NAT stands for Network Address Translation.

In the console we write these commands:
# iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# iptables -A FORWARD -i eth0 -j ACCEPT
# echo 1 > /proc/sys/net/ipv4/ip_forward

References:
$ man iptables

You can freely copy, change or create derivative works from this page contents, only requisite is adding a link to this web page.