xref: /openbsd/share/man/man4/pair.4 (revision 4bdff4be)
1.\"	$OpenBSD: pair.4,v 1.4 2015/10/30 10:48:55 reyk Exp $
2.\"
3.\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
4.\" Copyright (c) 2009 Theo de Raadt <deraadt@openbsd.org>
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: October 30 2015 $
19.Dt PAIR 4
20.Os
21.Sh NAME
22.Nm pair
23.Nd virtual Ethernet interface pair
24.Sh SYNOPSIS
25.Cd "pseudo-device pair"
26.Sh DESCRIPTION
27The
28.Nm
29interface simulates a normal Ethernet interface by encapsulating
30standard network frames with an Ethernet header, specifically for use
31in a pair of interfaces that are interconnected with each other.
32.Pp
33To use it, the administrator needs to create two
34.Nm
35interfaces and connect them;
36the interfaces are
37.Sq patched ,
38as would be done with physical network ports.
39All packets that are sent on the first interface are received on the
40second interface.
41.Sh EXAMPLES
42Set up a pair of interfaces where each of them is a member of a different
43.Xr rdomain 4 :
44.Bd -literal -offset indent
45# ifconfig pair1 rdomain 1 10.1.1.1/24 up
46# ifconfig pair2 rdomain 2 10.1.1.2/24 up
47# ifconfig pair1 patch pair2
48# route -T 1 exec ping 10.1.1.2
49.Ed
50.Pp
51When adding multiple
52.Nm
53to multiple
54.Xr bridge 4
55interfaces, it is possible to create a loop;
56the system load will go up while it is busy sending packets from one
57bridge to another and back.
58By design, the driver does not prevent such loops by itself, but it is
59possible to use the Spanning Tree Protocol (STP) to detect and remove
60loops in the virtual network topology:
61.Bd -literal -offset indent
62# ifconfig pair0 up
63# ifconfig pair1 rdomain 1 patch pair0 up
64# ifconfig pair2 up
65# ifconfig pair3 rdomain 1 patch pair2 up
66# ifconfig bridge0 add pair0 add pair2 stp pair0 stp pair2 up
67# ifconfig bridge1 add pair1 add pair3 stp pair1 stp pair3 up
68.Ed
69.Sh SEE ALSO
70.Xr bridge 4 ,
71.Xr inet 4 ,
72.Xr inet6 4 ,
73.Xr rdomain 4 ,
74.Xr vether 4 ,
75.Xr hostname.if 5 ,
76.Xr ifconfig 8 ,
77.Xr netstart 8
78.Sh HISTORY
79The
80.Nm
81interface first appeared in
82.Ox 5.9 .
83.Sh AUTHORS
84The
85.Nm
86driver is based on
87.Xr vether 4
88by
89.An Theo de Raadt Aq Mt deraadt@openbsd.org .
90It has been extended and turned into
91.Nm
92by
93.An Reyk Floeter Aq Mt reyk@openbsd.org .
94.Sh CAVEATS
95Unlike
96.Xr vether 4 ,
97the
98.Nm
99interface cannot be used as a stand-alone member in a
100.Xr bridge 4 :
101the link state remains down until it is connected to the second interface.
102Any associated routes will be marked down until it is patched.
103Use
104.Xr vether 4
105as a bridge endpoint for routing purposes instead.
106.Sh BUGS
107Like
108.Xr tun 4 ,
109the Ethernet address chosen will be partially random, and may
110occasionally collide with another address.
111