I have seen a couple of threads about not being able to tether if you are grandfathered into an unlimited data plan. I was tethering pre-ICS using wifi tether for root.
Yeah,
I know. Not working now.
I'm a developer though so I pulled down the source and took a look at what is actually happening. It's really just an edify script with some utilities that bring up a wifi access point using the standard android/linux tools. Our phone needs to use the hostapd utility to create the access point. The problem is that all the pre-defined phones that use hostapd also want to load/unload there own drivers for the wifi chips.
I haven't had time to install the android dev environment yet so I didn't patch up any code. I did however throw together a couple of quick scripts to start and stop tethering using hostapd to see if it would work.
The results - Yes. I can stop and start a wifi access point on my phone. Of course being scripts there is no fancy GUI or anything but it is working. I'm using Rom Toolbox Pro to run the scripts but you can do it from a Terminal Emulator.
So if anybody knows enough about getting to the command line you can give this a try.
You will need the following pre-requisite executables:
iwconfig
ifconfig
hostapd
iptables
dnsmasq
ip
I believe these are included in ICS except for possibly iwconfig and hostapd. If you install wifi tether for root they are included in it though. Wherever you get them from make sure they are in /system/bin so that they are in your path.
You need to have root access to be able to do this. I setup my scripts for everything to work from /data/misc/wifi so you will need to put everything there.
Here are the two scripts plus the hostapd.conf file. Hopefully someone can give these a try. I will try to check back and help anybody I can but my time is limited at the moment.
NOTE - Turn off wifi before running the scripts. You will need to change the ssid name to what you want and also the password to something you want in hostapd.conf.
Good luck!
Scipt to start tethering.
CUT HERE ----------------------------------------------
# tetherstart.sh
#
# Configure essid, channel, and transmit power
#
iwconfig wlan0 essid testapp
iwconfig wlan0 channel 11
# iwconfig wlan0 txpower
# iwconfig wlan0 commit
#
# Set IP for interface and bring it up
#
ifconfig wlan0 192.168.0.1 netmask 255.255.255.0
ifconfig wlan0 up
#
# Start hostapd to bring up the hotspot
#
hostapd -P /data/misc/wifi/hostapd.pid -e /data/misc/wifi/entropy.bin -B /data/misc/wifi/hostapd.conf
#
# Enable the routing fix
#
ip rule add to 192.168.0.0/24 lookup main priority 50
ip route flush cache
#
# Clean up iptables rules
#
iptables -N wireless-tether
iptables -F wireless-tether
iptables -F FORWARD
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING
iptables -t nat -F
#
# Bring up NAT rules
#
iptables -A wireless-tether -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A wireless-tether -s 192.168.0.0/24 -j ACCEPT
iptables -A wireless-tether -p 47 -j ACCEPT
iptables -A wireless-tether -j DROP
iptables -A FORWARD -m state --state INVALID -j DROP
iptables -A FORWARD -j wireless-tether
iptables -t nat -I POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
#
# Turn on MSS Clamping
#
iptables -I FORWARD -s 192.168.0.0/24 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
#
# Enable IP forwarding
#
echo 1 > /proc/sys/net/ipv4/ip_forward
#
# Use dnsmasq for dhcp server
#
dnsmasq -i wlan0 --dhcp-authoritative --no-negcache --user=root --no-resolv --no-hosts --server=8.8.4.4 --server=8.8.8.8 --dhcp-range=192.168.0.100,192.168.0.110 --dhcp-leasefile=/data/misc/wifi/dnsmasq.leases --pid-file=/data/misc/wifi/dnsmasq.pid
hostapd.conf file contents for above script:
CUT HERE ----------------------------------------------
interface=wlan0
driver=nl80211
ctrl_interface=/data/misc/wifi/hostapd
hw_mode=g
beacon_int=100
dtim_period=2
#max_num_sta=5
rts_threshold=2347
fragm_threshold=2346
supported_rates=10 20 55 110 60 90 120 180 240 360 480 540
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wme_enabled=0
wme_ac_bk_cwmin=4
wme_ac_bk_cwmax=10
wme_ac_bk_aifs=7
wme_ac_bk_txop_limit=0
wme_ac_bk_acm=0
wme_ac_be_aifs=3
wme_ac_be_cwmin=4
wme_ac_be_cwmax=10
wme_ac_be_txop_limit=0
wme_ac_be_acm=0
wme_ac_vi_aifs=2
wme_ac_vi_cwmin=3
wme_ac_vi_cwmax=4
wme_ac_vi_txop_limit=94
wme_ac_vi_acm=0
wme_ac_vo_aifs=2
wme_ac_vo_cwmin=2
wme_ac_vo_cwmax=3
wme_ac_vo_txop_limit=47
wme_ac_vo_acm=0
#ap_max_inactivity=30
#wep_rekey_period=0
#eap_server=0
#own_ip_addr=127.0.0.1
#wpa_group_rekey=0
#wpa_gmk_rekey=0
#wpa_ptk_rekey=0
ssid=testapp
channel=11
wpa_passphrase=testtest
wpa_key_mgmt=WPA-PSK
wpa=2
wpa_pairwise=CCMP
rsn_pairwise=CCMP
Scirpt to stop tethering.
CUT HERE ----------------------------------------------
# tetherstop.sh
#
# Disable forwarding and remove NAT rules.
#
echo 0 > /proc/sys/net/ipv4/ip_forward
iptables -F FORWARD
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING
iptables -t nat -F
iptables -X wireless-tether
#
# Kill all hotspot process
killall dnsmasq
killall hostapd
#
# Remove ip route rule to use main routing table for LAN network
#
ip rule del to 192.168.0.0/24 lookup main priority 50
ip route flush cache
#
# Remove old dnsmasq.leases and pid-files
#
rm /data/misc/wifi/dnsmasq.leases
rm /data/misc/wifi/dnsmasq.pid
rm /data/misc/wifi/hostapd.pid
Yeah,
I know. Not working now.
I'm a developer though so I pulled down the source and took a look at what is actually happening. It's really just an edify script with some utilities that bring up a wifi access point using the standard android/linux tools. Our phone needs to use the hostapd utility to create the access point. The problem is that all the pre-defined phones that use hostapd also want to load/unload there own drivers for the wifi chips.
I haven't had time to install the android dev environment yet so I didn't patch up any code. I did however throw together a couple of quick scripts to start and stop tethering using hostapd to see if it would work.
The results - Yes. I can stop and start a wifi access point on my phone. Of course being scripts there is no fancy GUI or anything but it is working. I'm using Rom Toolbox Pro to run the scripts but you can do it from a Terminal Emulator.
So if anybody knows enough about getting to the command line you can give this a try.
You will need the following pre-requisite executables:
iwconfig
ifconfig
hostapd
iptables
dnsmasq
ip
I believe these are included in ICS except for possibly iwconfig and hostapd. If you install wifi tether for root they are included in it though. Wherever you get them from make sure they are in /system/bin so that they are in your path.
You need to have root access to be able to do this. I setup my scripts for everything to work from /data/misc/wifi so you will need to put everything there.
Here are the two scripts plus the hostapd.conf file. Hopefully someone can give these a try. I will try to check back and help anybody I can but my time is limited at the moment.
NOTE - Turn off wifi before running the scripts. You will need to change the ssid name to what you want and also the password to something you want in hostapd.conf.
Good luck!
Scipt to start tethering.
CUT HERE ----------------------------------------------
# tetherstart.sh
#
# Configure essid, channel, and transmit power
#
iwconfig wlan0 essid testapp
iwconfig wlan0 channel 11
# iwconfig wlan0 txpower
# iwconfig wlan0 commit
#
# Set IP for interface and bring it up
#
ifconfig wlan0 192.168.0.1 netmask 255.255.255.0
ifconfig wlan0 up
#
# Start hostapd to bring up the hotspot
#
hostapd -P /data/misc/wifi/hostapd.pid -e /data/misc/wifi/entropy.bin -B /data/misc/wifi/hostapd.conf
#
# Enable the routing fix
#
ip rule add to 192.168.0.0/24 lookup main priority 50
ip route flush cache
#
# Clean up iptables rules
#
iptables -N wireless-tether
iptables -F wireless-tether
iptables -F FORWARD
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING
iptables -t nat -F
#
# Bring up NAT rules
#
iptables -A wireless-tether -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A wireless-tether -s 192.168.0.0/24 -j ACCEPT
iptables -A wireless-tether -p 47 -j ACCEPT
iptables -A wireless-tether -j DROP
iptables -A FORWARD -m state --state INVALID -j DROP
iptables -A FORWARD -j wireless-tether
iptables -t nat -I POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
#
# Turn on MSS Clamping
#
iptables -I FORWARD -s 192.168.0.0/24 -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
#
# Enable IP forwarding
#
echo 1 > /proc/sys/net/ipv4/ip_forward
#
# Use dnsmasq for dhcp server
#
dnsmasq -i wlan0 --dhcp-authoritative --no-negcache --user=root --no-resolv --no-hosts --server=8.8.4.4 --server=8.8.8.8 --dhcp-range=192.168.0.100,192.168.0.110 --dhcp-leasefile=/data/misc/wifi/dnsmasq.leases --pid-file=/data/misc/wifi/dnsmasq.pid
hostapd.conf file contents for above script:
CUT HERE ----------------------------------------------
interface=wlan0
driver=nl80211
ctrl_interface=/data/misc/wifi/hostapd
hw_mode=g
beacon_int=100
dtim_period=2
#max_num_sta=5
rts_threshold=2347
fragm_threshold=2346
supported_rates=10 20 55 110 60 90 120 180 240 360 480 540
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wme_enabled=0
wme_ac_bk_cwmin=4
wme_ac_bk_cwmax=10
wme_ac_bk_aifs=7
wme_ac_bk_txop_limit=0
wme_ac_bk_acm=0
wme_ac_be_aifs=3
wme_ac_be_cwmin=4
wme_ac_be_cwmax=10
wme_ac_be_txop_limit=0
wme_ac_be_acm=0
wme_ac_vi_aifs=2
wme_ac_vi_cwmin=3
wme_ac_vi_cwmax=4
wme_ac_vi_txop_limit=94
wme_ac_vi_acm=0
wme_ac_vo_aifs=2
wme_ac_vo_cwmin=2
wme_ac_vo_cwmax=3
wme_ac_vo_txop_limit=47
wme_ac_vo_acm=0
#ap_max_inactivity=30
#wep_rekey_period=0
#eap_server=0
#own_ip_addr=127.0.0.1
#wpa_group_rekey=0
#wpa_gmk_rekey=0
#wpa_ptk_rekey=0
ssid=testapp
channel=11
wpa_passphrase=testtest
wpa_key_mgmt=WPA-PSK
wpa=2
wpa_pairwise=CCMP
rsn_pairwise=CCMP
Scirpt to stop tethering.
CUT HERE ----------------------------------------------
# tetherstop.sh
#
# Disable forwarding and remove NAT rules.
#
echo 0 > /proc/sys/net/ipv4/ip_forward
iptables -F FORWARD
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING
iptables -t nat -F
iptables -X wireless-tether
#
# Kill all hotspot process
killall dnsmasq
killall hostapd
#
# Remove ip route rule to use main routing table for LAN network
#
ip rule del to 192.168.0.0/24 lookup main priority 50
ip route flush cache
#
# Remove old dnsmasq.leases and pid-files
#
rm /data/misc/wifi/dnsmasq.leases
rm /data/misc/wifi/dnsmasq.pid
rm /data/misc/wifi/hostapd.pid
