[vox-tech] Automatic wifi settings on boot?
Wes Hardaker
wjhns156 at hardakers.net
Wed Feb 4 12:28:44 PST 2009
>>>>> On Wed, 4 Feb 2009 10:56:15 -0800, Bill Kendrick <nbs at sonic.net> said:
BK> Any tips or links to good howtos? (This is on ubuntu 8.10 btw)
What I do is a nasty hack looking through iwlist scan output for
networks I want to use that require keys, etc (see below).
The more modern approach seems to be using NetworkManager after boot and
after login instead, which makes sense for many wireless networks where
you need a browser to log-in before anything is usable. The biggest
problems are when the network comes up, gets and address that isn't
fully usable yet and then things like cups, etc can time-out doing DNS
or something while starting up which really slows the process down.
But here's my /etc/sysconfig/networking/ifcfg-eth1 file (the important parts):
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
USERCTL=yes
#
# if we have wired net, then don't do anything
#
ifconfig eth0 | grep 'UP' > /dev/null
if test $? = 0 ; then
ONBOOT=no
ESSID=bogusbogus
else
# do a bogus search once just to get some boot-strapping and searching
# this seems to help find things better by running it twice.
iwlist scan 2>&1 > /dev/null
# search for known local mac addresses in nearby wireless hubs
# (these are wireless boxes for myself and family with identical setups)
iwlist scan 2>&1 | egrep '(00:11:22:33:44:55|66:77:88:99:AA:BB)' > /dev/null
if test $? = 0 > /dev/null ; then
KEY=xxxxxxxx
ESSID=foobar
else
# I changed this to "no" a while back to deal with the above cups issue
ONBOOT=no
fi
fi
TYPE=Ethernet
Obviously, you could expand on the concept more than the above shows you.
--
"In the bathtub of history the truth is harder to hold than the soap,
and much more difficult to find." -- Terry Pratchett
More information about the vox-tech
mailing list