Nav

Connecting a Raspberry Pi to WiFi

Edit me

/etc/wpa_supplicant/wpa_supplicant.conf

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

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

/etc/network/interfaces

#interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

auto lo
iface lo inet loopback

#auto eth0
#allow-hotplug eth0
#iface eth0 inet manual

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

After making the above configuration changes, run this command:

sudo ifdown wlan0 && sudo ifup wlan0

Then check your IP configuration:

ifconfig

If you have trouble connecting, try to connect manually by running these two commands:

sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -Dwext
sudo dhclient -v wlan0

Some other useful commands:

# you can run this command to view a list of wireless networks in range
sudo iwlist wlan0 scan

#run this command to view the connection status of the wireless network
wpa_cli