Last active
February 24, 2016 13:53
-
-
Save yyscamper/49b8f030da48329c8567 to your computer and use it in GitHub Desktop.
Setup NAT in RackHD Vagrant
This file contains 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 | |
# Reference link: http://www.aboutdebian.com/proxy.htm | |
INTIF="eth1" | |
EXTIF="eth0" | |
/sbin/depmod -a | |
/sbin/modprobe ip_tables | |
/sbin/modprobe ip_conntrack | |
/sbin/modprobe ip_conntrack_ftp | |
/sbin/modprobe ip_conntrack_irc | |
/sbin/modprobe iptable_nat | |
/sbin/modprobe ip_nat_ftp | |
echo "1" > /proc/sys/net/ipv4/ip_forward | |
echo "1" > /proc/sys/net/ipv4/ip_dynaddr | |
iptables -P INPUT ACCEPT | |
iptables -F INPUT | |
iptables -P OUTPUT ACCEPT | |
iptables -F OUTPUT | |
iptables -P FORWARD DROP | |
iptables -F FORWARD | |
iptables -t nat -F | |
iptables -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT | |
iptables -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT | |
iptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment