[WHEREAMI] Ifplugd & whereami ?
Andrew McMillan
andrew at catalyst.net.nz
Thu Nov 17 18:56:39 NZDT 2005
On Wed, 2005-11-16 at 20:17 +0100, Joan Tur wrote:
> Hallo!
>
> As I'm running a centrino laptop (with an integrated ipw2200 wifi card), and
> whereami seems not to run after loosing AP signal (for instance after
> switching the kill switch on), I was wondering if both ifplugd & whereami can
> run together.
When ifplugd was first released there was some support for them both to
be used, but I haven't looked at that for a long time...
OK, so I installed it now and it looks to me like there would need to be
a small shell script in /etc/ifplugd/action.d which was something like:
/etc/ifplug/action.d/whereami
===================================================
#!/bin/sh
# Quit if we're called for the loopback
[ "$1" = lo ] && exit 0
# Just exit if whereami is no longer installed
test ! -e /usr/sbin/whereami && exit 1
# Can't use --syslog because syslog starts after the network
/usr/sbin/whereami --syslog --run_from ifplugd --hint "${1}-${2}"
exit 0
===================================================
If that works then I'll add it to the standard distribution.
> If so, how can I have an static IP with 1 AP and dhcp with the others?
Typically with stuff like this in your detect.conf:
===============================================
...
testdhcp '*.*.*.*' dhcp
testarp 01:23:45:67:89:ab,192.168.0.4 green
...
if dhcp
testdhcp 192.168.37.12 pink
testdhcp 192.168.15.* blue
...
===============================================
The first testdhcp just sees if you get any DHCP address, but don't try
and classify what one you might have. If it fails the testarp or
testping will be tested (but not if it succeeds).
The later we test for the more specific 'which DHCP network did we get'.
Note that this uses the cached results from the first test - it doesn't
do the DHCP requesting again.
If you're doing this sort of thing it's also useful to set the DHCP
timeout down a bit, otherwise the process can be quite slow to fail and
go to the next test.
> Or maybe there's another way of doing the work?
>
> Right now I've got whereami to supply the 128b wep key to my AP (it doesn't
> support wpa), then give it the connection details (IP & gateway), but if I go
> away of the AP or switch the kill switch on the "-" stanzas are not run.
>
> 1. Detect.conf:
> default wlan
It seems dodgy to default to wlan - I would normally default to some
non-connected state.
> testmii eth0 lan
> if lan
> set INTERFACE eth0
> testdhcp '*.*.*.*' dhcp
> else
> set INTERFACE eth1
> testap scan wlan
> fi
> if wlan
> testssid QAP,00000000000000000000000000 qap
> fi
>
> 2. Whereami.conf:
> =qap ifconfig eth1 192.168.0.4 ; route add default gw 192.168.0.100
> -qap iwconfig eth1 essid any key off
> -qap ifdown eth1 || ifconfig eth1 down
>
>
> TIA, good job ;)
>
> PD I was using waproamd, then wpasupplicant, but whereami seems promising to
> me
> PD2 I'm using Ubuntu 5.10
Well I'm using 5.10 on this laptop too, at the moment (with Debian
Unstable on my other laptop) so I've found a few changes / tweaks for
Ubuntu as well that will make it into the next-ish version.
Because Whereami only really has dependencies on perl / bash it's
usually OK to install newer versions into Breezy, Dapper or Etch just
fine.
Cheers,
Andrew.
-------------------------------------------------------------------------
Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267
There is a 20% chance of tomorrow.
-------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.catalyst.net.nz/pipermail/whereami-discuss/attachments/20051117/abc3fa57/attachment.pgp
More information about the whereami-discuss
mailing list