Wifi on Your Raspberry Pi?

So you just bought your pi with wheezy and you’ve purched a usb dongle

First off, you should upgrade all your shit…always, unless you have crazy stuff that depends on other stuff being old and stuff…

sudo apt-get update
sudo apt-get upgrade

Next reboot your pi.

sudo reboot

Have a look around then alter:

sudo nano /etc/network/interfaces

If you’re finding it hard to type characters in the next section because your keyboard map is off, do this and reboot

sudo dpkg-reconfigure keyboard-configuration

To look like this (provided your have DHCP on your network, if you can’t figure it out look here.):

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

Next we’ll setup wifi and configuration (I’m getting this from this guy). Then we’ll install ssh so we don’t need that hefty HDMI cable anymore and you can remote into your pi. But first we need to get it working…

Insert the following into your supplicant conf file by typing

sudo pico /etc/wpa_supplicant/wpa_supplicant.conf

And insert the following

 

network={
ssid="SSID-GOES-HERE"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="WIFI-PASSWORD-GOES-HERE"
}

If you need to know what’s on your network try this

sudo iwlist wlan0 scan

Make sure you’ve also removed anything pertaining to wlan0 in your 70-persistent-net.rules files

Once we’ve got our configuration correct shut down your system.

sudo shutdown -h now

Unplug your ethernet and turn your pi back on.

Log in to your system and type

iwconfig

You should see that you’re associated with your network. If you’re not and you have a realtek wifi dongle, look here. Basically you just need to install the firmware for your device.

You can also restart your network by issuing the following

sudo /etc/init.d/networking restart

 

UPDATE:

I had some problems getting the above to work properly. I followed this tutorial and it worked for me: http://kerneldriver.wordpress.com/2012/10/21/configuring-wpa2-using-wpa_supplicant-on-the-raspberry-pi/

Make sure if your wifi adapter isn’t coming up automatically, that you bring it up manually:

sudo ifup wlan0

I actually also changed everything to what “peppertarts” says here. So make sure you disregaurd the above if it doesn’t work for you basically all you need is:

sudo nano /etc/network/interfaces

and insert

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf

at the end of the file, then

sudo nano /etc/wpa.conf

And finally

network={
ssid="NETWORK_SSID"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="NETWORK_PASSWORD"
}

Then type

sudo ifup wlan0

and reboot after you make sure its running. Pretty simple after all that work. Either way, make sure your wifi works before you try to install ssh and run it

 

Installing SSH

So we don’t need to always have our pi plugged into an HDMI capable screen, we can ssh into our pi. This is useful especially when we want to remove peripherals like our mouse and keyboard to make room for other devices like wifi dongles etc. We’ll need to install ssh to allow us to log in remotely

sudo apt-get install ssh

Then start the daemon

sudo /etc/init.d/ssh start

Next we need it to run on startup

sudo update-rc.d ssh defaults

After rebooting you should see your PI’s IP address. This will tell you that its working.

Just to recap:

  1. Make sure your wifi adapter is working and automatically connecting to the network on startup
  2. Install ssh on your pi
  3. Find your pi on the network and have fun!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.