Comments on: Some notes on veth interfaces https://backreference.org/2013/06/20/some-notes-on-veth-interfaces/ Proudly uncool and out of fashion Thu, 06 Nov 2014 23:25:32 +0000 hourly 1 https://wordpress.org/?v=5.8.2 By: waldner https://backreference.org/2013/06/20/some-notes-on-veth-interfaces/#comment-25152 Thu, 06 Nov 2014 23:25:32 +0000 http://backreference.org/?p=4194#comment-25152 In reply to Ashwin.

Thanks for the tip. I'd do it as follows:

peerid=$(ethtool -S veth0 | awk '/peer/{print $2}')
peername=$(ip l | awk -v peerid="$peerid" '$0 ~ ("^"peerid":") { print substr($2, 1, length($2) - 1) }')
]]>
By: Ashwin https://backreference.org/2013/06/20/some-notes-on-veth-interfaces/#comment-25151 Thu, 06 Nov 2014 09:08:39 +0000 http://backreference.org/?p=4194#comment-25151 In reply to waldner.

Hi,

Thanks for the suggestion. You can get the peer name by using the ip and ethtool commands. First, you use ethtool to get the index (used by the OS) of the interface and its peer.
peerid=$(ethtool -S | grep "peer" | awk '{print $2}')

Then you can extract the name of the interface from the index using the ip command
peername=$(ip link list | grep "^${peerid}" | awk '{print $2}' | cut -d ':' -f 1 | tr -d ' ')

]]>
By: waldner https://backreference.org/2013/06/20/some-notes-on-veth-interfaces/#comment-25142 Tue, 14 Oct 2014 23:35:47 +0000 http://backreference.org/?p=4194#comment-25142 In reply to Ashwin.

I'm not aware of any means to get the information you mention in 1. and 2. (which doesn't mean that there isn't one; more information is always welcome). For 3., the file /proc/net/if_inet6 gives IPv6 addresses for the interfaces. I'm not aware of an equivalent file for IPv4 addresses. In any case, no information about veth pairs is given.

]]>
By: Ashwin https://backreference.org/2013/06/20/some-notes-on-veth-interfaces/#comment-25141 Fri, 10 Oct 2014 12:13:12 +0000 http://backreference.org/?p=4194#comment-25141 Hi,

I have the following questions:

1. Is there a way to find the name of a peer for a given interface. For example, if I have the name vGUEST, is there a command that responds with vHOST, the name of the interface which is the peer for vGUEST?

2. Is there a command that dumps all the peers created. For example, ip link list dumps the interfaces but there is no way of knowing the pairs.

3. Where can I find information about a given interface in /proc? For example, cat /proc/net/dev just gives the stats on the transmit and received packets/frames, but is there a way to get additional information such as the IPv* addresses and the peers.

Thanks for this crisp and clear article.

]]>