1.\" $OpenBSD: tpmr.4,v 1.4 2019/08/20 08:21:03 dlg 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 20 2019 $ 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 ports, and unconditionally relays Ethernet 34packets between the two ports. 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 . 43The interface itself can be configured with 44.Xr ifconfig 8 ; 45see its manual page for more information. 46.Pp 47.Nm 48interfaces may be configured with 49.Xr ifconfig 8 50and 51.Xr netstart 8 52using the following options: 53.Bl -tag -width Ds 54.It Cm trunkport Ar child-iface 55Add 56.Ar child-iface 57as a port. 58.It Cm -trunkport Ar child-iface 59Remove the port 60.Ar child-iface . 61.It Cm link0 62Disable the filtering of Ethernet frames destined for the TPMR 63component reserved addresses, as specified by IEEE 802.1Q. 64.It Cm -link0 65Enable the filtering of Ethernet frames destined for the TPMR 66component reserved addresses, as specified by IEEE 802.1Q. 67This is the default. 68.It Cm link1 69Disable the filtering of IPv4 and IPv6 packets with 70.Xr pf 4 . 71.It Cm -link1 72Enable the filtering of IPv4 and IPv6 packets with 73.Xr pf 4 . 74Packets will appear to enter or leave the member port interfaces. 75This is the default. 76.El 77.\" document the ioctls? 78.Pp 79Other forms of Ethernet bridging are available using the 80.Xr bridge 4 81driver. 82Other forms of aggregation of Ethernet interfaces are available 83using the 84.Xr aggr 4 85and 86.Xr trunk 4 87drivers. 88.Sh EXAMPLES 89.Nm 90can be used to cross-connect Ethernet devices that support different 91physical media. 92For example, a device that supports a 100baseTX half-duplex connection 93can be connected to a switch with 1000baseSX optical ports by using 94.Nm 95with a pair of physical network interfaces, each of which supports 96the required media types. 97If 98.Xr fxp 4 99is used to connect to the 100baseTX device, and 100.Xr em 4 101is used to connect to the 1000baseSX switch, the following configuration 102can be used: 103.Bd -literal 104# ifconfig tpmr0 create 105# ifconfig tpmr0 trunkport fxp0 trunkport em0 106# ifconfig fxp0 up 107# ifconfig em0 up 108# ifconfig tpmr0 up 109.Ed 110.Pp 111Multiple TPMRs can be chained to transport Ethernet traffic for a 112pair of devices over another network. 113Given two physically separate Ethernet switches, TPMRs can be used 114as follows to provide a point-to-point Ethernet link between them. 115.Nm 116with the 117.Cm link0 118flag set allows the use of the Link Aggregation Control Protocol (LACP) 119or Spanning Tree Protocol (STP) by the switches to detect communication 120failures or connectivity loops respectively, which is not possible 121using 122.Xr bridge 4 123as it filters those protocols. 124.Pp 125If Host A connected to Router B has the external IP address 192.0.2.10 126on em0, Host D connected to Router C has the external IP address 127198.51.100.14 on em0, and both hosts have em1 connected to the 128switches, the following configuration can be used to connect the 129switches together. 130.Xr etherip 4 131is used to transport the Ethernet packets over the IP network. 132.Bd -literal 133Switch X ---- Host A ---------- tunnel ----------- Host D ---- Switch E 134 \e / 135 \e / 136 +---- Router B ---- Router C ----+ 137.Ed 138.Pp 139Create the 140.Nm 141and 142.Xr etherip 4 143interfaces: 144.Bd -literal -offset indent 145# ifconfig etherip0 create 146# ifconfig tpmr0 create link0 147.Ed 148.Pp 149Configure the etherip interface: 150.Bd -literal -offset indent 151(on Host A) # ifconfig etherip0 tunnel 192.0.2.10 198.51.100.14 up 152(on Host D) # ifconfig etherip0 tunnel 198.51.100.14 192.0.2.10 up 153.Ed 154.Pp 155Add the etherip interface and physical interface to the TPMR: 156.Bd -literal -offset indent 157# ifconfig tpmr0 trunkport em1 trunkport etherip0 up 158.Ed 159.Pp 160An equivalent setup using MPLS pseudowires instead of IP as the 161transport can be built using 162.Xr mpw 4 163interfaces. 164.Sh SEE ALSO 165.Xr aggr 4 , 166.Xr bridge 4 , 167.Xr pf 4 , 168.Xr trunk 4 , 169.Xr hostname.if 5 , 170.Xr ifconfig 8 , 171.Xr netstart 8 172.\" .Sh STANDARDS 173.\" .Rs 174.\" .%T IEEE 802.1Q 175.\" .Re 176.\" .Rs 177.\" .%T IEEE 802.1aj 178.\" .Re 179.Sh HISTORY 180The 181.Nm 182driver first appeared in 183.Ox 6.6 . 184