[lxc-users] Setting lxc.network.veth.pair

Fajar A. Nugraha list at fajar.net
Mon Aug 31 05:18:10 UTC 2015


On Mon, Aug 31, 2015 at 5:10 AM, Michael H. Warfield <mhw at wittsend.com>
wrote:

> On Sun, 2015-08-30 at 13:51 -0700, Peter Steele wrote:
> > I want to pick my own naming convention for the veth interfaces
> > created
> > by LXC rather than using the auto-generated names. I tried adding the
> > entry
>
> > lxc.network.veth.pair = veth0
>
> > in one of my privileged containers but it still get a random name of
> > 'veth6HIE0A' instead of eth0. Am I mistaken as to how this is
> > supposed
>

It should work in PRIVILEGED container. I use this setting a lot. An
example:

# Network configuration
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:22:c3:d5
lxc.network.veth.pair = veth-s12-0

In the past, the devices needs to start with "veth" so it would be ignored
by network-manager. However, looking at
http://bazaar.launchpad.net/~network-manager/network-manager/ubuntu/view/head:/debian/patches/0005-Mark-virtual-ethernet-interfaces-as-unmanaged.patch
NM seems to use /sys/devices/virtual/net/ , so the requirement might not
exists anymore (I haven't tested it recently though)

> to work. Ideally I would like to see something like
> > 'veth0-<container-name>' but 'vethN' when N either is assigned
> > automatically when containers are started or alternatively where I
> > set N
> > myself in the container's config. What's possible and what's not?
>
>
Privileged -> set in config
Unprivileged -> currently no way to set interface name on host side



> I played with this a while back and found that you are severely limited
> for the name length.


The limit (tested with "ip link add" and "ip link set dev ... name") is now
15 chars, although the kernel defines "#define IFNAMSIZ 16"

-- 
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20150831/b14cbafd/attachment.html>


More information about the lxc-users mailing list