Skip to content

Instantly share code, notes, and snippets.

@yyscamper
Last active February 24, 2016 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yyscamper/49b8f030da48329c8567 to your computer and use it in GitHub Desktop.
Save yyscamper/49b8f030da48329c8567 to your computer and use it in GitHub Desktop.
Setup NAT in RackHD Vagrant
#!/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