0

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.

EDIT::

>> cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
5
  • 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? – Michael Daffin Sep 2 '16 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 Sep 2 '16 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 Sep 2 '16 at 10:11
  • no, not a static one, I have to change the proxy settings manually specifying the proxy hostname and proxy port – user51908 Sep 2 '16 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 Sep 2 '16 at 10:21
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:

network={
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.

3
  • This would automatically reconnect every time rpi is restarted or wifi connection is restarted from host? – Abhinav Gauniyal Sep 2 '16 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 Sep 2 '16 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 Sep 3 '16 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy