[systemd-devel] nspawn: how to rename network interfaces?

Matthias Pfau matthias at tutanota.de
Thu Apr 5 11:14:32 UTC 2018


Apr 4, 2018, 4:48 PM by lennart at poettering.net:

> On Mi, 04.04.18 09:05, Mantas Mikulėnas (> grawity at gmail.com <mailto:grawity at gmail.com>> ) wrote:
>
>> > >> Hi there,
>> > >>  I just tried to rename ipvlan and macvlan devices in a container with
>> > systemd.link. This does not seem to work with debian stretch (host and
>> > container).
>> > >>
>> > >>  Is it possible to rename ipvlan and macvlan devices in a container? If
>> > not: Is there another way to define custom interface names?
>> > >>
>> > >
>> > > Containers usually don't have udev (which processes .link files). Manual
>> > renaming should work.
>> > >
>> > Manual renaming via the ip command works indeed.
>> > However, the udev package is installed in the container and udevadm is
>> > usable. Is there anything else that is needed to enable systemd's .link
>> > files?
>>
>> Hmm, I'm probably mistaken.
>>
>
> No, you are right. udev is not supported in containers, as /sys is not
> virtualized on Linux, and running udev inside contains and on the host
> would mean the instances would fight for ownership of the devices.
>
> So yes, Mantas was right: .link files only work on the host, not in
> any container. Make sure to just name the interfaces properly when
> passing them to the container in the first place.
>
> Lennart
>
Thanks for confirming!

How can I define ipvlan interface names for the container? E.g. I need multiple ipvlan interfaces on the host that are mapped to the interface name "dmz" in multiple containers.

As far as I understood the man page, defining names for interfaces in the container is only possible with --network-veth-extra. Is that correct?

--
Matthias Pfau


More information about the systemd-devel mailing list