A few days ago I got a bit cross with myself while trying unsuccessfully to get a wi-fi network connection working with Raspbian Wheezy. I guess I must have rushed into it, because I obviously didn't look in the right places. However, in my defence it seems that sometimes changes to the configuration don't always take effect straight away, even when I manually take the interface down and bring it back up.
The key part of getting it working came from a very useful article: Raspberry Pi - Installing the Edimax EW-7811Un USB WiFi Adapter (WiFiPi) at pislices.com. I had already chosen the Edimax EW-7811Un 150 Mbps Wireless 802.11bgn USB Adapter as it seems to generally be considered a compatible choice, and the driver is included in recent Raspbian downloads.
Getting it running involved powering off the Pi, inserting the tiny USB Wifi device, then powering back on. Once the system, was running I used lsusb and lsmod to check that the device was visible and that the driver module was installed, and iwconfig to see the existing setup. All seemed OK, so I pressed on to the next step, editing config files.
/etc/network/interfaces seemed already to be in the right shape:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
so I moved on to /etc/wpa_supplicant/wpa_supplicant.conf. This one needed a new section, describing my access point. I just added it after the lines which were already there, giving:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="My-ssid"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="My-password"
}
I hope it's obvious that you need to put your own ssid and password in the appropriate places!
At first it didn't seem that this had done the job, and I tried a few other things, none of which did much. Eventually, after one of several sudo ifdown wlan0 and sudo ifup wlan0, I was able to see using ifconfig that the wireless LAN module had got an IP address from my DHCP server. I rebooted the Pi, just to make sure the configuration "stuck", then disconnected the ethernet cable and told MobaXterm to connect to the WiFi address instead. I works great, with one fewer cables on my desk.
When I next have a go at WiFi, I hope to set up one Raspberry Pi as an access point and DHCP/NTP server, so I can run a wireless local network just for several Raspberry Pi boards, each with different jobs to do..