Skip to main content

Linux IPTABLES and NAT routing

By April 17, 2013September 12th, 2022No Comments

It is very common that workstations are isolated from the internet by using NAT or Network Address Translation on the border routers; this is both at home as well as in the office. If you use Linux then using iptables to create your NAT router is especially easy. Writing to the NAT chain and POSTROUTING the task is easily committed and protects your workstations from external connections.

  1. Make sure routing is on : echo 1 > /proc/sys/net/ipv4/ip_forward
  2. Assuming eth1 is the internet facing NIC : iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

But like everything else, one can see it done in this video…