Advertisement
Guest User

Untitled

a guest
Apr 10th, 2014
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #/bin/sh
  2.  
  3. /bin/rm -f /etc/dnsmasq.conf
  4. /sbin/ifconfig eth0 down
  5.  
  6. #################################################################
  7. # This script for sharing wlan0 connection via eth0 port.
  8. #
  9. # [AnyWiFi AP] --wireless-- [LinuxBox] <-wire-> pc1,pc2,pc3....
  10. #
  11. # Requires dnsmasq
  12. # http://www.thekelleys.org.uk/dnsmasq/doc.html
  13. #
  14. # Tested on Kali linux 1.0.6 (April.2014)
  15. # http://d.hatena.ne.jp/AO533/20140411/p1
  16. #
  17. #
  18. #### Configure ##################################################
  19. # E.G. DHCP ranges are 192.168.1.101-108 , 24H(default)
  20. # These settings are eth0 -> 192.168.1.100
  21.  
  22. SUBNET=192.168.1
  23. ifconfig eth0 "$SUBNET".100 netmask 255.255.255.0
  24. # ^^^^^
  25.  
  26. # Setup for dnsmasq services.
  27. echo "interface=eth0" > /etc/dnsmasq.conf
  28. echo "dhcp-range="$SUBNET".101,"$SUBNET".108,24h" >> /etc/dnsmasq.conf
  29. # ^^^^^ ^^^^
  30. #################################################################
  31.  
  32. /sbin/ifconfig eth0 up
  33.  
  34. # ipMasquerade BoilerPlate text.
  35. sysctl -w net.ipv4.ip_forward=1
  36. iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
  37. iptables -F FORWARD
  38. iptables -A FORWARD -j ACCEPT
  39.  
  40. service dnsmasq restart
  41.  
  42. iptables -nvL
  43. route -n
  44.  
  45. ## EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement