ifconfig, vnets and interface names

Bjoern A. Zeeb bzeeb-lists at lists.zabbadoz.net
Sun Oct 17 16:20:09 UTC 2010


On Sun, 17 Oct 2010, Nikolay Denev wrote:

> Hello,
>
> While playing with vnet jails I've discovered the following oddity, which probably is not what's expected to happen :
>
...
> And that's what ifconfig shows after this :
>
>    [16:52]root at nas:/home/ndenev# ifconfig
>    <... snip lo0 and physical interface ...>
>    epair0a: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	    ether 02:8c:53:00:03:0a
>    epair1a: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	   ether 02:b6:49:00:05:0a
>    eth0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	    ether 02:8c:53:00:04:0b
> 	    ether 02:b6:49:00:06:0b
>
> Instead of two interfaces, I'm seeing one with to lladdrs, because of the interface names being the same.
>
> Then I'm trying to destroy them :
>
>    [16:52]root at nas:/home/ndenev# ifconfig eth0 destroy
>    [16:53]root at nas:/home/ndenev# ifconfig
>    <... snip lo0 and physical interface ...>
>    epair1a: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	    ether 02:b6:49:00:05:0a
>    eth0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> 	    ether 02:b6:49:00:06:0b
>    [16:53]root at nas:/home/ndenev# ifconfig eth0 destroy
>
>
> So in this case there may be not a clean way to address one of the interfaces specifically (i.e. destroy only the second one)?
>
> I've not investigated further, but I'm thinking probably this is just a "bug" in ifconfig interpreting/parsing the information from the kernel.
> Maybe a solution is to extend ifconfig to be able print the interface list along with the ifIndex values and also manage the interfaces by index?
> Auto renaming also is also probably a possible solution (i.e. eth0_1 , eth0_2 ) as these are interfaces coming from destroyed vnet's and are not likely to be in use. (but still sounds scary :) )

It's actually a bug in sys/net/if.c:if_vmove* we know about and that's
on the todo list.

I am not sure when the behaviour of ifconfig changed as previousy it
would only show you one of the two interfaces with the single ether
address.  ifconfig -l however had shown eth0 twice.  Neither is really
what one would expect thus needs changing.

/bz

PS: freebsd-virtualization@ is the best list to report "VIMAGE" or
"vnet" related problems.

-- 
Bjoern A. Zeeb                              Welcome a new stage of life.


More information about the freebsd-stable mailing list