Skip to content

Instantly share code, notes, and snippets.

@cretudorin
Created August 24, 2019 17:36
Show Gist options
  • Save cretudorin/3ca1a032e865e9900c72c5a4b1361278 to your computer and use it in GitHub Desktop.
Save cretudorin/3ca1a032e865e9900c72c5a4b1361278 to your computer and use it in GitHub Desktop.
iptables forward all from one nic to other
sudo apt-get install --reinstall iptables
update-alternatives --config iptables
legacy
net.ipv4.ip_forward = 1
sudo sysctl -p /etc/sysctl.conf
iptables -A FORWARD -i eth0 -o ztuze4sgqk -j ACCEPT
iptables -A FORWARD -i ztuze4sgqk -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo apt-get install iptables-persistent
dpkg-reconfigure iptables-persistent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment