Created
January 2, 2014 04:04
-
-
Save lacrosse/8214897 to your computer and use it in GitHub Desktop.
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 | |
if [[ -n "$2" ]]; then | |
device=$2 | |
else | |
device="eth0" | |
fi | |
if [ "start" = "$1" ]; then | |
ifconfig wlan0 192.168.150.1 | |
service dnsmasq restart | |
sysctl net.ipv4.ip_forward=1 | |
iptables -t nat -A POSTROUTING -o $device -j MASQUERADE | |
hostapd /etc/hostapd.conf | |
elif [ "stop" = "$1" ]; then | |
iptables -t nat -D POSTROUTING -o $device -j MASQUERADE | |
sysctl net.ipv4.ip_forward=0 | |
service dnsmasq stop | |
service hostapd stop | |
else | |
echo "usage:" | |
echo " wifi [start|stop] [device]" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment