xref: /openbsd-src/share/man/man4/tpmr.4 (revision 46035553bfdd96e63c94e32da0210227ec2e3cf1)
1.\" $OpenBSD: tpmr.4,v 1.9 2020/08/24 07:40:03 kn 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: August 24 2020 $
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 that provides a subset of
31the functionality as found in
32.Xr bridge 4 .
33A TPMR has exactly two member ports, and unconditionally relays
34Ethernet packets between them.
35.Pp
36.Nm
37interfaces can be created at runtime using the
38.Ic ifconfig tpmr Ns Ar N Ic create
39command or by setting up a
40.Xr hostname.if 5
41configuration file for
42.Xr netstart 8 .
43.Pp
44Other forms of Ethernet bridging are available using the
45.Xr bridge 4
46driver.
47Link aggregation of Ethernet interfaces can be achieved
48using the
49.Xr aggr 4
50and
51.Xr trunk 4
52drivers.
53.Sh IOCTLS
54The following
55.Xr ioctl 2
56calls and their structures are commonly use by
57.Nm
58and
59.Xr bridge 4 :
60.Pp
61.Bl -bullet -offset indent -compact
62.It
63.Dv SIOCBRDGADD
64.It
65.Dv SIOCBRDGDEL
66.El
67.Sh EXAMPLES
68.Nm
69can be used to cross-connect Ethernet devices that support different
70physical media.
71For example, a device that supports a 100baseTX half-duplex connection
72can be connected to a switch with 1000baseSX optical ports by using
73.Nm
74with a pair of physical network interfaces, each of which supports
75the required media types.
76If
77.Xr fxp 4
78is used to connect to the 100baseTX device, and
79.Xr em 4
80is used to connect to the 1000baseSX switch, the following configuration
81can be used:
82.Bd -literal -offset indent
83# ifconfig tpmr0 create
84# ifconfig tpmr0 add fxp0 add em0
85# ifconfig fxp0 up
86# ifconfig em0 up
87# ifconfig tpmr0 up
88.Ed
89.Pp
90Multiple TPMRs can be chained to transport Ethernet traffic for a
91pair of devices over another network.
92Given two physically separate Ethernet switches, TPMRs can be used
93as follows to provide a point-to-point Ethernet link between them.
94.Nm
95with the
96.Cm link0
97flag set allows the use of the Link Aggregation Control Protocol (LACP)
98or Spanning Tree Protocol (STP) by the switches to detect communication
99failures or connectivity loops respectively, which is not possible
100using
101.Xr bridge 4
102as it filters those protocols.
103.Pp
104If Host A connected to Router B has the external IP address 192.0.2.10
105on em0, Host D connected to Router C has the external IP address
106198.51.100.14 on em0, and both hosts have em1 connected to the
107switches, the following configuration can be used to connect the
108switches together.
109.Xr etherip 4
110is used to transport the Ethernet packets over the IP network.
111.Bd -literal
112Switch X ---- Host A ---------- tunnel ----------- Host D ---- Switch E
113               \e                                    /
114                \e                                  /
115                 +---- Router B ---- Router C ----+
116.Ed
117.Pp
118Create the
119.Nm
120and
121.Xr etherip 4
122interfaces:
123.Bd -literal -offset indent
124# ifconfig etherip0 create
125# ifconfig tpmr0 create link0
126.Ed
127.Pp
128Configure the etherip interface:
129.Bd -literal -offset indent
130(on Host A) # ifconfig etherip0 tunnel 192.0.2.10 198.51.100.14 up
131(on Host D) # ifconfig etherip0 tunnel 198.51.100.14 192.0.2.10 up
132.Ed
133.Pp
134Add the etherip interface and physical interface to the TPMR:
135.Bd -literal -offset indent
136# ifconfig tpmr0 add em1 add etherip0 up
137.Ed
138.Pp
139An equivalent setup using MPLS pseudowires instead of IP as the
140transport can be built using
141.Xr mpw 4
142interfaces.
143.Sh SEE ALSO
144.Xr aggr 4 ,
145.Xr bridge 4 ,
146.Xr pf 4 ,
147.Xr trunk 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