-
-
Save benwilson512/11067641 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
#Initial wifi interface configuration | |
ifconfig $1 up 10.0.0.1 netmask 255.255.255.0 | |
sleep 2 | |
###########Start dnsmasq, modify if required########## | |
if [ -z "$(ps -e | grep dnsmasq)" ] | |
then | |
dnsmasq | |
fi | |
########### | |
#Enable NAT | |
iptables --flush | |
iptables --table nat --flush | |
iptables --delete-chain | |
iptables --table nat --delete-chain | |
iptables --table nat --append POSTROUTING --out-interface $2 -j MASQUERADE | |
iptables --append FORWARD --in-interface $1 -j ACCEPT | |
#Thanks to lorenzo | |
#Uncomment the line below if facing problems while sharing PPPoE, see lorenzo's comment for more details | |
#iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu | |
sysctl -w net.ipv4.ip_forward=1 | |
#start hostapd | |
hostapd /etc/hostapd/hostapd.conf 1> /dev/null | |
killall dnsmasq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment