7 November 2016

Configure wifi on raspberrypi remotely

1) Open a SSH connection with raspberrypi
To set up an SSH please use PuTTY. 
For Windows PC's download PuTTY from here.Just double click the putty.exe to run PuTTY. 
For Linux PC's open terminal and install PuTTY
sudo apt-get install putty
To run PuTTY type "putty" in the terminal

In the PuTTY configuration enter --
Host name: raspberrypi.local    #linux PC's
Host name: raspberrypi          #Windows PC's
Port :22
Leave all others as default values
Click open

A terminal opens up
login in as: pi
Password : raspberry

2) Configure wifi on Raspberrypi
Plug in the wifi dongle to Raspberrypi. This has been tested with raspberrypi 2b, the raspberrypi3b had wifi onboard :)

wifi on raspberrypi
Type on the terminal pi@raspberrypi

wpa_cli status

If you receive a message something like this "Failed to connect to non-global ctrl_ifname: (null)  error: No such file or directory" Your wifi dongle doesn't work or doesn't support wifi connections.

You are lucky if you get the following message:)

pi@raspberrypi:~$ wpa_cli status
Selected interface 'wlan0'
wpa-State=INACTIVE
address=xx:xx:xx:xx:xx:xx    #hardware address

uuid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx

raspberrypi wifi configuration

To make the wifi configuration simpler, enter the interactive mode type
wpa_cli

Create a new network using
add_network

You will get an integer value as the network id in return. For instance, if its your first network you get a 0 and so on.

To configure the network enter the following.Replace the 0 with your network id obtained from add_network.

set_network 0 ssid "mywifissid"
set_network 0 psk "mywifipassword"

Finally to connect to the wifi network type
select_network 0

Type quit to exit

That's it :) - you have configured wifi on pi remotely.


raspberrypi wifi configuration


No comments:

Post a Comment