]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man4/veth.4
veth.4: SHow command used to move a veth device into another network namespace
[thirdparty/man-pages.git] / man4 / veth.4
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>
4 .\"
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" USA.
24 .\"
25 .\"
26 .TH veth 4 2017-10-03 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 veth \- Virtual Ethernet Device
29 .SH DESCRIPTION
30 The
31 .B veth
32 devices are virtual Ethernet devices.
33 They can act as tunnels between network namespaces to create
34 a bridge to a physical network device in another namespace,
35 but can also be used as standalone network devices.
36 .PP
37 .B veth
38 devices are always created in interconnected pairs.
39 A pair can be created using the command:
40 .PP
41 .in +4n
42 .EX
43 # ip link add <p1-name> type veth peer name <p2-name>
44 .EE
45 .in
46 .PP
47 In the above,
48 .I p1-name
49 and
50 .I p2-name
51 are the names assigned to the two connected end points.
52 .PP
53 Packets transmitted on one device in the pair are immediately received on
54 the other device.
55 When either devices is down the link state of the pair is down.
56 .PP
57 .B veth
58 device pairs are useful for combining the network
59 facilities of the kernel together in interesting ways.
60 A particularly interesting use case is to place one end of a
61 .B veth
62 pair in one network namespace and the other end in another network namespace,
63 thus allowing communication between network namespaces.
64 To do this, one first creates the
65 .B veth
66 device as above and then moves one side of the pair to the other namespace:
67 .PP
68 .in +4n
69 .EX
70 # ip link set <p2-name> netns <p2-namespace>
71 .EE
72 .in
73 .PP
74 .BR ethtool (8)
75 can be used to find the peer of a
76 .B veth
77 network interface, using commands something like:
78 .PP
79 .in +4n
80 .EX
81 # \fBip link add ve_A type veth peer name ve_B\fP # Create veth pair
82 # \fBethtool -S ve_A\fP # Discover interface index of peer
83 NIC statistics:
84 peer_ifindex: 16
85 # \fBip link | grep '^16:'\fP # Look up interface
86 16: ve_B@ve_A: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc ...
87 .EE
88 .in
89 .PP
90 .SH "SEE ALSO"
91 .BR clone (2),
92 .BR ip (8),
93 .BR ip-link (8),
94 .BR ip-netns (8)