IP address assignment over two interfaces

Adam Smith adam at internode.com.au
Tue Oct 12 18:45:45 PDT 2004


I have two network interfaces in my laptop, rl0 and an0.  rl0 is my onboard
Ethernet adapter and an0 is a Cisco wireless PCMCIA card.

When I'm at home, there are often times in which I may wish to switch from
wireless to wired for performance reasons when transferring files over my
LAN.  Unfortunately the process to do this, as far as I know, is rather

My wireless network is configured with a WEP key and a passphrase.  As a
result I have attempted to simplify my life by creating a script that I
execute when my system boots.  It checks to see if my hard-wired ethernet
has an IP address, and if not, it grabs one via the wireless card (and sets
up the WEP key etc):

[adam at myhost /home/adam]$ cat /usr/local/bin/wireless 

# Check to see if we have an Ethernet address on the physical port

if ifconfig rl0 | grep
    killall dhclient
    ifconfig an0 wepmode on wepkey mywepkey ssid myssid
    dhclient an0
    mount /data

It kills dhclient, because I can't run two instances of it at once.

This works rather well at the moment, however if I want to switch back from
wireless to wired, I have to kill dhclient, config my wireless with
'ifconfig an0' and then re-run 'dhclient rl0'.  That's really

What I'd like to accomplish is to be able to switch between these two cards
automatically.  Preferably, I'd like to use wireless as a 'backup' to
wired, so that if I am hardwired in, wireless just shouldn't bother trying
to obtain an IP address.  If I unplug my Ethernet connection, wireless
should sync up and take over operations.

I was inspired by OS/X's sweetness.  It does exactly that; switches between
the two interfaces magically.  I want some of that sweet stuff.

Any idea if the FreeBSD OS itself has any underlying capability for this
kind of thing (some sort of Interface watching daemon?)  Also, if I
configured DHCP to assign the same IP address to both my wireless and wired
interfaces, that would possibly mean that any TCP sessions that I have open
will stay open, which is really, really cool.

Thanks for listening! :)

Adam Smith
Internode	: http://www.internode.on.net
Phone		: (08) 8228 2999

Dog for sale: Eats lots and is fond of children.

More information about the freebsd-questions mailing list