veth(4) — Linux manual page

NAME | DESCRIPTION | SEE ALSO | COLOPHON

veth(4)                 Kernel Interfaces Manual                 veth(4)

NAME         top

       veth - Virtual Ethernet Device

DESCRIPTION         top

       The 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.

       veth devices are always created in interconnected pairs.  A pair
       can be created using the command:

           # ip link add <p1-name> type veth peer name <p2-name>

       In the above, p1-name and p2-name are the names assigned to the
       two connected end points.

       Packets transmitted on one device in the pair are immediately
       received on the other device.  When either device is down, the
       link state of the pair is down.

       veth device pairs are useful for combining the network facilities
       of the kernel together in interesting ways.  A particularly
       interesting use case is to place one end of a 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 netns parameter when creating the
       interfaces:

           # ip link add <p1-name> netns <p1-ns> type veth peer <p2-name> netns <p2-ns>

       or, for an existing veth pair, move one side to the other
       namespace:

           # ip link set <p2-name> netns <p2-ns>

       ethtool(8) can be used to find the peer of a veth network
       interface, using commands something like:

           # ip link add ve_A type veth peer name ve_B   # Create veth pair
           # ethtool -S ve_A         # Discover interface index of peer
           NIC statistics:
                peer_ifindex: 16
           # ip link | grep '^16:'   # Look up interface
           16: ve_B@ve_A: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc ...

SEE ALSO         top

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

COLOPHON         top

       This page is part of the man-pages (Linux kernel and C library
       user-space interface documentation) project.  Information about
       the project can be found at 
       ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report
       for this manual page, see
       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.
       This page was obtained from the tarball man-pages-6.9.1.tar.gz
       fetched from
       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on
       2024-06-26.  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-
       to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not
       part of the original manual page), send a mail to
       [email protected]

Linux man-pages 6.9.1          2024-05-02                        veth(4)

Pages that refer to this page: network_namespaces(7)