4

I am a beginner in world of Raspberry Pi, I have got this Raspberry Pi 2 Model B and i was working with Ethernet cable and now I tried to switch to WiFi but I am not able to do so.

In the latest Raspbian version there is a GUI in which we can scan the WiFi networks and just connect with correct password but every time I do so it throws an error saying Failed to Disconnect. Raspberry Pi GUI wifi connection

My files are configured as follows:

sudo iwlist wlan0 scan is detecting the WiFi to which I want to connect.

Here is sudo nano /etc/wpa_supplicant/wpa_supplicant.conf:

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

network={
ssid="*******"
psk="********"
proto=WPA
key_mgmt=WPA-PSK
pairwise=TIKP
auth_alg=OPEN
}

And here issudo nano /etc/network/interfaces:

auto lo
iface lo inet loopback

autho eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

My network is using WPA1. The Ethernet connection works without any problems

Can anybody help what exactly wrong I am doing?

  • 1
    How (and I might add why) are you using "static IP"? – Milliways Dec 12 '15 at 8:12
  • Are you sure you have pairwise=TIKP in /etc/wpa_supplicant/wpa_supplicant.conf? As far as I know, that's invalid and probably should be pairwise=TKIP. Another thing you can try is comment out (place # in front of it) all the lines in your network block, except ssid and psk. Finally, can you add the output of lsusb to your question so that we can see which wifi device you're using? – Diederik de Haas Dec 12 '15 at 20:01
2
  1. Use ifconfig to find the wlan interface. You use wlan1, check if it shows up after the command. If wlan0 is the wireless interface, we configure for it.

  2. Here's the walk through:
    Put this in /etc/network/interfaces

    auto lo
    iface lo inet loopback
    iface eth0 inet dhcp
    
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    
    iface home inet static
    address #The-Address-You-Want-To-Use
    netmask #Mask
    gateway #gateway
    
    iface default inet dhcp
    

    And put this in /etc/wpa_supplicant/wpa_supplicant.conf

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config =1
    network = {
        ssid = "Your ssid"
        scan_ssid = 1
        psk = "Your password"
        key_mgmt = WPA-PSK
        id_str = "home"
        priority = #your chosen priority
    }
    

id_str="home" is important because this is used to refer to the iface home inet static wpa-roam puts wlan preference over ethernet.

  • You may want to check your answer again, because it contains a number of inconsistencies and at least one 'spelling' error – Diederik de Haas Dec 12 '15 at 21:07
1

English is not my native language so please be patient.

From one newbie to another this is what it have work for me:

First you're using dhcp in the eth0 so you can ssh your Pi, that's ok.

Let's make the changes that the link explains:

Go to /etc/network/interfaces and edit as it follows:

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual

Then edit your /etc/wpa_supplicant/wpa_supplicant.conf as it follows:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
# ap_scan can be 0, 1, or 2. Some sources say use 2 but 1 work for me.
ap_scan=1
eapol_version=1
network={
        ssid="YOURSSID"
        # This is needed for hidden SSIDs
        scan_ssid=1
        mode=0
        psk="reallylonghexnumber"
        # RSN for WPA2 or WPA for WPA1
        proto=RSN
        # WPA-PSK or WPA-EAP
        key_mgmt=WPA-PSK
        # CCMP for AES or TKIP for TKIP.
        pairwise=CCMP
        # OPEN for WPA1/2 or SHARED or LEAP
        auth_alg=OPEN
}

About the line scan_ssid=1 will be some controversy because some more experimented users don't like the hidden ssid thing, but I repeat this works.

Hopefully this works for you also.

Sources:

https://linuxtechie.wordpress.com/2014/08/23/setting-up-raspberry-pi-with-wifi-and-a-static-ip-on-a-hidden-ssid/

https://geekytheory.com/tutorial-raspberry-pi-configurar-wif/

0

Also make sure you're using a decent power supply. I had a number of posts to my pi-point project about folks with Pi2s not being able to connect. After a bit of googling and checking between PiBs and the Pi2 it turned out that a weak power supply was causing errors and dropout on the USB wifi dongle on the Pi2 which caused it to fail to initialise fully as a WiFi router.

-1

I use archlinuxarm system, it's very easy to connect wifi.

  1. install wpa_supplicant.
  2. sudo cp /etc/netctl/examples/wireless-wpa-static /etc/netctl/wireless
  3. sudo vim wireless ###config your wifi
  4. netctl start wireless

Done.

  • 3
    Hello and welcome. Since the question is specifically about Raspbian, suggesting how to solve with Arch Linux might not be the best of all answers ;) – Ghanima Jan 22 '16 at 6:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.