Quick HOWTO : Ch14 : Linux Firewalls Using iptables
sudo iptables -t nat -A POSTROUTING --out-interface eth1 -j MASQUERADE sudo iptables -A FORWARD --in-interface eth0 -j ACCEPT All of the forwarded traffic will traverse the FORWARD chain. To filter packets you'll now have to create rules on that chain specifying which interface is incoming/outgoing instead of using the INPUT/OUTPUT chains. iptables Syntax | iptables: The Linux Firewall This chapter covers the iptables firewall administration program used to build a Netfilter firewall. For those of you who are familiar with or accustomed to the older ipfwadm and ipchains programs used with the IPFW technology, iptables will look very similar to those programs. However, it is much more feature-rich and flexible, and it is very different on subtle levels. IptablesHowTo - Community Help Wiki Apr 11, 2020
Doing Source NAT with iptables on one NIC
Iptables doesn't persist rules through restarts on its own. There are packages to take care of that like iptables-persistent but that doesn't seem to be available on Ubuntu 18.04 so here's how to do it manually. The ruleset can be easily saved by running iptables-save > /etc/iptables.rules and restored with iptables-restore < /etc/iptables
Step-By-Step Configuration of NAT with iptables. This tutorial shows how to set up network-address-translation (NAT) on a Linux system with iptables rules so that the system can act as a gateway and provide internet access to multiple hosts on a local network using a single public IP address.
iptables -L does not show in-interface or out-interface? Feb 27, 2011 Easy IPTables Configuration and Examples on Ubuntu 16.04 Jan 29, 2018 IPTables - CentOS 7