Re: HowTo: Connect and roam wifi networks with wpasupplicant

Are they really that different, even if the versions match?

Anyway, here's the output:

Internet Systems Consortium DHCP Client V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/4c:ed:de:11:d1:0e
Sending on   LPF/wlan0/4c:ed:de:11:d1:0e
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPOFFER of 192.168.2.4 from 192.168.2.1
DHCPREQUEST of 192.168.2.4 on wlan0 to 255.255.255.255 port 67
DHCPACK of 192.168.2.4 from 192.168.2.1
bound to 192.168.2.4 -- renewal in 821429282 seconds.

And again, thanks for your time and help...

Last edited by El_Belgicano (2012-01-08 21:42:58)

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Well, you're connected. Check your router settings, or your dhclient configuration file (/etc/dhcp/dhclient.conf) for anomalies with regard to connection dropouts. DEbian's ifupdown executes a bunch of scripts, one of which is calling ifupdown.sh in /etc/wpasupplicant/ifupdown.sh, a script that keeps the connection alive during inactivities, suspend/resume and similar.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

I'll look into those, thanks for the tips...

I'll also investigate how to manage the roaming from /etc/network/interfaces...

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Try wpagui for roaming, it helps.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Hi there el_koraco, and thanks again for the tutorial. And thanks to you, I have been able to displace NetworkManager with wpa_gui :-) Huzzah! But that said, I think a little more needs to be said here about how the static/dhcp setup of an IP address is achieved, when wpa-roam is being used.

When I first tried to connect to wifi with ifupdown and wpa-roam/wpa_gui, the network connected okay, but without the config of an IP address. So had to type in 'dhclient wlan0' just to make it usable. The reason why that happened is because after wpa_supplicant has established an encrypted connection, it will then again call ifup, and requests it to map the physical interface 'wlan0' onto some other logical interface, which in most cases is named 'default'.

But if that logical interface 'default' isn't defined in the /e/n/i, then when the wpa_supplicant script requests ifup to map 'wlan0' onto 'default', then the ifup will just exit with an error, becos the 'default' interface is undefined. Such that the dhcp/static config of an IP address will never occur. So to prevent that, we need to append this line to the /e/n/i

iface default inet dhcp

And similarly, for each id_str="some_name" entry contained within the network stanzas defined in your /etc/wpa_supplicant/wpa-roam.conf file, another logical interface needs to be declared in you /e/n/i. And these multiple logical interface declarations can each specify a different kinds of dhcp/static configuration, as required. So yes, it is very flexible...

I hope that all makes sense. Clear as mud, huh? But if not, then I think this manpage entry here may help...

$ man wpa_action |sed '70,$ !d'

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Nice detective work!

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Hey thanks, you're welcome! smile

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Alrighty, bumping for added info, in case anyone is interested.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

i love this how-to.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

el_koraco wrote:

WPA is slightly different. After bringing the interface up with ip, we will add this to /etc/wpasupplicant/wpa_supplicant.conf

......

Run

sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf

Proceed with dhclient.

I'm trying to get this working as I'm having problems with network-manager.  I suppose the file in the first sentence should be /etc/wpa_supplicant.conf, otherwise I get some failure notice.



I also received this error:

$ sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument

Any idea what this is?

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Tunafish wrote:

I suppose the file in the first sentence should be /etc/wpa_supplicant.conf, otherwise I get some failure notice.

Or the command should be

sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

My bad. Corrected now.

As for your dilemma, try to run stuff in the foreground, that way we'll get more info. Maybe include the wext driver just to be safe.

sudo wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant.conf

Re: HowTo: Connect and roam wifi networks with wpasupplicant

This is what I get:

$ sudo wpa_supplicant -i wlan0 -c /etc/wpasupplicant/wpa_supplicant.conf
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Trying to associate with xx:xx:xx:xx:xx:xx (SSID='NN-router' freq=2432 MHz)
Authentication with xx:xx:xx:xx:xx:xx timed out.
Trying to associate with xx:xx:xx:xx:xx:xx (SSID='NN-router' freq=2432 MHz)
Authentication with xx:xx:xx:xx:xx:xx timed out.
Trying to associate with xx:xx:xx:xx:xx:xx (SSID='NN-router' freq=2432 MHz)
Authentication with xx:xx:xx:xx:xx:xx timed out.
Trying to associate with xx:xx:xx:xx:xx:xx (SSID='NN-router' freq=2432 MHz)
Authentication with xx:xx:xx:xx:xx:xx timed out.
Trying to associate withxx:xx:xx:xx:xx:xx (SSID='NN-router' freq=2432 MHz)
Authentication with xx:xx:xx:xx:xx:xx timed out.
Trying to associate with xx:xx:xx:xx:xx:xx (SSID='NN-router' freq=2432 MHz)
Associated with xx:xx:xx:xx:xx:xx
WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed (auth) [id=0 id_str=]

When I use wext I get the first four lines and then a repeating time out. No connection.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Associated with xx:xx:xx:xx:xx:xx
WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed (auth) [id=0 id_str=]

You actually typed in xxx instead of your SSID, right?
Try to replace your network parameters with this:

network={
    ssid="ENTER YOUR SSID NAME HERE"
    psk="ENTER YOUR PASSWORD IN ASCII"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    priority=30
}

If it doesn't work, with this

network={
    ssid="ENTER YOUR SSID NAME HERE"
    psk="ENTER YOUR PASSWORD IN ASCII"
    proto=WPA
    key_mgmt=WPA-PSK
    pairwise=TKIP
    priority=30
}

Where it says ENTER YOUR SSID NAME HERE you need to enter your actual SSID (name of the network as it shows up when you search for it). The same goes for the password. Remember, you have to  run

sudo dhclient wlan0 

afterwards.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

el_koraco wrote:

You actually typed in xxx instead of your SSID, right?

I did, does it make sense to do this? I noticed some others doing it as well... (O now, that's a good reason hmm )

el_koraco wrote:

Try to replace your network parameters with this:...

I tried.... no difference...
Could this problem be related to my wireless card?
http://crunchbanglinux.org/forums/topic … tl-8188ce/

My modem is using WPA2 encryption.

I've already spend days getting wifi to work.... i'm about to give up sad

Last edited by Tunafish (2012-02-23 20:14:02)

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Reboot. Run

sudo service network-manager stop
sudo ip link set wlan0 down 
gksudo /etc/network/interfaces

Add this in:

allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-ssid YOURSSID
        wpa-key YOURKEY (in ASCI)

then

 sudo ifup wlan0

Last edited by el_koraco (2012-02-23 20:11:25)

Re: HowTo: Connect and roam wifi networks with wpasupplicant

$  sudo ifup wlan0
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/ xx:xx:xx:xx:xx:xx
Sending on   LPF/wlan0/ xx:xx:xx:xx:xx:xx
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 2
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

Last edited by Tunafish (2012-02-24 22:34:02)

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Try to disable network-manager

sudo update-rc.d network-manager remove

Reboot and try again with

sudo ifup wlan0 

and the above mentioned config in /etc/network/interfaces. And please, let me see output of

cat /etc/network/interfaces 

You can reenable network manager with

sudo update-rc.d network-manager defaults

Last edited by el_koraco (2012-02-23 21:06:42)

Re: HowTo: Connect and roam wifi networks with wpasupplicant

I did what you mentioned in the last post.
Wireless is working now. Here's some output:

$ sudo cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-ssid xxxxxxxxxxx
    wpa-psk 12345678

Before the connection was made, dmesg keeps repeating this message:

[  593.534107] rtl8192c_common: Loading firmware file rtlwifi/rtl8192cfw.bin
[  594.739785] wlan0: authenticate with xx:xx:xx:xx:xx:xx (try 1)
[  594.937128] wlan0: authenticate with  xx:xx:xx:xx:xx:xx (try 2)
[  595.136776] wlan0: authenticate with  xx:xx:xx:xx:xx:xx (try 3)
[  595.336482] wlan0: authentication with  xx:xx:xx:xx:xx:xx timed out

Last edited by Tunafish (2012-02-24 22:33:02)

Re: HowTo: Connect and roam wifi networks with wpasupplicant

There was some residual network manager process disturbing the setup. Good to see it working. Everything is fine in your current setup. Edit out your wpa-ssid and wpa-key lines please.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

el_koraco wrote:

There was some residual network manager process disturbing the setup. Good to see it working. Everything is fine in your current setup. Edit out your wpa-ssid and wpa-key lines please.

Any reason ping is not working?

So now I can continue with the other steps in post #1?
I use the laptop on about 6 different locations, so I have to set up roaming.
Would installing ceni and wpagui be the easiest way?

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Tunafish wrote:

Would installing ceni and wpagui be the easiest way?

It is by far the easiest way. No idea about ping. Does it matter if you can catch other networks?
As for ceni and wpagui. First install both of them. Then open ceni, select your wlan0 card, choose reconfigure. Pick the "Roam" option on the next screen. Select the defaults. Then open wpagui as root (or with gksudo), and it's pretty much like network manager, though numerous windows will pop up. You have scan, select your network, enter the WPA passkey, close the window. If it doesn't connect, just reboot, wpagui is sometimes unpredictable.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

wireless is still buggy, sometimes it works, mostly not.
With ceni I get the same errors about dhcp:

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 2
No DHCPOFFERS received

Is 255.255.255.255 the right address here?

I got an offer from someone to buy this laptop (with windows installed), so that's my best solution I think.

Thanks for all the help.

Re: HowTo: Connect and roam wifi networks with wpasupplicant

Just  began reading this thread.... so I am a late arrival..
Very useful ... Nice Work
If El_Koraco is so inclined this would be a needed WiFi addition in the Wiki... just a thought..

Last edited by sqlpython (2012-02-25 02:16:31)

OHCBR #!, Wheezy, Squeeze, Siduction, Slackware 13.xx,