dizzysaurus n00b
Joined: 31 Jul 2003 Posts: 38 Location: MI, US
|
Posted: Wed Sep 17, 2003 4:58 pm Post subject: Here is a script to switch between wireless networks |
|
|
Here's a quick and dirty script to switch your laptop between wireless networks
- useful if you roam around a lot:
Code: |
#!/bin/bash
# wireless config tool
# give it an argument and it'll set your wireless network accordingly
# add another switch block to add more networks
# totally hacked together, I know - it only works with dhcpcd
iwtool=/usr/sbin/iwconfig
dhcptool=/sbin/dhcpcd
case "$1" in
home)
# set the network up for home
$iwtool eth1 essid HOMEESSID
# if you use a non-ascii key, remove the s:
$iwtool eth1 key s:HOMEKEY
$dhcptool eth1
;;
work)
# set the network up for work + roving
$iwtool eth1 essid WORKESSID
$iwtool eth1 key s:WORKKEY
$dhcptool eth1
;;
any)
# any open networks
$iwtool eth1 essid any
$iwtool eth1 key open
$dhcptool eth1
;;
*)
# got the command line wrong, foo
echo "Usage: wireless-config {home|work|any}"
echo "Edit the script to add more networks"
exit 1
esac
|
Obviously you'll need to change the eth1 to match your card, but maybe this
script will help someone out
It would be nice if there was a daemon to do this automatically, but that is
beyond my skill to produce. |
|