[Lxc-users] Determine which veth interface belongs to which container

Yury Vidineev adepty at yandex.ru
Mon Jul 1 17:25:14 UTC 2013


Yes, sure, you are right. Looks like I'm a bit sleepy. Thank you!


On Monday, July 01, 2013 11:49:50 AM Serge Hallyn wrote:
> Quoting Yury Vidineev (adepty at yandex.ru):
> > Looks like it isn't correlate. On host:
> Uh, 5 and 6, 14 and 15, ...
> 
> > cat /sys/class/net/veth*/iflink|sort -n
> > 6
> > 15
> > 60
> > 63
> > 65
> > 66
> > 71
> > 75
> > 76
> > 82
> > 85
> > 88
> > 91
> > 
> > In containers:
> > 
> > for i in $(lxc-ls); do ssh $i cat /sys/class/net/eth0/iflink; done|sort -n
> > 5
> > 14
> > 59
> > 62
> > 70
> > 81
> > 84
> > 87
> > 90
> > 
> > On Monday, July 01, 2013 10:26:44 AM Serge Hallyn wrote:
> > > You can probably correlate it using /sys/class/net/$veth/iflink,
> > > which should have consecutive values for link and peer.
> > > 
> > > Quoting Yury Vidineev (adepty at yandex.ru):
> > > > Thank you for the answer! It's almost exactly what I need. But is it
> > > > possible to know name of interfaces without containers restart?
> > > > 
> > > > On Monday, July 01, 2013 02:08:10 PM Claudio Kuenzler wrote:
> > > > > > Hello
> > > > > > Can anyone suggest me a way to determine which veth* interface
> > > > > > belongs
> > > > > > to
> > > > > > which container?
> > > > > 
> > > > > You have the possibility to add the veth interface name into the lxc
> > > > > config:
> > > > > 
> > > > > lxc.network.veth.pair = veth0-$name
> > > > > 
> > > > > 
> > > > > Using this, you'll immediately know to which lxc container the
> > > > > interface
> > > > > belongs.

-- 
Sincerely,
Yury Vidineev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130701/5121ce19/attachment.html>


More information about the lxc-users mailing list