Wireless/Wired LAN autoswitch
[LoN]Kamikaze
LoN_Kamikaze at gmx.de
Sat Mar 25 09:24:38 UTC 2006
Dhclient dies when its interface is turned down. You don't have to use
killall. However even if an interface is down it will still confuse
routing when it has a valid IP. Thus I advice you the following if you
unplug:
# ifconfig interface0 0.0.0.0 down
# route flush
# route add default -interface interface1
You have to replace inteface0 and 1 with whatever suits your system.
Derrick Ryalls wrote:
> Greetings mobile subscribers,
>
> I have been playing around with trying to get wireless/wired switching
> working on my 6.1 PRERELEASE laptop, but haven't had much luck. I can
> control the wired connection via ifconfig and the wireless via
> wpa_supplicant, but I am having a difficult time getting the routing
> adjusted when I plug/unlpug the network cable.
>
> I am new to wireless in FreeBSD and don't have a lot of experience with
> using ifconfig/route in general, so maybe I am doing something brain dead.
> I tried the following workflow:
>
> killall dhcp
> route flush
> (exec start wpa_supplicant script)
> route add 192.168.2.1 (for wireless)
>
>
> But that doesn't seem to work. I have had the best luck when I do ifconfig
> bfe0 down to force not using the wired connection. I have also tried
> putting the script in /etc/devd.conf but I it didn't work as I expected, so
> I doubt I had that configured correctly.
>
> I guess my question comes in 2 parts. a) Besides using cron and scraping
> ifconfig, how do I detect the plug/unplug events and b) how do I reliable
> change the routing table to point to the correct gateway?
>
> Thanks for any pointers.
More information about the freebsd-mobile
mailing list