1 .\" Copyright (c) 2012 Tomáš Pospíšek (tpo_deb@sourcepole.ch),
2 .\" Fri, 03 Nov 2012 22:35:33 +0100
3 .\" and Copyright (c) 2012 Eric W. Biederman <ebiederm@xmission.com>
5 .\" SPDX-License-Identifier: GPL-2.0-or-later
8 .TH veth 4 (date) "Linux man-pages (unreleased)"
10 veth \- Virtual Ethernet Device
14 devices are virtual Ethernet devices.
15 They can act as tunnels between network namespaces to create
16 a bridge to a physical network device in another namespace,
17 but can also be used as standalone network devices.
20 devices are always created in interconnected pairs.
21 A pair can be created using the command:
25 # ip link add <p1-name> type veth peer name <p2-name>
33 are the names assigned to the two connected end points.
35 Packets transmitted on one device in the pair are immediately received on
37 When either device is down, the link state of the pair is down.
40 device pairs are useful for combining the network
41 facilities of the kernel together in interesting ways.
42 A particularly interesting use case is to place one end of a
44 pair in one network namespace and the other end in another network namespace,
45 thus allowing communication between network namespaces.
46 To do this, one can provide the
48 parameter when creating the interfaces:
52 # ip link add <p1\-name> netns <p1\-ns> type veth peer <p2\-name> netns <p2\-ns>
58 pair, move one side to the other namespace:
62 # ip link set <p2\-name> netns <p2\-ns>
67 can be used to find the peer of a
69 network interface, using commands something like:
73 # \fBip link add ve_A type veth peer name ve_B\fP # Create veth pair
74 # \fBethtool \-S ve_A\fP # Discover interface index of peer
77 # \fBip link | grep \(aq\(ha16:\(aq\fP # Look up interface
78 16: ve_B@ve_A: <BROADCAST,MULTICAST,M\-DOWN> mtu 1500 qdisc ...
83 .BR network_namespaces (7),