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

2018-04-10 Thread Matthias Pfau
Apr 5, 2018, 1:14 PM by matth...@tutanota.de:

> 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.
>
Attaching and naming macvlan/ipvlan interfaces to a container is currently not 
possible. However, I was able to add multiple  devices to my containers and 
rename them directly in /etc/network/interfaces, e.g.

auto int
iface int inet static
    address 192.168.1.165
    netmask 255.255.255.0
    pre-up if [ -e /sys/class/net/host0 ] ; then ip link set host0 name int ;fi


Cheers,
Matthias
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2018-04-05 Thread Matthias Pfau
Apr 4, 2018, 4:48 PM by lenn...@poettering.net:

> On Mi, 04.04.18 09:05, Mantas Mikulėnas (> graw...@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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2018-04-04 Thread Lennart Poettering
On Mi, 04.04.18 09:05, Mantas Mikulėnas (graw...@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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2018-04-03 Thread Matthias Pfau
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?

Thanks!

Cheers,Matthias Pfau
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel