Advertisement
ravelmaurice

hotspot.sh

Jul 24th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #!/bin/bash
  2. # Start
  3. # Configure IP address for WLAN
  4. sudo ifconfig wlan0 192.168.150.1
  5. # Start DHCP/DNS server
  6. sudo service dnsmasq restart
  7. # Enable routing
  8. sudo sysctl net.ipv4.ip_forward=1
  9. # Enable NAT
  10. sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  11. # Run access point daemon
  12. sudo hostapd /etc/hostapd.conf
  13. # Stop
  14. # Disable NAT
  15. sudo iptables -D POSTROUTING -t nat -o eth0 -j MASQUERADE
  16. # Disable routing
  17. sudo sysctl net.ipv4.ip_forward=0
  18. # Disable DHCP/DNS server
  19. sudo service dnsmasq stop
  20. sudo service hostapd stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement