I want to connect my raspberry pi to wi-fi and this wi-fi uses ip address. I use raspberry pi model 2 (B+), I have wi-fi dongle. How do I connect? I have connected to pi using ssh, and I'm only able to access the command line of pi and don't have access to it's GUI.


>> cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION="8 (jessie)"
  • 1
    What distro do you use? There are quite a lot of guides out there about configuring wireless from cli on various distros. Have you tried any of them? Commented Sep 2, 2016 at 10:00
  • Can you check the below answer and confirm if it works for you. Post if you are having any errors.
    – Varad A G
    Commented Sep 2, 2016 at 10:10
  • @VaradAG where do I specify the ip address of the wi-fi which I'm supposed to connect to? Moreover there is no password for the wi-fi acess,
    – user51908
    Commented Sep 2, 2016 at 10:11
  • no, not a static one, I have to change the proxy settings manually specifying the proxy hostname and proxy port
    – user51908
    Commented Sep 2, 2016 at 10:15
  • @kvmanohar looks like the one I posted would not help you to get the issue resolved. There is a example here raspberrypi.stackexchange.com/questions/37920/…. This should help
    – Varad A G
    Commented Sep 2, 2016 at 10:21

1 Answer 1


The Raspberry Pi Foundation has a guide on setting up WiFi without a GUI.

To summarize:

Use the following to scan for available WiFi networks:

sudo iwlist wlan0 scan

This will bring up a list of available networks, make a note of the ssid of your network. Then open and edit the wpa-supplicant configuration file with:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Once open, add the following to the end of the file:

ssid="The ssid"
psk="The router password"

The ssid is the network name you found earlier, the password is the normal WiFi password. You may need to reboot.

You can check that this is running:

ifconfig wlan0

There should be an IP address under inet addr.

  • This would automatically reconnect every time rpi is restarted or wifi connection is restarted from host? Commented Sep 2, 2016 at 12:43
  • For automatic connection, you will need to add 'auto wlan0' followed by 'allow-hotplug wlan0' to the /etc/network/interfaces file. See this Stackexchange question for a full answer.
    – Deleuze
    Commented Sep 2, 2016 at 12:50
  • auto wlan0 is no longer necessary. The default /etc/network/interfaces should NOT need to be modified. NOTE the linked answer is OBSOLETE.
    – Milliways
    Commented Sep 3, 2016 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.