Created
September 15, 2015 05:03
-
-
Save honux77/440e5911bd526c7cc996 to your computer and use it in GitHub Desktop.
Linux NAT instance setting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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