Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #!/bin/bash
  2. #Initial wifi interface configuration
  3. ifconfig $1 up 10.0.0.1 netmask 255.255.255.0
  4. sleep 2
  5.  
  6. ###########Start dnsmasq, modify if required##########
  7. if [ -z "$(ps -e | grep dnsmasq)" ]
  8. then
  9. dnsmasq
  10. fi
  11. ###########
  12.  
  13. #Enable NAT
  14. iptables --flush
  15. iptables --table nat --flush
  16. iptables --delete-chain
  17. iptables --table nat --delete-chain
  18. iptables --table nat --append POSTROUTING --out-interface $2 -j MASQUERADE
  19. iptables --append FORWARD --in-interface $1 -j ACCEPT
  20.  
  21. #Thanks to lorenzo
  22. #Uncomment the line below if facing problems while sharing PPPoE, see lorenzo's comment for more details
  23. #iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
  24.  
  25. sysctl -w net.ipv4.ip_forward=1
  26.  
  27. #start hostapd
  28. hostapd /etc/hostapd/hostapd.conf 1> /dev/null
  29. killall dnsmasq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement