veth pair: How to know what interfaces are connected by a veth pair?
Here is a quick one. Couldn't find a direct solution on Google.
You can find out what's the peer of a interface by issuing the command:
[[email protected] ~]# sudo ethtool -S int-br-ex
NIC statistics:
peer_ifindex: 55
[[email protected] ~]# ip link | grep 55:
link/ether c6:5f:55:82:20:72 brd ff:ff:ff:ff:ff:ff
55: phy-br-ex: mtu 1500 qdisc pfifo_fast state UP qlen 1000
[[email protected] ~]#
So, you can easily find out that int-br-ex and phy-br-ex are peer to each other, that means they are connected via veth pair. To find out what all veth pairs are present in your system:
[[email protected] ~]# ip -d link show
.... output omitted ...
55: phy-br-ex: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:92:8e:3f:6e:f8 brd ff:ff:ff:ff:ff:ff
veth
56: int-br-ex: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether d6:3b:77:c0:70:4f brd ff:ff:ff:ff:ff:ff
veth
[[email protected] ~]#
While using "-d" option, ip command gives you a little more details about the interface. In this case, it tells you whether a interface is part of a veth pair.