[vox-tech] Automatic wifi settings on boot?

Chanoch (Ken) Bloom kbloom at gmail.com
Wed Feb 4 11:58:11 PST 2009


On Wed, 2009-02-04 at 10:56 -0800, Bill Kendrick wrote:
> Is there an easy way to get a Linux laptop to connect to one of
> a number of wireless networks, based on which ESSID it sees?
> 
> Last time I checked (kernel has upgraded since), my wifi gets kind of
> finicky if it tries to connect to a WAP that isn't there.
> (e.g., if I leave my home WAP, which requires a key, in
> /etc/network/interfaces but then go boot up at Mishka's or Common Grounds,
> it seemed like I needed to alter 'interfaces' and then do a reboot to
> ever get it to work... just running 'sudo /etc/init.d/networking restart'
> didn't seem enough.)
> 
> Once upon a time, I tried providing various interface variations in
> /etc/network/interfaces (e.g., "eth1-home", "eth1-mishkas")
> but either did it wrong, or it didn't work. :)
> 
> Any tips or links to good howtos?  (This is on ubuntu 8.10 btw)

Install wpa_supplicant, set up the networks
in /etc/wpa_supplicant/wpa_supplicant.conf, then set
up /etc/network/interfaces to use wpa_supplicant. This doesn't make it
easy to connect to a new random network at-will (without root
privelages), so you have two tricks:

I have created two pseudo-interfaces "any" and "specified".
      * `ifup wlan0` will use wpa-supplicant to connect to any network
        specified in wpa_supplicant.conf.
      * `ifup wlan0=any` will tell the kernel to connect to the
        strongest open access point that it can see.
      * `iwconfig wlan0 ...; ifup wlan0=specified` (replacing ... with
        whatever options you want for this specific connection) will
        prevent ifup from overriding manual settings that I've specified
        with the wlan0 command
Since your user needs sudo access to ifup and ifdown in this
configuration, you can also install wpa_gui and give your user access to
that for identifying other connections.

None of this is secure as NetworkManager, so you may want to use that
instead, but I've found my method to be more convenient and reliable,
and I have sudo access to anything on my laptop anyway. 

$ cat /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=netdev

eapol_version=1
ap_scan=1
fast_reauth=1

network={
   ssid="kenapt"
   key_mgmt=NONE
   auth_alg=SHARED
   wep_key0=1234567890
   priority=5
}

network={
   ssid="iit"
   key_mgmt=NONE
   priority=5
}


$ 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

iface wlan0 inet dhcp
   wpa-driver wext
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface specified inet dhcp

iface any inet dhcp
   wireless-essid any
   wireless-key open



-- 
Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.lugod.org/pipermail/vox-tech/attachments/20090204/0b2d50ee/attachment.pgp 


More information about the vox-tech mailing list