Skip to content

Instantly share code, notes, and snippets.

@jonlong
Last active December 29, 2015 02:59
Show Gist options
  • Save jonlong/7604292 to your computer and use it in GitHub Desktop.
Save jonlong/7604292 to your computer and use it in GitHub Desktop.
Configuring Raspberry Pi WiFi settings from the command line

Useful for when you're setting up a new wifi-enabled RPi without an external monitor/keyboard. The best way to do this is by using a TTY to Serial Cable, per the instructions here: http://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/

Note that this only works for non-hidden networks.

  sudo nano /etc/network/interfaces

For regular networks, replace whatever's in there with this:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0

iface wlan0 inet dhcp
wpa-ssid "Network Name"
wpa-psk "password"

If you've got a hidden SSID, use this instead:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
   wpa-scan-ssid 1
   wpa-ap-scan 1
   wpa-key-mgmt WPA-PSK
   wpa-proto RSN WPA
   wpa-pairwise CCMP TKIP
   wpa-group CCMP TKIP
   wpa-ssid "Network Name"
   wpa-psk "password"

iface default inet dhcp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment