Created
April 25, 2012 17:06
-
-
Save finnigja/2491336 to your computer and use it in GitHub Desktop.
NAT'ing ethernet to wifi
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/bash | |
echo "1" > /proc/sys/net/ipv4/ip_forward | |
ifconfig eth0 192.168.200.1 netmask 255.255.255.0 up | |
/etc/init.d/isc-dhcp-server start | |
iptables --flush | |
iptables -t nat --flush | |
iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT | |
iptables -A FORWARD -i wlan0 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT | |
iptables -A FORWARD -j LOG | |
iptables -t nat -A POSTROUTING -o wlan0 -s 192.168.200.0/24 -j MASQUERADE | |
route add default gw 192.168.1.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment