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