找出哪个networking接口属于docker集装箱
Docker在ifconfig
创build这些虚拟以太网接口veth[UNIQUE ID]
。 我怎样才能找出哪个接口属于一个特定的docker集装箱?
我想听tcpstream量。
定位界面
在我的情况下从容器中获得价值就像(检查eth0
到):
$ docker exec -it my-container cat /sys/class/net/eth1/iflink 123
接着:
$ ip ad | grep 123 123: vethd3234u4@if122: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker_gwbridge state UP group default
用tcpdump -i vethd3234u4
检查
参考http://lxr.free-electrons.com/source/Documentation/ABI/testing/sysfs-class-net的神秘iflink
:
150 What: /sys/class/net/<iface>/iflink 151 Date: April 2005 152 KernelVersion: 2.6.12 153 Contact: netdev@vger.kernel.org 154 Description: 155 Indicates the system-wide interface unique index identifier a 156 the interface is linked to. Format is decimal. This attribute is 157 used to resolve interfaces chaining, linking and stacking. 158 Physical interfaces have the same 'ifindex' and 'iflink' values.