Raspberry Pi Networking Files

More for my reference, as I keep forgetting the files – these are the files you need to edit when connecting to a network – which I have had to do lately when driving the car around work.

/etc/network/interfaces

In the interfaces file, I have set a static IP of 192.168.0.24

auto lo

iface lo inet loopback
iface eth0 inet dhcp

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

iface wlan0 inet static
address 192.168.0.24
netmask 255.255.255.0
gateway 192.168.0.1
wpa-ssid “NETWORK-NAME”
wpa-psk “NETWORK-KEY”

 

/etc/wpa_supplicant/wpa_supplicant.conf

In the wpa_supplicant.conf file, multiple networks settings can be specified, I added my work network in here too, but had to use the field ‘scan_ssid=1′ to indicate it was a hidden network, and put the network name and key in as normal. When you fill in the form to connect to a network in the WiFi Config application, it adds an entry here with your entered data – so a good place to look if you mistyped a value. After returning home, I found that my home network had ‘disabled=1′, and it wouldn’t automatically connect. Without that line, it connects automatically.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid=”NETWORK-NAME”
psk=”NETWORK-KEY”
proto=RSN
key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP WEP104 WEP40
auth_alg=OPEN
}

 

Matt