Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2007 10:12:35 +0200
From:      Matthias Apitz <m.apitz@oclcpica.org>
To:        "Heiko Wundram (Beenic)" <wundram@beenic.net>
Cc:        C Thala <cthala@gmail.com>, freebsd-questions@freebsd.org
Subject:   Re: switching between WAPs
Message-ID:  <20070920081235.GA1797@rebelion.Sisis.de>
In-Reply-To: <200709200843.58410.wundram@beenic.net>
References:  <77647f500709191947k2fc9098aq12f068a91cf6941@mail.gmail.com> <200709200843.58410.wundram@beenic.net>

next in thread | previous in thread | raw e-mail | index | archive | help
El día Thursday, September 20, 2007 a las 08:43:57AM +0200, Heiko Wundram (Beenic) escribió:

> Am Donnerstag 20 September 2007 04:47:03 schrieb C Thala:
> > That OS from the NorthWestern US seems to keep a list of WAPs and will
> > detect whenever you are in the vicinity of one and use the available
> > one. How can I get FreeBSD to do the same?
> 
> Try setting up a wpa_supplicant configuration (and putting "WPA DHCP" in 
> rc.conf); that does the proximity-switching for you (and does so for me, 
> happily).
> 
> I don't really know whether wpa_supplicant works with non-security-enabled 
> (i.e. non-WEP and non-WPA) wireless networks, but I guess there's a switch to 
> tell it to do so.

I have some 10 diffrent AP in my file /etc/wpa_supplicant.conf
because I'm traveling often to diffrent locations of our company,
WPA-PSK and WEP, for example:


# Coimbra
#
network={
        ssid="xxxxxxxxxxxxx"
        key_mgmt=WPA-PSK
        psk="xxxxxxxxxxxxx"
}

# Westeregeln
#
network={
        ssid="xxxxxxxxxxxxx"
        scan_ssid=0
        key_mgmt=NONE
        wep_tx_keyidx=0
        wep_key0=xxxxxxxxxxxxx
}

in /etc/rc.conf I only have

ifconfig_iwi0="WPA"

but in addition I'm using the daemon devd(8) to set the IP stuff
of iwi0 accordingly to the network I'm associating; you need two
files for this:

/usr/local/etc/devd/iwi.conf

notify 1 {
        match "system"          "IFNET";
        match "subsystem"       "iwi0";
        match "type"            "LINK_UP";
        action "/usr/local/etc/devd/iwi.sh $subsystem $type";
};
notify 1 {
        match "system"          "IFNET";
        match "subsystem"       "iwi0";
        match "type"            "LINK_DOWN";
        action "/usr/local/etc/devd/iwi.sh $subsystem $type";
};

and the work is done in the sheel script /usr/local/etc/devd/iwi.sh
like for example:

#!/bin/sh
#
echo `date`: $0 $* >> /tmp/devd.out

case $2 in
    'LINK_DOWN')
        exit 0 ;
        ;;
esac

ap=`/sbin/ifconfig iwi0 list sta | awk '{print $1;}' | fgrep -v ADDR`

case ${ap} in

    '00:04:e2:a1:76:0b')
        printf "ap [%s] seems to be the Oberhaching office\n" "${ap}" >> /tmp/devd.out ;
        #
        ifconfig bge0 222.222.222.2 netmask 255.255.255.0
        ifconfig bge0 down
        dhclient iwi0
        #
        # drop and reload the firewall rules
        ipf -D
        ipf -E
        ipmon -Ds
        ipf -Fa -f /etc/ipf.rules.sisis
        ipnat -CF -f /etc/ipnat.rules.sisis
        ;;
...
    *)
        printf "ap [%s] not known in %s\n" "${ap}" $0 >> /tmp/devd.out ;
        ;;
esac

exit 0

this means when you get associated to an AP and LINK comes UP, the
devd(8) wakes up and runs the sheel script doing all the right work;
works really nice;

	matthias
-- 
Matthias Apitz
Manager Technical Support - OCLC PICA GmbH
Gruenwalder Weg 28g - 82041 Oberhaching - Germany
t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211
e <m.apitz@oclcpica.org> - w http://www.oclcpica.org/ http://www.UnixArea.de/
b http://gurucubano.blogspot.com/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070920081235.GA1797>