Toontje
Posts: 20
Joined: Sun Jan 13, 2013 12:51 pm

Wifi and wpa_supplicant

Sun Jan 13, 2013 12:58 pm

Hi all!

I have been reading tens of tutorials on how to set up Wifi on the Pi. Almost all of them use a plain /etc/network/interfaces file. You are supposed to add the typical wlan0 lines to it.

I have ran twice into the issue that the interfaces file was configured incorrect and i had to flash the SD again to go back to the original config so i can access the Pi again over eth0 (no, i don't have a keyboard connected to the Pi).

Can someone post a complete example of the interfaces file, the wpa-supplicant.conf file and any other files that are realted to setting up Wifi on the Pi?

That way we have a clear example based on the latest version of Raspbian and we, dummies, can take it from there.
So a COMPLETE example. I'm not looking for "add this and that" because most of us are struggling with the issue WHERE to add the lines and what to do with the ones that were already there.

Thanks,

Ton.

User avatar
bgreat
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm

Re: Wifi and wpa_supplicant

Sun Jan 13, 2013 1:21 pm

Using latest Raspbian with two wireless networks configured.

/etc/network/interfaces

Code: Select all

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 default inet dhcp
/etc/wpa_supplicant/spa_supplicant.conf

Code: Select all

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

network={
        ssid="My-Router1-SSID"
        psk="plaintext-PSK-Router1"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

network={
        ssid="My-Router2-SSID"
        psk="plaintext-PSK-Router2"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}
Replace the "ssid" entries with the correct SSID values for your wireless network. Replace the "psk" entries with the correct password key for the wireless SSID.

Should be all that is needed.

Enjoy!
Bill

User avatar
Polydnj
Posts: 25
Joined: Wed Oct 10, 2012 1:59 am
Contact: Website

Re: Wifi and wpa_supplicant

Sun Jan 13, 2013 4:16 pm

I know it can be educational and help you learn how to set-up the wifi dongle by editing the networking files on the Pi. Once you figure everything out, I highly suggest using seeing if MrEngman automatic setup script will do the trick.

pjc123
Posts: 913
Joined: Thu Mar 29, 2012 3:37 pm
Contact: Website

Re: Wifi and wpa_supplicant

Sun Jan 13, 2013 9:51 pm

Toontje wrote: Can someone post a complete example of the interfaces file, the wpa-supplicant.conf file and any other files that are realted to setting up Wifi on the Pi?

That way we have a clear example based on the latest version of Raspbian and we, dummies, can take it from there.
So a COMPLETE example. I'm not looking for "add this and that" because most of us are struggling with the issue WHERE to add the lines and what to do with the ones that were already there.

Thanks,

Ton.
That is a very tall and impossible order. I myself have supplied working settings of the various network config files on this forum to help people out, but unfortunately, every person has a slightly different setup and you will never get definitive instructions for setting up wifi that will work for everyone. (There are just too many variables; Static vs DHCP settings, single vs. multiple dongles, single vs multiple routers, different brands and chipsets of dongles/routers/access points, no encryption vs various different types of encryption, roaming vs no roaming, infrastructure vs adhoc, various key management types, various authentication algorithms, various pairwise ciphers, various operating systems and versions, and the list goes on and on for a very long time).

I understand the pain of a new user to all of this, but people can only offer help as basic recommendations, and if you find yourself going around in circles, you really need to read the documentation that comes with the pi operating system (/usr/share/doc, man command, etc.) and/or read the many web tutorials to gain an understanding of how networking works in order to properly tweak the settings for your own application. The other option is to use one of the wifi setup scripts or gui wifi setup programs that come with the pi in order to automate the setup of wifi, but again, that will not necessarily work for everyone, and you may still need to understand how to tweak the network files. You also need to realize that the web is loaded with untested and non-working recommendations for everything under the sun, so take any example config files with a grain of salt; this is especially true of forums and wikis, where anybody can type in anything, whether it is accurate or not.
My Raspberry Pi Project Page:
https://www.flaminghellmet.com/launch/

repton
Posts: 91
Joined: Sat Mar 17, 2012 6:06 pm
Location: North Yorkshire, UK.
Contact: Website

Re: Wifi and wpa_supplicant

Mon Jan 14, 2013 11:06 am

Here is my entire /etc/network/interfaces file. I didn't edit any other files to get the WLAN working.

Code: Select all

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 default inet dhcp

auto wlan0
iface wlan0 inet static
        address 192.168.0.21
        netmask 255.255.255.0
        gateway 192.168.0.1
        wpa-essid not-telling-you
        wpa-psk not-telling-you-this-either
HTH,
Paul
UK Supplier of 1-Wire components, kits and modules:
http://www.sheepwalkelectronics.co.uk/

MaxChinni
Posts: 1
Joined: Thu Aug 22, 2013 10:51 am

Re: Wifi and wpa_supplicant

Thu Aug 22, 2013 11:09 am

I'd like to give my contribution.
I'm in the same situation of repton, but I preferred to use the cryptographic form for the psk field.
You can use the wpa_passphrase utility to calculate the needed string:

Code: Select all

[email protected]:~# wpa_passphrase not-telling-you 
# reading passphrase from stdin
not-telling-you-this-either
network={
        ssid="not-telling-you"
        #psk="not-telling-you-this-either"
        psk=67a2765f0ebc269099e3bb2e09a51595c37ec5c4d323bda3a528d6f11fc243d2
}
A good explanation of the utility can be found on StackOverflow (http://stackoverflow.com/questions/1192 ... -algorithm).
So the /etc/network/interfaces portion of code could be:

Code: Select all

iface wlan0 inet static
        address 192.168.0.21
        netmask 255.255.255.0
        gateway 192.168.0.1
        wpa-essid not-telling-you
        wpa-psk 67a2765f0ebc269099e3bb2e09a51595c37ec5c4d323bda3a528d6f11fc243d2
Now the pre-shared key value cannot be guessed by reading the file.

Bye

Return to “Beginners”