Sunday, April 6, 2014

I *finally* have RPi WiFi working (not easy with a hidden ssid)

woohoo!! ok, I've spent more time trying to get the WiFi working than anything else.

I tried everything... surely it is not difficult, considering how easy everything else was, no? No. The built-in WiFi configuration tool didn't not work for me. I found a cool WiFi tool called wicd. For more information see wifi on raspberry pi: a simple guide, at raspyfi.com (but it didn't work for my problem, either)

So the deal is: WiFi is easy to setup on RPi as long as the target AP has a ssid that is broadcasted. I prefer the security of an unbroadcasted ssid.  (details, details)

Google to the rescue! I found this awesome article on settig up the RPi as a WiFi radio. On the setup page, the author describes in detail how to setup WiFi with a hidden ssid.

We all know how over the years links change or simply go away, so I've copied the critical hidden ssid setup text from that article here (credit to Philip Burgess at adafruit):

Hidden Networks

If you run a hidden WiFi network — one that does not broadcast its SSID — this can still be made to work but is considerably more complicated. The slightest typo here, even one character, can prevent the system from joining the network! We strongly recommend using a “broadcast” network, it’s far easier and less error-prone.

sudo nano /etc/network/interfaces

Delete the {last} two lines {under "iface wlan0 inet dhcp" }   (wpa-ssid and wpa-psk) and replace with (indented):

pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
update_config=1
ap_scan=2
eapol_version=1
network={
 ssid="my-network-ssid"
 scan_ssid=1
 mode=0
 proto=WPA2
 auth_alg=OPEN
 pairwise=CCMP
 group=CCMP
 key_mgmt=WPA-PSK
 psk="my-network-password"
}
Replace ssid and psk with your actual network name and password, in quotes.

Important: indent the 'network' section using tabs, not spaces.
In the end, my \\raspberrypi\c$\etc\network\interfaces file looks like this:
auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
  pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B

And my \\raspberrypi\c$\etc\wpa_supplicant\wpa_supplicant.conf file looks like this (with my ssid and psk where noted):

ctrl_interface=/var/run/wpa_supplicant
update_config=1
ap_scan=2
eapol_version=1
network={
 ssid="myssid"
 scan_ssid=1
 mode=0
 proto=WPA2
 auth_alg=OPEN
 pairwise=CCMP
 group=CCMP
 key_mgmt=WPA-PSK
 psk="mypsk"
}

No comments:

Post a Comment

comments are welcome, but I prefer not to allow links to promotions or other unrelated services.

Find gojimmypi at gojimmypi.github.io

I'm currently working on my new blog home at  gojimmypi.github.io After implementing a variety of features such as dark mode , syntax hi...