1VETH(4)                    Linux Programmer's Manual                   VETH(4)
2
3
4

NAME

6       veth - Virtual Ethernet Device
7

DESCRIPTION

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 de‐
11       vice  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  can  provide  the
31       netns parameter when creating the interfaces:
32
33           # ip link add <p1-name> netns <p1-ns> type veth peer <p2-name> netns <p2-ns>
34
35       or, for an existing veth pair, move one side to the other namespace:
36
37           # ip link set <p2-name> netns <p2-ns>
38
39       ethtool(8)  can  be  used to find the peer of a veth network interface,
40       using commands something like:
41
42           # ip link add ve_A type veth peer name ve_B   # Create veth pair
43           # ethtool -S ve_A         # Discover interface index of peer
44           NIC statistics:
45                peer_ifindex: 16
46           # ip link | grep '^16:'   # Look up interface
47           16: ve_B@ve_A: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc ...
48

SEE ALSO

50       clone(2), network_namespaces(7), ip(8), ip-link(8), ip-netns(8)
51

COLOPHON

53       This page is part of release 5.12 of the Linux  man-pages  project.   A
54       description  of  the project, information about reporting bugs, and the
55       latest    version    of    this    page,    can     be     found     at
56       https://www.kernel.org/doc/man-pages/.
57
58
59
60Linux                             2021-03-22                           VETH(4)
Impressum