1

I'm having hard time reading the output of ip a command.
Normally it prints something like this:

3: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
    link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff

Which is fine.

But inside the LXC container (not always) I can see something like that:

11: eth0@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.10.44.44/16 brd 10.10.255.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::24cb:a3ff:fefe:72cc/64 scope link
       valid_lft forever preferred_lft forever
13: eth1@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.29/24 brd 192.168.1.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::b471:7eff:fea7:a8bc/64 scope link
       valid_lft forever preferred_lft forever

What is this @if1[2,4]?
Moreover ifconfig always prints eth[0,1]

1

1 Answer 1

3

You have interfaces that are part of separate macvlans.

The output of ip listed above indicates that your host has two interfaces configured such that each interface, eth0@if12 and eth1@if14 are each a member of a separate macvlans configured in bridge mode (one physical interface to multiple virtual network interfaces that each have a separate MAC address).

I believe the notation is <interfaceNickname>@<macvlanID>.

As far as why the interfaces are not always formatted as such I can see at least two possible reasons.

  1. The interface is not a part of a macvlan.
  2. The host does not have at least two interfaces that are on different macvlans.

So if your container host has one macvlaned interface, it would not display the macvlanid just the interface nickname. But if your host had two interfaces that were on different macvlans, then at least one of the interfaces would be tagged with the <nic>@<macvlan> format.

For a great explanation of LXC networking that dives into macvlan configuration check out this well written article (about a third of the way down, in the section entitled 'Macvlan', the author dives into your particular configuration).

1
  • there is no way to know if it's macvlan. it can also (probably) be veth or a few other types. Only ip -details link can tell. The notation is <interface>@<peerinterface>. If the peer interface can't be identified, then its index is shown (12 and 14) like here, because those are indexes from an other namespace , as is telling link-netnsid 0 at the end. On this peer namespace, there are two related interfaces starting with 12: and 14:.If the peer interface can be identified, its name would appear (but sometimes ip's output can even confuse between the other namespace and the local) Commented May 6, 2018 at 18:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.