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

Lennart Poettering lennart at poettering.net
Wed Apr 4 14:48:01 UTC 2018


On Mi, 04.04.18 09:05, Mantas Mikulėnas (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

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list