xref: /openbsd/share/man/man4/tpmr.4 (revision d415bd75)
1.\" $OpenBSD: tpmr.4,v 1.10 2021/07/28 19:19:38 benno Exp $
2.\"
3.\" Copyright (c) 2019 David Gwynne <dlg@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: July 28 2021 $
18.Dt TPMR 4
19.Os
20.Sh NAME
21.Nm tpmr
22.Nd IEEE 802.1Q Two-Port MAC Relay interface
23.Sh SYNOPSIS
24.Cd "pseudo-device tpmr"
25.Sh DESCRIPTION
26The
27.Nm
28driver implements an 802.1Q (originally 802.1aj) Two-Port MAC Relay
29(TPMR).
30A TPMR is a simplified Ethernet bridge with exactly two member ports,
31and it unconditionally relays Ethernet packets between those ports.
32.Pp
33.Nm
34interfaces can be created at runtime using the
35.Ic ifconfig tpmr Ns Ar N Ic create
36command or by setting up a
37.Xr hostname.if 5
38configuration file for
39.Xr netstart 8 .
40.Pp
41Other forms of Ethernet bridging are available using the
42.Xr bridge 4
43Ethernet bridge driver and the
44.Xr veb 4
45Virtual Ethernet Bridge device.
46Link aggregation of Ethernet interfaces can be achieved
47using the
48.Xr aggr 4
49and
50.Xr trunk 4
51drivers.
52.Sh IOCTLS
53The following
54.Xr ioctl 2
55calls and their structures are commonly use by
56.Nm
57and
58.Xr bridge 4 :
59.Pp
60.Bl -bullet -offset indent -compact
61.It
62.Dv SIOCBRDGADD
63.It
64.Dv SIOCBRDGDEL
65.El
66.Sh EXAMPLES
67.Nm
68can be used to cross-connect Ethernet devices that support different
69physical media.
70For example, a device that supports a 100baseTX half-duplex connection
71can be connected to a switch with 1000baseSX optical ports by using
72.Nm
73with a pair of physical network interfaces, each of which supports
74the required media types.
75If
76.Xr fxp 4
77is used to connect to the 100baseTX device, and
78.Xr em 4
79is used to connect to the 1000baseSX switch, the following configuration
80can be used:
81.Bd -literal -offset indent
82# ifconfig tpmr0 create
83# ifconfig tpmr0 add fxp0 add em0
84# ifconfig fxp0 up
85# ifconfig em0 up
86# ifconfig tpmr0 up
87.Ed
88.Pp
89Multiple TPMRs can be chained to transport Ethernet traffic for a
90pair of devices over another network.
91Given two physically separate Ethernet switches, TPMRs can be used
92as follows to provide a point-to-point Ethernet link between them.
93.Nm
94with the
95.Cm link0
96flag set allows the use of the Link Aggregation Control Protocol (LACP)
97or Spanning Tree Protocol (STP) by the switches to detect communication
98failures or connectivity loops respectively, which is not possible
99using
100.Xr bridge 4
101as it filters those protocols.
102.Pp
103If Host A connected to Router B has the external IP address 192.0.2.10
104on em0, Host D connected to Router C has the external IP address
105198.51.100.14 on em0, and both hosts have em1 connected to the
106switches, the following configuration can be used to connect the
107switches together.
108.Xr etherip 4
109is used to transport the Ethernet packets over the IP network.
110.Bd -literal
111Switch X ---- Host A ---------- tunnel ----------- Host D ---- Switch E
112               \e                                    /
113                \e                                  /
114                 +---- Router B ---- Router C ----+
115.Ed
116.Pp
117Create the
118.Nm
119and
120.Xr etherip 4
121interfaces:
122.Bd -literal -offset indent
123# ifconfig etherip0 create
124# ifconfig tpmr0 create link0
125.Ed
126.Pp
127Configure the etherip interface:
128.Bd -literal -offset indent
129(on Host A) # ifconfig etherip0 tunnel 192.0.2.10 198.51.100.14 up
130(on Host D) # ifconfig etherip0 tunnel 198.51.100.14 192.0.2.10 up
131.Ed
132.Pp
133Add the etherip interface and physical interface to the TPMR:
134.Bd -literal -offset indent
135# ifconfig tpmr0 add em1 add etherip0 up
136.Ed
137.Pp
138An equivalent setup using MPLS pseudowires instead of IP as the
139transport can be built using
140.Xr mpw 4
141interfaces.
142.Sh SEE ALSO
143.Xr aggr 4 ,
144.Xr bridge 4 ,
145.Xr pf 4 ,
146.Xr trunk 4 ,
147.Xr veb 4 ,
148.Xr hostname.if 5 ,
149.Xr ifconfig 8 ,
150.Xr netstart 8
151.\" .Sh STANDARDS
152.\" .Rs
153.\" .%T IEEE 802.1Q
154.\" .Re
155.\" .Rs
156.\" .%T IEEE 802.1aj
157.\" .Re
158.Sh HISTORY
159The
160.Nm
161driver first appeared in
162.Ox 6.6 .
163