Advertisement
captmicro

rPI WiFi AP

Mar 28th, 2015
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.97 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ### KILL EXISTING ###
  4. service dnsmasq stop
  5. killall dnsmasq
  6. service hostapd stop
  7. killall hostapd
  8. ifconfig wlan0 down
  9.  
  10. ### HOSTAPD CONFIGRATION ###
  11. CAT <<EOF > /etc/hostapd/hostapd.conf
  12. interface=wlan0
  13. enable_karma=1
  14. driver=nl80211
  15. hw_mode=g
  16. channel=1
  17. ssid=rPI Karma WiFi API
  18. EOF
  19.  
  20. ### DNSMASQ CONFIGURATION ###
  21. cat <<EOF > /etc/dnsmasq.conf
  22. interface=wlan0
  23. log-facility=/var/log/dnsmasq.log
  24. log-queries
  25. no-resolv
  26. dhcp-range=10.10.10.10,10.10.10.250,12h
  27. server=8.8.8.8
  28. server=8.8.4.4
  29. EOF
  30.  
  31. ### INTERFACE SETUP ###
  32. ifconfig wlan0 up
  33. ifconfig wlan0 10.10.10.1/24
  34.  
  35. ### IPTABLES NAT FORWARDING ###
  36. iptables --flush
  37. iptables --table nat --flush
  38. iptables --delete-chain
  39. iptables --table nat --delete-chain
  40. iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
  41. iptables --append FORWARD --in-interface wlan0 -j ACCEPT
  42. sysctl -w net.ipv4.ip_forward=1
  43.  
  44. ### START PROCESSES ###
  45. service dnsmasq start
  46. service hostapd start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement