1veth(4) Linux Programmer's Manual veth(4)
2
3
4
6 veth - Virtual Ethernet Device
7
9 The veth devices are virtual Ethernet devices. They can act as tunnels
10 between network namespaces to create a bridge to a physical network
11 device in another namespace, but can also be used as standalone network
12 devices.
13
14 veth devices are always created in interconnected pairs. A pair can be
15 created using the command:
16
17 # ip link add <p1-name> type veth peer name <p2-name>
18
19 In the above, p1-name and p2-name are the names assigned to the two
20 connected end points.
21
22 Packets transmitted on one device in the pair are immediately received
23 on the other device. When either devices is down the link state of the
24 pair is down.
25
26 veth device pairs are useful for combining the network facilities of
27 the kernel together in interesting ways. A particularly interesting
28 use case is to place one end of a veth pair in one network namespace
29 and the other end in another network namespace, thus allowing communi‐
30 cation between network namespaces. To do this, one first creates the
31 veth device as above and then moves one side of the pair to the other
32 namespace:
33
34 # ip link set <p2-name> netns <p2-namespace>
35
36 ethtool(8) can be used to find the peer of a veth network interface,
37 using commands something like:
38
39 # ip link add ve_A type veth peer name ve_B # Create veth pair
40 # ethtool -S ve_A # Discover interface index of peer
41 NIC statistics:
42 peer_ifindex: 16
43 # ip link | grep '^16:' # Look up interface
44 16: ve_B@ve_A: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc ...
45
47 clone(2), network_namespaces(7), ip(8), ip-link(8), ip-netns(8)
48
50 This page is part of release 4.16 of the Linux man-pages project. A
51 description of the project, information about reporting bugs, and the
52 latest version of this page, can be found at
53 https://www.kernel.org/doc/man-pages/.
54
55
56
57Linux 2018-02-02 veth(4)