[TriLUG] Wireless Roaming in Ubuntu

Josh Vickery vickeryj at gmail.com
Wed Jul 20 10:33:08 EDT 2005


You might want to take a look at:

http://hostap.epitest.fi/wpa_supplicant/

which has replaced waproamd.  Its a daemon that your configure once
with all the different APs you want to connect to.  Once configured,
it scans for APs, and loads the appropriate configuration (WEP key,
WPA, IP address, etc.).  Unless I am mistaken, it can be configured to
fall back to using "any" AP if it can't find one for which it is
configured.

Josh

On 7/19/05, Alan Porter <porter at trilug.org> wrote:
> > The bottom half of this link, in the "notes" section, may also give
> > you an alternative way to script your changes between networks.  It
> > doesn't help the automatic switching though.
> 
> 
> Since we're talking about it, I rigged up a simple perl script
> that allows me to switch networks very quickly from a command
> line.
> 
> Basically, I do something like this:
> 
>    root at laptop:/home/alan# wlan home
>    setting new WLAN to 'home'
> 
>    root at laptop:/home/alan# ifup wlan0
>    running iwconfig using 'home' parameters
>    Listening on LPF/wlan0/00:18:3c:29:c1:29
>    Sending on   LPF/wlan0/00:18:3c:29:c1:29
>    Sending on   Socket/fallback
>    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
>    DHCPOFFER from 10.1.1.1
>    DHCPREQUEST on wlan0 to 255.255.255.255 port 67
>    DHCPACK from 10.1.1.1
>    bound to 10.1.1.109 -- renewal in 18776 seconds.
> 
>    root at laptop:/home/alan# wlan open
>    setting new WLAN to 'open'
> 
>    root at laptop:/home/alan# ifdown wlan0
>    Listening on LPF/wlan0/00:18:3c:29:c1:29
>    Sending on   LPF/wlan0/00:18:3c:29:c1:29
>    Sending on   Socket/fallback
>    DHCPRELEASE on wlan0 to 10.1.1.1 port 67
> 
>    root at laptop:/home/alan# ifup wlan0
>    running iwconfig using 'open' parameters
>    Listening on LPF/wlan0/00:18:3c:29:c1:29
>    Sending on   LPF/wlan0/00:18:3c:29:c1:29
>    Sending on   Socket/fallback
>    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
>    DHCPOFFER from 192.168.0.1
>    DHCPREQUEST on wlan0 to 255.255.255.255 port 67
>    DHCPACK from 192.168.0.1
>    bound to 192.168.0.102 -- renewal in 262799 seconds.
> 
>    root at laptop:/home/alan# ifdown wlan0
>    Listening on LPF/wlan0/00:18:3c:29:c1:29
>    Sending on   LPF/wlan0/00:18:3c:29:c1:29
>    Sending on   Socket/fallback
>    DHCPRELEASE on wlan0 to 192.168.0.1 port 67
> 
>    root at laptop:/home/alan# wlan home
>    setting new WLAN to 'home'
> 
>    root at laptop:/home/alan#
> 
> The script has three parts:
>  (1) the /usr/local/sbin/wlan script
>  (2) the list of wlan parms in /etc/network/wlan.parms
>  (3) an 'pre-up' trigger in /etc/network/interfaces
> 
> I do most of my work on the command line, and I have found this
> to work quickly without me having to remember SSID's etc.  I hope
> y'all find this useful.
> 
> Alan
> 
> 
> 
> 
> 
> ################################################################################
> /usr/local/sbin/wlan
> ################################################################################
> 
> #!/usr/bin/perl
> 
> $parmfile="/etc/network/wlan.parms";
> $currentfile="/etc/wlan";
> 
> # Globals
> use vars qw/ %opt /;
> 
> use Getopt::Std;
> my $opt_string = 'hi:';
> getopts( "$opt_string", \%opt ) or usage();
> usage() if $opt{h};
> 
> if ($opt{i}) {
>    $interface=$opt{i};
>    $wlan_name=`head -1 $currentfile`;
>    chop($wlan_name);
>    $iwconfig_args=`grep "$wlan_name *:" $parmfile`;
>    $iwconfig_args=~s/$wlan_name *: *//g;
>    print "running iwconfig using '$wlan_name' parameters\n";
>    system("iwconfig $interface $iwconfig_args");
> } else {
>    $wlan_name=$ARGV[0];
>    usage() if (length($wlan_name)<=0);
>    if (`grep -c "$wlan_name *:" $parmfile` > 0) {
>       open(ETC,">$currentfile");
>       print ETC "$wlan_name\n";
>       close(ETC);
>       print "setting new WLAN to '$wlan_name'\n";
>    } else {
>       print "'$wlan_name' is not in $parmfile\n";
>    }
> }
> 
> exit 0;
> 
> sub usage {
>    print "$ARG[0] <name>          - switch to using lan named <name>\n";
>    print "$ARG[0] -i <interface>  - configure <interface> using iwconfig\n";
>    exit 0;
> }
> 
> 
> ################################################################################
> /etc/network/wlan.parms
> ################################################################################
> 
> open: essid any mode managed key open
> adhoc: essid any mode ad-hoc key open
> home: essid HomeNet mode managed key restricted ABCDEF0123
> work: essid WorkNet mode managed key restricted 12345678901234567890123456
> ncsu: essid ncsu mode managed key open
> trilug: essid any mode managed key open
> 
> ################################################################################
> /etc/network/interfaces
> ################################################################################
> 
> auto lo
> iface lo inet loopback
> 
> auto eth0
> iface eth0 inet dhcp
> 
> #auto wlan0
> iface wlan0 inet dhcp
>  pre-up modprobe ndiswrapper
>  pre-up /usr/local/sbin/wlan -i wlan0
>  post-down rmmod ndiswrapper
> 
> ################################################################################
> 
> 
> 
> 
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
>



More information about the TriLUG mailing list