Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Need advice from a wpa_supplicant expert...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2006 4:04 am    Post subject: Need advice from a wpa_supplicant expert... Reply with quote

I have wpa_supplicant configured for my ipw2200 and am wondering the best way to switch between multiple APs.

wpa_gui and wpa_cli work well up to a point.

The problem is that although I can associate with the networks I still need to manually restart dhcpcd for my wifi interface.

I understand that in Gentoo when I have wpa_supp configured in /etc/conf.d/net the /etc/init.d/net.eth# scripts call the wpa_supplicant.conf and then up the interface with dhcpcd etc as directed in /etc/conf.d/net

So if I am using wpa_gui for example I have to manually dhcpcd -k eth1 once I have made the association?

Maybe i have things the wrong way round...

I often want to change between two quite different local APs (firewall and VLAN reasons) and I find that just having them all in wpa_supp.conf does not provide enough network selection flexibility. Its fine for associating with the closest/highest priority etc... but just not on the fly on demand

TIA
Will
_________________
]8P
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 05, 2006 8:22 am    Post subject: Reply with quote

Ensure that you're using baelayout-1.12.1 and wpa_supplicant-0.5.x - then it should be working fine.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2006 10:37 am    Post subject: Reply with quote

I have unmasked wpa_supplicant and am upgrading it now.

Not sure how to get the baselayout updated... How do I find out which base layout I have?

Code:

geko stardotstar # wpa_supplicant
wpa_supplicant v0.5.4

geko stardotstar # emerge --search baselayout
Searching...
[ Results for search key : baselayout ]
[ Applications found : 5 ]

*  sys-apps/baselayout
      Latest version available: 1.11.15-r3
      Latest version installed: 1.11.15-r3
      Size of files: 157 kB
      Homepage:      http://www.gentoo.org/
      Description:   Filesystem baselayout and init scripts
      License:       GPL-2

*  sys-apps/baselayout-darwin [ Masked ]
      Latest version available: 1.11.11-r1
      Latest version installed: [ Not Installed ]
      Size of files: 11 kB
      Homepage:      http://www.gentoo.org/
      Description:   Baselayout and init scripts (eventually)
      License:       GPL-2

*  sys-apps/baselayout-lite [ Masked ]
      Latest version available: 1.0_pre1
      Latest version installed: [ Not Installed ]
      Size of files: 2 kB
      Homepage:      http://www.gentoo.org/proj/en/base/embedded/
      Description:   Baselayout for embedded systems
      License:       GPL-2

*  sys-apps/baselayout-vserver
      Latest version available: 1.11.14-r4
      Latest version installed: [ Not Installed ]
      Size of files: 139 kB
      Homepage:      http://dev.croup.de/proj/gentoo-vps
      Description:   Filesystem baselayout and init scripts for Linux-VServer
      License:       GPL-2

*  sys-freebsd/freebsd-baselayout [ Masked ]
      Latest version available: 20060624
      Latest version installed: [ Not Installed ]
      Size of files: 422 kB
      Homepage:      http://www.gentoo.org/
      Description:   Filesystem baselayout and init scripts
      License:       GPL-2


Thanks for that :)
_________________
]8P
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 05, 2006 10:45 am    Post subject: Reply with quote

sys-apps/baselayout

The others are forks for specific environments. Hopefully vserver and fbsd will be merged into the baselayout-1.13 :)
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2006 10:49 am    Post subject: Reply with quote

Thank you for your fast reply...

I am still stuck

Code:

geko stardotstar # emerge -up sys-apps/baselayout

These are the packages that would be merged, in order:

Calculating dependencies... done!


so I tried:

Code:

vi /etc/portage/package.keywords

# ~x86
>=sys-apps/baselayout-1.12.11 ~x86


same same.
_________________
]8P
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2006 11:11 am    Post subject: Reply with quote

:oops: my bad...

thank you
_________________
]8P
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2006 11:38 am    Post subject: Reply with quote

Both those upgrades are in place and wireless is all working but exactly as before from what I can see- but I will have to try to associate with the two work networks tomorrow.

I still seem to need to start dhcpcd after associating with the local AP...

Will
_________________
]8P
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 05, 2006 12:02 pm    Post subject: Reply with quote

Then something is in error. Are you starting wpa_supplicant directly or via an init script?
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Wed Jul 05, 2006 10:26 pm    Post subject: Reply with quote

well both ways really.

If I start wpa_supplicant via the /etc/init.d/net.eth1 script everything works fine but it is difficult to manage which network I want to associate with; perhaps I don't understand the wpa_supp config well enough but priorities are not what I want - I may need to switch between two discrete APs at any time and will need that interface to pick up dhcp and dns when I do;
\
so I did these scripts to allow me to call the net.eth1 with a specific network configured by itself:

Code:

stardotstar@geko ~ $ cat /usr/bin/casper_up
#!/bin/sh
cp -f /etc/wpa_supplicant.conf_casper /etc/wpa_supplicant.conf
/etc/init.d/net.eth1 restart
stardotstar@geko ~ $ cat /usr/bin/sentinel_up
#!/bin/sh
cp -f /etc/wpa_supplicant.conf_sentinel /etc/wpa_supplicant.conf
/etc/init.d/net.eth1 restart
#cp -f /etc/resolv.conf.sentinel /etc/resolv.conf
stardotstar@geko ~ $ cat /usr/bin/skink_up
#!/bin/sh
cp -f /etc/wpa_supplicant.conf_skink /etc/wpa_supplicant.conf
/etc/init.d/net.eth1 restart


Crude I know but I am making progress with all this.

But recently I started playing with wpa_cli and wpa_gui and when I use wpa_supplicant by itself with wpa_supplicant.conf with all the above networks included I allows me to select the AP to associate with and correctly conducts the association but does not call dhcpcd (maybe this is exactly what it should be doing!) so I find that the IP that is reported in the wpa_gui is whatever the last network was that had dhcpcd called (either manually or by the script!)

so wpa_supplicant only handles the AP association and has nothing to do with the interface address/dns etc... :?:

I hope this clearly explains the situation - I am guessing that this is not in error but I am probably not using these tools as effectively as I could be. I have played with wifi-radar a bit but really just want a raw and fast method of switching between configured APs on demand.

Thanks for your support!

BTW baselayout upgrade went without a hitch once I specified the correct version :roll: Thanks for all your work on Gentoo!

Will
_________________
]8P
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Thu Jul 06, 2006 3:59 am    Post subject: Reply with quote

Further experimenmtation today shows that when I associate with one of the networks (in a wpa_supplicant.conf file with all entries) not only does association sometimes work but it does indeed get an address! So that is great, but wpa_gui will not seem to associate with any other AP then from the list, and when I run my latest script which calls the /etc/init.d/net.eth1 restart after copying in a wpa_supplicant.conf with all the networks it reports that eth1 failed to configure and yet it has configured:

Code:

geko stardotstar # wireless_all
 * Stopping eth1
 *   Bringing down eth1
 *     Shutting down eth1 ...                                             [ ok ] *     Stopping wpa_cli on eth1 ...                                       [ ok ] *     Stopping wpa_supplicant on eth1 ...                                [ ok ] * Starting eth1
 *   Starting wpa_supplicant on eth1 ...                                  [ ok ] *   Starting wpa_cli on eth1 ...                                         [ ok ] *     Failed to configure eth1 in the background                         [ !! ]geko stardotstar # ifconfig eth1

eth1      Link encap:Ethernet  HWaddr 00:12:F0:35:4E:7E
          inet addr:192.168.100.101  Bcast:192.168.100.255  Mask:255.255.255.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:103 errors:1 dropped:1 overruns:0 frame:0
          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:918093 (896.5 Kb)  TX bytes:130966 (127.8 Kb)
          Interrupt:11 Base address:0xe000 Memory:c0214000-c0214fff

geko stardotstar # iwconfig eth1

eth1      IEEE 802.11g  ESSID:"sentinel"
          Mode:Managed  Frequency:2.432 GHz  Access Point: 00:14:BF:E3:EC:84
          Bit Rate:54 Mb/s   Tx-Power=20 dBm   Sensitivity=8/0
          Retry limit:7   RTS thr:off   Fragment thr:off
          Encryption key:9A4A-B4F2-F5   Security mode:open
          Power Management:off
          Link Quality=61/100  Signal level=-64 dBm  Noise level=-86 dBm
          Rx invalid nwid:0  Rx invalid crypt:1  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:8


Messages reports things going ok

Code:

Jul  6 13:40:35 geko dhcpcd[29042]: verified 192.168.0.102 address is not in use
Jul  6 13:40:35 geko dhcpcd[29042]: your IP address = 192.168.0.102
Jul  6 13:40:52 geko wpa_cli: interface eth1 DISCONNECTED
Jul  6 13:40:52 geko dhcpcd[29044]: terminating on signal 15
Jul  6 13:43:57 geko wpa_cli: interface eth1 CONNECTED
Jul  6 13:43:58 geko dhcpcd[29968]: MAC address = 00:12:f0:35:4e:7e
Jul  6 13:43:58 geko dhcpcd[29968]: verified 192.168.0.102 address is not in use
Jul  6 13:43:58 geko dhcpcd[29968]: your IP address = 192.168.0.102
Jul  6 13:44:12 geko wpa_cli: interface eth1 DISCONNECTED
Jul  6 13:44:12 geko dhcpcd[29970]: terminating on signal 15
Jul  6 13:46:12 geko wpa_cli: interface eth1 CONNECTED
Jul  6 13:46:14 geko dhcpcd[30891]: MAC address = 00:12:f0:35:4e:7e
Jul  6 13:46:14 geko dhcpcd[30891]: verified 192.168.0.102 address is not in use
Jul  6 13:46:14 geko dhcpcd[30891]: your IP address = 192.168.0.102
Jul  6 13:46:23 geko wpa_cli: interface eth1 DISCONNECTED
Jul  6 13:46:25 geko dhcpcd[30893]: terminating on signal 15


So I am confused about why things are not working smoothly.
_________________
]8P
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu Jul 06, 2006 8:51 am    Post subject: Reply with quote

I don't use wpa_gui myself and don't ever bring wpa_supplicant up yourself and then start net.ethx scripts - it simply will not work. Only use net.ethx scripts - it can start wpa_supplicant for you. The trick is to just have one wpa_supplicant.conf file and use that.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Thu Jul 06, 2006 9:43 am    Post subject: Reply with quote

OK that is cool and I will work from that premise because I certainly believe you.

My question then is - how do I specify the network I want from a list of say 6?.. I can't seem to see the way that I can use the /etc/init.d/net.eth1 stop/start/restart script to choose the network I want to associate with - I must be missing something really basic.

Sorry to labor this so much but can you have a quick look at my /etc/conf.d/net and /etc/wpa_supplicant.conf (with all the networks) and suggest a way that I can readily and dynamically choose which AP I want at any given time...

When I have a list of APs the wrong one often associates even though when I run my scripts which only ever offer one they work just fine...

BTW the IPs do seem to be coming up just fine since the upgrades :thumbup:

Code:


geko stardotstar # cat /etc/conf.d/net
modules_eth0=( "ifconfig" )
modules_eth1=( "wpa_supplicant" )
wpa_supplicant_eth1="-Dwext -Ktdd -c/etc/wpa_supplicant.conf"
#wpa_supplicant_eth1="-Dwext -ieth1 -c/etc/wpa_supplicant.conf"
wpa_timeout_eth1=60
modules=( "!iwconfig" )
fallback_eth0=( "192.168.0.200 netmask 255.255.255.0" )
fallback_route_eth0=( "default via 192.168.0.1" )
wpa_timeout_eth1=60

config_Casper=( "dhcp" )
#dhcpcd_Casper="-t 5"

config_skink=( "dhcp" )
#dhcpcd_skink="-t 5"

config_sentinel=( "dhcp" )
#config_sentinel=( "192.168.100.207 netmask 255.255.255.0" )
#routes_sentinel=( "default gw 192.168.100.1" )

config_evilhomer=( "dhcp" )

config_eth0=( "dhcp" )
config_eth1=( "dhcp" )

dhcpcd_eth0="-t 20"

Code:

geko stardotstar # cat /etc/wpa_supplicant.conf_all
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=2
ap_scan=2
update_config=1

network={
        ssid="skink"
        psk=2e7c34743ea19ece1074666e101996b3982a394102fcdb25be3bcac2735d1339
        proto=WPA
        key_mgmt=WPA-PSK
}

network={
        ssid="sentinel"
        key_mgmt=NONE
        wep_key0=********
        priority=2
}

network={
        ssid="Casper"
        key_mgmt=NONE
        wep_key0="*****"
        priority=3
}

network={
        ssid="evilhomer"
        key_mgmt=NONE
        wep_key0=*****
        priority=1
}


Many thanks for all your help UberLord


Will
_________________
]8P
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu Jul 06, 2006 10:26 am    Post subject: Reply with quote

stardotstar wrote:
My question then is - how do I specify the network I want from a list of say 6?


You've already specified the priority for each network - wpa_supplicant then makes the decision based on these numbers (highest first) and the available networks.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
stardotstar
l33t
l33t


Joined: 10 Feb 2006
Posts: 887
Location: 2074/SYD/NSW/AU

PostPosted: Thu Jul 06, 2006 10:40 pm    Post subject: Reply with quote

So, just to conclude this thread:

I really need to stick with my mini scripts or some such wpa_suopplicant.conf modifying approach if I want to manually select a particular network that is a lower priority than one of the available other networks in the wpa_supplicant.conf? ie wpa_supplicant handles automatic association of networks based only on priority and availability and not specification of a particular network (although wpa_cli should do this I can't seem to get it to work consistently - more exercises i guess)

Thanks again,

Will
_________________
]8P
Back to top
View user's profile Send private message
UberPinguin
Guru
Guru


Joined: 20 Nov 2005
Posts: 510
Location: 2416.94 Miles From Home

PostPosted: Sun Sep 10, 2006 9:03 pm    Post subject: Reply with quote

Try wlassistant. It will list any detected networks and let you choose which one to connect to - even if it's not configured in wpa_supplicant.conf (mine is empty). If you've never connected to that network before, a configuration dialog will appear. I haven't tried using it to dynamically switch between multiple networks, but it's worth a shot.
_________________
aidanjt wrote:
You see, instead of arguing from ignorance, and fear, there is only one way to verify a theory. And that's not by clutching a black book and begging the sky fairy for deliverance from the mad scientists and their big machines.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum