-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitsoftap
More file actions
executable file
·35 lines (28 loc) · 993 Bytes
/
initsoftap
File metadata and controls
executable file
·35 lines (28 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
INTERFACE='wlp3s0'
INTERNET='ppp0'
#Initial wifi interface configuration
ifconfig $INTERFACE up 10.0.0.1 netmask 255.255.255.0
sleep 2
###########Start DHCP, comment out / add relevant section##########
#Thanks to Panji
#Doesn't try to run dhcpd when already running
if [ "$(ps -e | grep dhcpd)" == "" ]; then
dhcpd $INTERFACE &> /dev/null &
fi
###########
#Enable NAT
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface $INTERNET -j MASQUERADE
iptables --append FORWARD --in-interface $INTERFACE -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 &> /dev/null &
hostapd /etc/hostapd/hostapd.conf
killall dhcpd