Skip to content

Instantly share code, notes, and snippets.

@kartikm
Forked from jishnu7/3g-wifi.sh
Created May 27, 2014 12:41
Show Gist options
  • Save kartikm/66f4eed6c1f3e176c15d to your computer and use it in GitHub Desktop.
Save kartikm/66f4eed6c1f3e176c15d to your computer and use it in GitHub Desktop.
# Share ppp0 to wlan0
ifconfig wlan0 down
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iwconfig wlan0 mode Ad-Hoc
iwconfig wlan0 essid 3g-WiFi
iwconfig wlan0 channel auto
iwconfig wlan0 key restricted 1234-5678-90
iwconfig wlan0 key on
ifconfig wlan0 up 192.168.0.254 netmask 255.255.255.0
echo 1 > /proc/sys/net/ipv4/ip_forward
################################################
# /etc/dnsmasq.conf
# domain-needed
# bogus-priv
# interface=wlan0
# dhcp-range=192.168.0.1,192.168.0.100,12h
#################################################
/etc/rc.d/dnsmasq restart
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment