Linux iPhone Tethering scripts

Seeing how inconvenient the whole tethering process is, I decided to simplify it with these scripts. You will probably want to keep the SUID bit on these, or use sudo and set it up to not ask for a password for this command. Be sure to replace wlan0 with your wifi interface.

In order for these to work properly, you must not have your card set in “roaming mode” by network-admin.

The scripts:

adhoc (switches wlan card into adhoc mode)

#switches card into adhoc mode and sets up adhoc network
iwconfig wlan0 key off #this disables WEP. If you want WEP, read the iwconfig man page and change this line.
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 essid ubuntu #replace this with your preferred ssid
ifconfig wlan0 #replace this with your preferred IP address. Be sure to give the phone an address that is in the same /24 subnet.

Second script, for switching back to your preferred wireless network (set by network-admin).

iwconfig wlan0 mode managed
sudo ifup --force wlan0


Leave a Reply