networking in raspberrypi

Feb 23, 2016 19:53 · 211 words · 1 minute read

I got a USB wifi for my raspberry pi 2, this way I can keep my pi2 in my room where my monitor is so that if I need to plug it in to my monitor it would be easier.

Although the wifi dongle was plug and play, I had issue with getting it to work as per the instructions on the official documentation page clickme

Instead, the following steps worked for me :

  • First verify that device is actually working by typing in
$ lsusb 
	Bus 001 Device 005: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

and

$ iwconfig

Make sure that the device interface is up if not then

$ ifup wlan0 

Inorder for me to get it to work I had to change the /etc/network/interfaces file. add the following lines:

allow-hotplug wlan0                                  
auto wlan0                                           
iface wlan0 inet dhcp                                
#  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf  
wpa-ssid "ssid-name"                                  
wpa-psk "password"                                

You can use $ iwlist wlan0 scan(you may need sudo in some cases depending on the kind of user you are.) to find out the ssid for you wifi.