l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2009 Feb 04 12:03

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Automatic wifi settings on boot?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Automatic wifi settings on boot?

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 




$ 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.

Attachment: signature.asc
Description: This is a digitally signed message part

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!