Saturday 23 March 2013

Configuring WiFi on Raspberry Pi

Edimax WiFi Dongle

Static IP Address

No Encryption

2013-03-23


My Raspberry Pi, a tiny, ARM-based, single-board computer, has arrived.

Following a test boot and preliminary configuration, I needed to get it running on WiFi.  For this, I had an Edimax EW-7811Un Wireless-b/g/n USB dongle--very common among Pi owners.

Getting it going wasn't easy.  All the references online talk about WPA/WPA2 configuration.  Well, I don't use encryption, due to the menagerie of devices (of various ages and levels of technological sophistication) we use around here.  Instead, I rely on MAC filtering.  Yes--it's not the most-secure setup, as someone can always clone a MAC address and connect.  Personally, I feel that if they want to go to that much trouble, when there are several open access points on this street alone, they're welcome to some of my bandwidth.  So far, it hasn't been an issue.

Anyway.

After digging through man pages and reading others' comments, I got things set up.  When not using WPA, you needn't mess with wpa_supplicant; only the interfaces file must be configured properly.

1.  Don't worry about kernel modules; the appropriate module is pre-loaded.

2.  Login to your Pi and enter the following, leaving out the comments:
cd /etc/network                # Change Directory
sudo nano interfaces           # Edit file with nano text editor

In the nano editor, enter the following lines:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wireless-essid your_ssid            # Router's SSID - no quotes
address dotted-IP-address           # IP addr you want for Pi
netmask 255.255.x.x                 # 255.0 or 0.0
network dotted-IP.0                 # i.e. x.x.x.0
broadcast dotted-IP.255             # i.e. x.x.x.255
gateway your-gateway-ip             # Usually your router's IP

If there's a line in there about "wpa", prefix it with '#' to comment it out.

Press Ctrl+O to save, then hit [Enter].
Ctrl+X to exit.

3. Logout.

4. Remove the Ethernet cable (if any) and insert the Edimax dongle.

5. Reboot

It should come up and connect automatically.

Cheers!



No comments:

Post a Comment