Possible bug in ifconfig regarding ip addresses and fibs

Alan Somers asomers at freebsd.org
Fri Jun 16 16:12:41 UTC 2017


On Fri, Jun 16, 2017 at 10:00 AM, Steven Crangle
<Steven at stream-technologies.com> wrote:
>
> Hi,
>
>
> I've been configuring a device with the following rc.conf lines:
>
>
> ifconfig_le6_name="manee"
> ifconfig_manee="fib 5 up"
> ifconfig_manee_alias0="inet 185.100.174.221 netmask 255.255.255.0"
> ifconfig_manee_alias1="inet 172.31.4.216 netmask 255.255.255.128"
> ifconfig_manee_alias2="inet 192.168.124.216 netmask 255.255.255.128"
>
> The result I would have expected is as follows:
>
>
> manee: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
>     options=8<VLAN_MTU>
>     ether 08:00:27:d3:83:da
>     inet 185.100.174.221 netmask 0xffffff00 broadcast 185.100.174.255
>     inet 172.31.4.216 netmask 0xffffffc0 broadcast 172.31.4.255
>     inet 192.168.124.216 netmask 0xffffff80 broadcast 192.168.124.255
>     nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
>     media: Ethernet autoselect
>     status: active
>     fib: 5
>
>
> Instead I get the following on boot of the box:
>
>
> manee: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
>     options=8<VLAN_MTU>
>     ether 08:00:27:d3:83:da
>     inet 185.100.174.221 netmask 0xffffff00 broadcast 185.100.174.255
>     inet 172.31.4.216 netmask 0xffffffc0 broadcast 172.31.4.255
>     nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
>     media: Ethernet autoselect
>     status: active
>     fib: 5
>
>
> I then tried to run the following command:
>
> ifconfig manee alias 185.100.174.221 netmask 255.255.255.0
> ifconfig manee alias 172.31.4.216 netmask 255.255.255.128
> ifconfig manee alias 192.168.124.216 netmask 255.255.255.128
>
> Which resulted in the following output:
>
>
> ifconfig: ioctl (SIOCAIFADDR): File exists
>
> After this I tried:
>
> ifconfig manee -alias
>
> Which seemed to wipe all addresses fro mthe device as expected.
>
>
> I then started again using ifconfig lines to assign the aliases to the device, they all succeed apart from when I get to the 192.168.124.216 one. Which again outputs the following:
>
>
> ifconfig: ioctl (SIOCAIFADDR): File exists
>
> Even though running ifconfig only shows the first two addresses configured.
>
>
> Note: I also have a mgmt interface on fib 0 configured with the ip : 192.168.124.250
>
> From investigation it seems to somehow be clashing with this, as I am able to add a 3rd alias with the following line:
>
>
> ifconfig manee alias 192.168.125.216 netmask 255.255.255.128
>
> Is it not possible to have two IP Addresses on the same range, but different addresses on seperate fibs?
>
> Thanks for any help!
>
> Steven

There is some subtlety with using multiple fibs.  Your problem is that
you naturally assumed that by assigning fib 5 to the manee interface,
that fib would also be used for all of its addresses.  However, that's
not the way it works.  The interface fib actually isn't very
important.  It's only used for packet forwarding.  The fib of an
interface address is more important, and each address can have a
different fib, even when they share an interface.  In order to set the
interface address fibs, do this:

ifconfig_manee_alias0="inet 185.100.174.221 netmask 255.255.255.0 fib 5"
ifconfig_manee_alias1="inet 172.31.4.216 netmask 255.255.255.128 fib 5"
ifconfig_manee_alias2="inet 192.168.124.216 netmask 255.255.255.128 fib 5"

You can't assign the same address to multiple interfaces with the same FIB.

-Alan


More information about the freebsd-net mailing list