Skip to content

Instantly share code, notes, and snippets.

@tomysmile
Created November 18, 2015 06:36
Show Gist options
  • Save tomysmile/6cad528b764a5f2c2ccf to your computer and use it in GitHub Desktop.
Save tomysmile/6cad528b764a5f2c2ccf to your computer and use it in GitHub Desktop.
Raspberry: WIFI Settings

At the prompt, enter the following command:

sudo nano /etc/network/interfaces

In the nano text editor, you’ll see something like this:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

That’s the very basic configuration that governs your Pi’s Ethernet connect (indicated by the eth0 portion). We need to add on a very minor bit to enable the Wi-Fi dongle. Use the arrow keys to move down below the existing entry and add the following lines:

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

Once you’ve annotated the file, press CTRL+X to save the file and exit the nano editor. At the prompt again, enter the following command:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Compare the contents of the file, if it exists, to the following code. If the file is empty, you can use this code to populate it. Take note of the commented lines (indicated by the # marks) to reference which variable you should use based on your current Wi-Fi node configuration.

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

network={
ssid="YOURSSID"
psk="YOURPASSWORD"

# Protocol type can be: RSN (for WP2) and WPA (for WPA1)
proto=WPA

# Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)
key_mgmt=WPA-PSK

# Pairwise can be CCMP or TKIP (for WPA2 or WPA1)
pairwise=TKIP

#Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP)
auth_alg=OPEN
}

When you’re done editing the file, press CTRL+X to save and exit the document. Now is the time to unplug the Ethernet cable and plug in the Wi-Fi dongle.

At the command prompt, enter the following command:

sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment