Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== NAT on linux with iptables ====== ''eth0'' is our external network and ''eth1'' is our intenral one: <code> echo 1 > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT </code> to make all this permanent change the following parameter in ''/etc/sysctl.conf'' to ''1'': net.ipv4.ip_forward = 1 then save the current iptables permanetnly. in **ubuntu** you do: <code> apt install iptables-persistent </code> choose ''yes'' at the end to save the current config and you're done! if you change other iptables rules, you can run the following command to update the saved settings: <code> iptables-save > /etc/iptables/rules.v4 </code> nat_on_linux_with_iptables.txt Last modified: 27.11.2023 18:04by Pascal Suter