Raspberrypi : Step-by-Step Wifi Configuration (Single or Multiple networks)

Recently I had a chance to work with Raspberrypi Model B. Following instructions will guide you to set up wifi on Raspberrypi.

Requirement:
USB Wifi dongle (I use Comfast WU715N [Ralink Chipset 5370])
Monitor and Keyboard connected to RPI or SSH using Ethernet

Configuration Steps (Single Connection)

Open network configuration file using following command
sudo  nano /etc/network/interfaces

Update network configuration file as below. Keep it mind that default configuration files comes with "wpa-roam" command and you need to replace it with "wpa-conf".

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wireless-power off
iface default inet dhcp

Save the file by pressing "CTRL+O" and exit editor by "CTRL+X"

Then open wlan configuration file in following path
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Update wlan configuration file as below

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

network={

ssid="YOURSSID"
psk="YOURPASSWORD"
key_mgmt=WPA-PSK
scan_ssid=1
id_str="connection1"
}

Save the file by pressing "CTRL+O" and exit editor by "CTRL+X"

Then switch off the wlan0 using following command
sudo ifdown wlan0

Then switch-on the wlan0 using following command
sudo ifup wlan0

Then you will see it will search for DHCP and connected to your Wifi router.


Configuration Steps (Multiple Connections)

You can add multiple connection configuration by repeating network={} section in the wlan configuration file as shown below.

Then open wlan configuration file in following path
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Update wlan configuration file as below. Keep in mind that you need to provide unique name for each and every entry "id_str".

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

network={

ssid="YOURSSID"
psk="YOURPASSWORD"
key_mgmt=WPA-PSK
scan_ssid=1
id_str="connection1"
}

network={

ssid="YOURSSID2"
psk="YOURPASSWORD2"
key_mgmt=WPA-PSK
scan_ssid=1
id_str="connection2"
}

Keep me posted if you guys find any issue with configuring wifi in Raspberrypi.

[update : 20140615] My wifi goes power down sometimes. I'm trying following fix but not yet confirmed.
Make the following edit in /etc/kbd/config: POWERDOWN_TIME=0

If you still face Wifi power down after sometime, try to update the drivers using following command.


sudo apt-get install firmware-ralink



Comments

  1. It feels striking to peruse such educational and unmistakable articles on your sites wifi router

    ReplyDelete

Post a Comment

Popular posts from this blog

Embedding PowerBI with ASP.NET Core 2 and Angular(2,4,5)

Handling Exit Event of Console Application in C#

CSS text-overflow ellipsis in the beginning of the the text - Left Ellipsis using CSS in a Flex box