Skip to content

Instantly share code, notes, and snippets.

@doorbash
Last active May 25, 2016 15:11
Show Gist options
  • Save doorbash/3c543b172f2dc57f0981a93bd71d74f7 to your computer and use it in GitHub Desktop.
Save doorbash/3c543b172f2dc57f0981a93bd71d74f7 to your computer and use it in GitHub Desktop.
ipmasq.sh
# Defines the location of iptables executables.
iptables=/sbin/iptables
#Clears if any old iptable rules/ policies are there.
iptables --flush -t nat
# Now we will do Masquerading ie. we are doing NAT.
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
# Enabling packet forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment