[systemd-devel] systemd-nspawn network interface name collisions

Lennart Poettering lennart at poettering.net
Thu Jun 18 09:42:32 PDT 2015


On Thu, 18.06.15 18:27, Florian Koch (florian.koch1981 at gmail.com) wrote:

> Hi,
> 
> if i understnd this correct, the network interface names (veth and
> macvlan) are created with the frist 11 Caracters from the
> Containername (Machinename).

IFNAMSIZ emposed by the Linux kernel is 16, and we need three chars
for the prefix "ve-" and one for the trailing NUL byte. makes 12 chars.

> 
> Now if you use similar names for conatiners, like
> 
> com.$company.$devision.$name1
> com.$company.$devision.$name2
> com.$company.$devision.$name3
> 
> the network device name handling is broken.
> 
> I tryed to prefix the machinename with a uuid (uuidgen) but the the
> names are to long.
> 
> Why not using a 11 Caracter uuid / random  for network interface
> names, and avoid all the naming trouble?

Well, because we want to keep things easy to grok for users. If you
type "ip link" and see the container names for the veth links, then
that's certainly a lot more useful than seeing some random
gibberish....

I'd be willing to make this configurable:

    --network-veth                → as it is now, host is called
                                    ve-<container-name> and container
                                    side is called host0

    --network-veth=foo            → creates a veth link with both
                                    sides named "foo"

    --network-veth=foo:bar        → host side called "foo", container
                                    side called "bar".

At the same time we should open this up so that multiple links can be
created, not just one.

Happy to take a patch for that!

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list