Traditionally configure wlan?

Nils Kassube kassube at
Sat Apr 3 06:18:58 UTC 2010

If you really want the manual configuration, here are some answers / 
hints to your questons.

Josef Wolf wrote:
> What I want to achieve is to be able to connect to multiple access
>  points via WPA2 and different ESSID's (e.g home, work, wherever). In
>  addition, I'd like the wlan to go down automatically when eth0 goes
>  up and go up again if eth0 goes down.

You can configure your network manually with "/etc/network/interfaces". 
Have a look at "man interfaces" and 
"/usr/share/doc/ifupdown/examples/network-interfaces.gz" for information 
how to do it. You can put scripts in "/etc/network/if-up.d/" and 
"/etc/network/if-down.d/" which switch your wireless on or off depending 
on the state of eth0. Such a script would be something like this:

case $IFACE in
                iwconfig wlan0 txpower off

That was for if-up.d and in if-down.d it would be the same except the 
iwconfig line which would be

                iwconfig wlan0 txpower on

and of course you should replace the "wlan0" with the name of your 
wireless interface. Please note: This isn't tested but derived from 
another script I use on this machine.

> I see that I can set essid/mode/channel/keys vial iwconfig. But I
>  guess I should not do that manually and use wpa_supplicant to do
>  that for me.

Yes, with WPA2 you let wpa_supplicant do the wireless configuration.

> Next problem is that the documentation is not very clear where the
> wpa_supplicant.conf file should be located, and the wpasupplicant
>  package does not contain such a file, so how do I know where to
>  create it?

I think the default location is in "/etc/wpa_supplicant/". Anyway, if 
you use the -c option for wpa_supplicant, your config file may be where 
ever you want it to be.

> Second question is, how do I make sure that only WPA2 is used?

AFAIK, it is in the configuration for the individual network in the 
wpa_supplicant.conf file. If you have the lines


in the network section, it should only use WPA2. But you can verify it 
if you set your AP to WPA / WEP and check if you can still connect to 
the AP.


More information about the ubuntu-users mailing list