.\" Fri, 03 Nov 2012 22:35:33 +0100
.\" and Copyright (c) 2012 Eric W. Biederman <ebiederm@xmission.com>
.\"
+.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
+.\" %%%LICENSE_END
.\"
.\"
-.TH veth 4 2017-10-03 "Linux" "Linux Programmer's Manual"
+.TH VETH 4 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
veth \- Virtual Ethernet Device
.SH DESCRIPTION
.B veth
devices are virtual Ethernet devices.
They can act as tunnels between network namespaces to create
-a bridge to a physical network device in another namespace, but
-can also be used as standalone network devices.
+a bridge to a physical network device in another namespace,
+but can also be used as standalone network devices.
.PP
.B veth
devices are always created in interconnected pairs.
and
.I p2-name
are the names assigned to the two connected end points.
-interconnected with each other.
.PP
-Packets transmitted on one device in the pair are immediately received on
+Packets transmitted on one device in the pair are immediately received on
the other device.
-When either devices is down the link state of the pair is down.
+When either device is down, the link state of the pair is down.
.PP
.B veth
device pairs are useful for combining the network
.B veth
pair in one network namespace and the other end in another network namespace,
thus allowing communication between network namespaces.
+To do this, one can provide the
+.B netns
+parameter when creating the interfaces:
+.PP
+.in +4n
+.EX
+# ip link add <p1\-name> netns <p1\-ns> type veth peer <p2\-name> netns <p2\-ns>
+.EE
+.in
+.PP
+or, for an existing
+.B veth
+pair, move one side to the other namespace:
+.PP
+.in +4n
+.EX
+# ip link set <p2\-name> netns <p2\-ns>
+.EE
+.in
.PP
.BR ethtool (8)
-can be used to test if a networking device is a
+can be used to find the peer of a
.B veth
-device, and to find the peer network interface.
+network interface, using commands something like:
+.PP
+.in +4n
+.EX
+# \fBip link add ve_A type veth peer name ve_B\fP # Create veth pair
+# \fBethtool \-S ve_A\fP # Discover interface index of peer
+NIC statistics:
+ peer_ifindex: 16
+# \fBip link | grep \(aq\(ha16:\(aq\fP # Look up interface
+16: ve_B@ve_A: <BROADCAST,MULTICAST,M\-DOWN> mtu 1500 qdisc ...
+.EE
+.in
.SH "SEE ALSO"
.BR clone (2),
+.BR network_namespaces (7),
.BR ip (8),
-.BR ip-link (8)
+.BR ip\-link (8),
+.BR ip\-netns (8)