Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/sh
- /bin/rm -f /etc/dnsmasq.conf
- /sbin/ifconfig eth0 down
- #################################################################
- # This script for sharing wlan0 connection via eth0 port.
- #
- # [AnyWiFi AP] --wireless-- [LinuxBox] <-wire-> pc1,pc2,pc3....
- #
- # Requires dnsmasq
- # http://www.thekelleys.org.uk/dnsmasq/doc.html
- #
- # Tested on Kali linux 1.0.6 (April.2014)
- # http://d.hatena.ne.jp/AO533/20140411/p1
- #
- #
- #### Configure ##################################################
- # E.G. DHCP ranges are 192.168.1.101-108 , 24H(default)
- # These settings are eth0 -> 192.168.1.100
- SUBNET=192.168.1
- ifconfig eth0 "$SUBNET".100 netmask 255.255.255.0
- # ^^^^^
- # Setup for dnsmasq services.
- echo "interface=eth0" > /etc/dnsmasq.conf
- echo "dhcp-range="$SUBNET".101,"$SUBNET".108,24h" >> /etc/dnsmasq.conf
- # ^^^^^ ^^^^
- #################################################################
- /sbin/ifconfig eth0 up
- # ipMasquerade BoilerPlate text.
- sysctl -w net.ipv4.ip_forward=1
- iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
- iptables -F FORWARD
- iptables -A FORWARD -j ACCEPT
- service dnsmasq restart
- iptables -nvL
- route -n
- ## EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement