Router with 2 (or more) interfaces in same network

Leo Bicknell bicknell at ufp.org
Tue Nov 11 17:59:43 UTC 2003


In a message written on Tue, Nov 11, 2003 at 09:38:23AM -0800, Crist Clark wrote:
> You _used_ to be able to do this (oh, over two years ago?). The address
> was assigned to the interface, and the error from trying to add a duplicate
> route was simply ignored, no route got added anywhere. You can figure out
> when the change was made by examining the code or by seeing when the 
> maillists started to get flooded by people who could no longer do,

When the code changed to support multiple IP's on a single interface
it changed the way you configure this in FreeBSD land:

testbox# ifconfig fxp1
fxp1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        ether 00:02:b3:3e:a7:e6
        media: Ethernet autoselect (none)
        status: no carrier
testbox# ifconfig fxp2
fxp2: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        ether 00:02:b3:3e:a5:f1
        media: Ethernet autoselect (none)
        status: no carrier
testbox# ifconfig fxp1 inet 10.10.10.1 netmask 255.255.255.0
testbox# ifconfig fxp2 inet 10.10.10.2 netmask 255.255.255.255
testbox# ifconfig fxp1
fxp1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 10.10.10.1 netmask 0xffffff00 broadcast 10.10.10.255
        inet6 fe80::202:b3ff:fe3e:a7e6%fxp1 prefixlen 64 scopeid 0x2
        ether 00:02:b3:3e:a7:e6
        media: Ethernet autoselect (none)
        status: no carrier
testbox# ifconfig fxp2
fxp2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::202:b3ff:fe3e:a5f1%fxp2 prefixlen 64 scopeid 0x4
        inet 10.10.10.2 netmask 0xffffffff broadcast 10.10.10.2
        ether 00:02:b3:3e:a5:f1
        media: Ethernet autoselect (none)
        status: no carrier

Just like an alias, the second (to nth) IP on a lan must have a
host netmask due to the way the routing code works.

If you plug both of these into a switch and put a host on the other
end, traffic to .1 will go to fxp1, traffic to .2 will go to fxp2.
Traffic leaving the box will use fxp1 only.

At least, it worked this way the last I tested with 4.8, I haven't
tried with the 5.x tree, but the box I did the test above on was a
-current box.

I shouldn't have opened my mouth.  When you admit to knowing how
to make a gross hack work it seems everyone wants to e-mail you
about how it is a gross hack, or about all the picky details of how
it works. :)

-- 
       Leo Bicknell - bicknell at ufp.org - CCIE 3440
        PGP keys at http://www.ufp.org/~bicknell/
Read TMBG List - tmbg-list-request at tmbg.org, www.tmbg.org



More information about the NANOG mailing list