Activate Masquerading (NAT) on Linux router

To activate NAT on a Linux Box used as a router, just use the following line :

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

eth0 is the network interface able to access Internet directly

Then you can list the NAT entry in iptables with the following command

# iptables -t nat -L

You can get more details with:

# iptables -t nat -L -v

The conntrack tool also help to see what happen in the NAT

# conntrack -L --src-nat / --dst-nat

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.