Using an iPhone as a hotspot with wpa_supplicant
Using an iPhone as a hotspot with wpa_supplicant
This is a quick post just to note down the steps required to get a
computer running wpa_supplicant
to connect to the internet using an
iPhone hotspot. Add the following to the file
/etc/wpa_supplicant.conf
:
network={ ssid="<Name of your iPhone>" psk="<Your password>" priority=2 }
This is rather straightforward, as you've probably a line looking
pretty much like that in your file, for you home WiFi. In the example
above, I set the priority
to 2
; the idea is to set it to a value that
will play nicely with the other networks defined in the file. You
don't want to connect to your phone's hotspot when you're home, but
you probably want to prefer your personal connection over everything
in public places (at least I know I do… remember I live in France,
where free, unlimited and secure public WiFi remains a wild dream). As
explained in the man page of wpa_supplicant.conf, the default is 0
,
and higher values make a network more desirable. My home network has a
priority
of 5
, public WiFis I don't want anything to do with get the
default 0
, and my phone is in between with a 2
. Is that all there is
to it? well, almost. There's a catch: by default, iOS gives your phone
a name like "Sergey Brin's iPhone". This is all well (provided you
like advertising your name to everyone, everywhere you go), but this
causes a problem with wpa_supplicant
. For some reason, you can't
connect to an SSID containing an apostrophe. Since iOS won't let you
change the SSID, you must change the name of your phone to something
more reasonable. Now, for wpa_supplicant
to reload its configuration
and restart the network:
# wpa_cli reconfigure # service netif restart
You should now be connected to your iPhone's hotspot!