Network setup (incl. wireless)

From The World according to Vissie
Jump to navigation Jump to search

Manually setup wifi

Start by booting the Raspberry Pi, connected to a display and a keyboard. Open up the terminal and edit the network interfaces file:

sudo vim /etc/network/interfaces

This file contains all known network interfaces, it'll probably have a line or two in there already.

Change the first line (or add it if it's not there) to:

auto wlan0

Then at the bottom of the file, add these lines telling the Raspberry Pi to allow wlan as a network connection method and use the /etc/wpa_supplicant/wpa_supplicant.conf as your configuration file.

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

The next step is to create this configuration file.

Configuring WiFi connection

Open up the wpa_supplicant.conf file in the editor.

sudo vim /etc/wpa_supplicant/wpa_supplicant.conf

Again, some lines might already be present, just add the following.


The other parameters are network specific, I can't tell you what you need. If you boot Raspbian to desktop, you can launc the wpa_gui (WiFi config) application and click 'Scan'. You'll find a list that has your network too with all flags you need. To do this on a RPi A you'll have to disconnect your keyboard and connect your dongle once the scanning list is open.

proto could be either RSN (WPA2) or WPA (WPA1).
key_mgmt could be either WPA-PSK (most probably) or WPA-EAP (enterprise networks)
pairwise could be either CCMP (WPA2) or TKIP (WPA1)
auth_alg is most probably OPEN, other options are LEAP and SHARED
Make sure it works

Reboot the Raspberry Pi and it should connect to the wireless network. If it doesn't, repeat above steps or get help from an adult.

Resolve DNS issues

I solve the problem by using Amrish instructions at Ask Ubuntu Stack Exchange, i.e. by using the following code:

sudo rm /etc/resolv.conf
sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf


sudo ln -s /run/dnsmasq/resolv.conf /etc/resolv.conf
sudo resolvconf -u