Skip to content

Instantly share code, notes, and snippets.

@honux77
Created September 15, 2015 05:03
Show Gist options
  • Select an option

  • Save honux77/440e5911bd526c7cc996 to your computer and use it in GitHub Desktop.

Select an option

Save honux77/440e5911bd526c7cc996 to your computer and use it in GitHub Desktop.
Linux NAT instance setting
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/net/ipv4/conf/eth0/send_redirects
/sbin/iptables -t nat -A POSTROUTING -o eth0 -s 0.0.0.0/0 -j MASQUERADE
/sbin/iptables-save > /etc/sysconfig/iptables
mkdir -p /etc/sysctl.d/
cat <<EOF > /etc/sysctl.d/nat.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.eth0.send_redirects = 0
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment