Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Sep 2002 09:54:26 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Chris Kulish <lists@tekengine.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: wireless nic+wired nic+same subnet
Message-ID:  <20020905085426.GA31635@happy-idiot-talk.infracaninophi>
In-Reply-To: <010201c25489$3a4f6650$0101010a@superbeast>
References:  <010201c25489$3a4f6650$0101010a@superbeast>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 04, 2002 at 10:06:28PM -0500, Chris Kulish wrote:

> I have a wireless pc card and a wired ethernet card in the same laptop,
> each with its own ip, but on the same subnet.  Currently, I have to
> disable one in rc.conf and reboot to get connectivity with the other.
> Is there any way to set this up, so that if the wired nic isn't plugged
> into the network and the wireless is, it will use the wireless, and vice
> versa?

As you've no doubt managed to convince yourself by now, it's not
kosher to have two network interfaces on the same subnet.  What you
want is essentially to have a redundant pair of network interfaces and
to automatically failover from one to the other.  The keyword there is
"VRRP" -- virtual redundant router protocol (RFC2338).  Unfortunately,
although there is a net/vrrp port, it's marked broken and the parent
website http://www.vrrp.net/ seems to have gone the way of all flesh.

The next best thing I can think of is the netgraph ng_one2many(4)
implementation, which essentially takes two or more physical network
interfaces and makes them into one big virtual NIC.  This looks
promising, but there is no automatic mechanism for discovering if one
or other of the interfaces has lost connectivity --- you can use
ngctl(8) to send a message to the node telling it to enable one NIC
and disable the other.

However, this is all probably way too complicated for your needs.  You
can switch between two NIC without rebooting by judicious use of the
ifconfig(8) command.  Suppose your wireless NIC is wi0 and your
standard NIC is de0, and they distinct addresses on the 192.168.0.0/24
network.

Thus on bootup, set up the wired NIC:

    ifconfig de0 inet 192.168.0.1 netmask 255.255.255.0 up

(which can be done through the usual /etc/rc.conf settings)

Then to switch to wi0:

   ifconfig de0 down
   ifconfig wi0 inet 192.168.0.2 netmask 255.255.255.0 up

(and vice versa to switch back).  This can be scripted quite readily,
but it isn't particularly bulletproof and will quite probably get
snarled up at the least excuse...

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
                                                      Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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