Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Oct 2004 11:07:05 +0930
From:      Adam Smith <adam@internode.com.au>
To:        freebsd-questions@freebsd.org
Subject:   IP address assignment over two interfaces
Message-ID:  <20041013013704.GE752@internode.com.au>
Resent-Message-ID: <20041013014540.GG752@internode.com.au>

next in thread | raw e-mail | index | archive | help
Hi,

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
awful.

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@myhost /home/adam]$ cat /usr/local/bin/wireless 
#!/bin/sh

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

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

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 0.0.0.0' and then re-run 'dhclient rl0'.  That's really
annoying.

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.



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