标签:dex docke ref 命令 ica com 通过 def github
可以通过iflink 找到对应关系。
ip link
$ ip link
......
13: veth56ecf40@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue mast
er docker0 state UP mode DEFAULT group default
link/ether 56:17:10:68:88:b1 brd ff:ff:ff:ff:ff:ff link-netnsid 4
15: veth0f80cbf@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue mast
er docker0 state UP mode DEFAULT group default
link/ether fa:e6:8f:3b:01:54 brd ff:ff:ff:ff:ff:ff link-netnsid 5
root@336043b07211:/# docker exec -it nginx-1 bash
root@336043b07211:/# cat /sys/class/net/eth0/iflink
13
root@336043b07211:/# docker exec -it nginx-2 bash
root@336043b07211:/# cat /sys/class/net/eth0/iflink
15
这样就可以确定:
nginx-1
这个容器在物理机上对应的veth pair是veth56ecf40@if12
;
nginx-2
这个容器在物理机上对应的veth pair是veth0f80cbf@if14
。
ethtool -S eth0
eth0为容器中的网卡的名字
root@336043b07211:/# ethtool -S eth0
NIC statistics:
peer_ifindex: 13
然后在宿主机上执行: ip link show
$ ip link show
...
13: veth56ecf40@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP mode DEFAULT group default
link/ether 56:17:10:68:88:b1 brd ff:ff:ff:ff:ff:ff link-netnsid 4
15: veth0f80cbf@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP mode DEFAULT group default
link/ether fa:e6:8f:3b:01:54 brd ff:ff:ff:ff:ff:ff link-netnsid 5
网络知识---如何查看docker veth pair与宿主机上网卡的对应关系
标签:dex docke ref 命令 ica com 通过 def github
原文地址:https://www.cnblogs.com/double12gzh/p/13347866.html