NAT under Ubuntu 18.04 with iptables

nano /etc/rc.local
NET_INTERNAL=eth1
NET_EXTERNAL=eth0

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -o $NET_EXTERNAL -j MASQUERADE
iptables -A INPUT -i $NET_INTERNAL -j ACCEPT
iptables -A INPUT -i $NET_EXTERNAL -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -j ACCEPT

Leave a Reply

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