1db37145fSSimon Schubert.\" Copyright 2001 Wasabi Systems, Inc. 2db37145fSSimon Schubert.\" All rights reserved. 3db37145fSSimon Schubert.\" 4db37145fSSimon Schubert.\" Written by Jason R. Thorpe for Wasabi Systems, Inc. 5*3677aae9SMatthew Dillon.\" Spanning tree modifications by Matthew Dillon 6db37145fSSimon Schubert.\" 7db37145fSSimon Schubert.\" Redistribution and use in source and binary forms, with or without 8db37145fSSimon Schubert.\" modification, are permitted provided that the following conditions 9db37145fSSimon Schubert.\" are met: 10db37145fSSimon Schubert.\" 1. Redistributions of source code must retain the above copyright 11db37145fSSimon Schubert.\" notice, this list of conditions and the following disclaimer. 12db37145fSSimon Schubert.\" 2. Redistributions in binary form must reproduce the above copyright 13db37145fSSimon Schubert.\" notice, this list of conditions and the following disclaimer in the 14db37145fSSimon Schubert.\" documentation and/or other materials provided with the distribution. 15db37145fSSimon Schubert.\" 3. All advertising materials mentioning features or use of this software 16db37145fSSimon Schubert.\" must display the following acknowledgement: 17db37145fSSimon Schubert.\" This product includes software developed for the NetBSD Project by 18db37145fSSimon Schubert.\" Wasabi Systems, Inc. 19db37145fSSimon Schubert.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse 20db37145fSSimon Schubert.\" or promote products derived from this software without specific prior 21db37145fSSimon Schubert.\" written permission. 22db37145fSSimon Schubert.\" 23db37145fSSimon Schubert.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 24db37145fSSimon Schubert.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25db37145fSSimon Schubert.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26db37145fSSimon Schubert.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 27db37145fSSimon Schubert.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28db37145fSSimon Schubert.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29db37145fSSimon Schubert.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30db37145fSSimon Schubert.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31db37145fSSimon Schubert.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32db37145fSSimon Schubert.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33db37145fSSimon Schubert.\" POSSIBILITY OF SUCH DAMAGE. 34db37145fSSimon Schubert.\" 35db37145fSSimon Schubert.\" 36*3677aae9SMatthew Dillon.Dd February 22, 2011 37db37145fSSimon Schubert.Dt BRIDGE 4 38db37145fSSimon Schubert.Os 39db37145fSSimon Schubert.Sh NAME 40db37145fSSimon Schubert.Nm bridge 41db37145fSSimon Schubert.Nd network bridge device 42db37145fSSimon Schubert.Sh SYNOPSIS 43db37145fSSimon Schubert.Cd "pseudo-device bridge" 44db37145fSSimon Schubert.Sh DESCRIPTION 45db37145fSSimon SchubertThe 46db37145fSSimon Schubert.Nm 47db37145fSSimon Schubertdriver creates a logical link between two or more IEEE 802 networks 48db37145fSSimon Schubertthat use the same (or 49db37145fSSimon Schubert.Dq similar enough ) 50db37145fSSimon Schubertframing format. 51db37145fSSimon SchubertFor example, it is possible to bridge Ethernet and 802.11 networks together, 52db37145fSSimon Schubertbut it is not possible to bridge Ethernet and Token Ring together. 53db37145fSSimon Schubert.Pp 54db37145fSSimon SchubertTo use 559b5a9965SSascha Wildner.Nm , 56db37145fSSimon Schubertthe administrator must first create the interface and configure 57db37145fSSimon Schubertthe bridge parameters. 58db37145fSSimon SchubertThe bridge is created using the 59db37145fSSimon Schubert.Xr ifconfig 8 60db37145fSSimon Schubert.Cm create 61db37145fSSimon Schubertsubcommand. 6245eff2e9SSascha WildnerSee the 6345eff2e9SSascha Wildner.Xr ifconfig 8 6445eff2e9SSascha Wildnermanual page for further information on configuring bridges. 65db37145fSSimon Schubert.Pp 66db37145fSSimon SchubertA bridge can be used to provide several services, such as a simple 67db37145fSSimon Schubert802.11-to-Ethernet bridge for wireless hosts, and traffic isolation. 68db37145fSSimon Schubert.Pp 69db37145fSSimon SchubertA bridge works like a hub, forwarding traffic from one interface 70db37145fSSimon Schubertto another. 71db37145fSSimon SchubertMulticast and broadcast packets are always forwarded to all 72db37145fSSimon Schubertinterfaces that are part of the bridge. 73db37145fSSimon SchubertFor unicast traffic, the bridge learns which MAC addresses are associated 74db37145fSSimon Schubertwith which interfaces and will forward the traffic selectively. 75db37145fSSimon Schubert.Pp 76be02a6a0SMatthew DillonThe bridge operates in a safe mode by default, setting the MAC source in 77be02a6a0SMatthew Dillonthe link header on outgoing packets to the outgoing interface MAC. 78be02a6a0SMatthew DillonThis reduces the chance that the layer-2 switching in your switches 79be02a6a0SMatthew Dillonwill become confused. 80be02a6a0SMatthew DillonTo operate the bridge in transparent MAC mode you must set the 81be02a6a0SMatthew Dillon.Cm link0 82be02a6a0SMatthew Dillonflag on the bridge interface via 83be02a6a0SMatthew Dillon.Xr ifconfig 8 84be02a6a0SMatthew Dillonand then carefully check that your network is still fully operational. 85be02a6a0SMatthew Dillon.Pp 86be02a6a0SMatthew DillonIf your network becomes glitchy, with long pauses in tcp sessions, then 87be02a6a0SMatthew Dillontransparent bridging mode is likely the cause. This mode should only be 88be02a6a0SMatthew Dillonused when you are bridging networks with devices that do MAC-based security 89be02a6a0SMatthew Dillonor firewalling (for example, the supremely braindead at&t uverse router), 90be02a6a0SMatthew Dillonor which impose severe limitations on MAC:IP assignments. 91be02a6a0SMatthew Dillon.Pp 92db37145fSSimon SchubertThe 93db37145fSSimon Schubert.Nm 94db37145fSSimon Schubertdriver implements the IEEE 802.1D Spanning Tree protocol (STP). 95db37145fSSimon SchubertSpanning Tree is used to detect and remove loops in a network topology. 96db37145fSSimon Schubert.Pp 97db37145fSSimon SchubertPacket filtering can be used with any firewall package that hooks in via the 98db37145fSSimon Schubert.Xr pfil 9 99db37145fSSimon Schubertframework. 100db37145fSSimon SchubertWhen filtering is enabled, bridged packets will pass through the filter 101db37145fSSimon Schubertinbound on the originating interface, on the bridge interface and outbound on 102db37145fSSimon Schubertthe appropriate interfaces. 103db37145fSSimon SchubertEither stage can be disabled, this behaviour can be controlled using 104db37145fSSimon Schubert.Xr sysctl 8 : 105db37145fSSimon SchubertSet 106db37145fSSimon Schubert.Va net.link.bridge.pfil_member 107db37145fSSimon Schubertto 108db37145fSSimon Schubert.Li 1 109db37145fSSimon Schubertto enable filtering on the incoming and outgoing member interfaces 110db37145fSSimon Schubertand set 111db37145fSSimon Schubert.Va net.link.bridge.pfil_bridge 112db37145fSSimon Schubertto 113db37145fSSimon Schubert.Li 1 114db37145fSSimon Schubertto enable filtering on the bridge interface. 115db37145fSSimon Schubert.Pp 116db37145fSSimon SchubertARP and REVARP packets are forwarded without being filtered and others 117db37145fSSimon Schubertthat are not IP nor IPv6 packets are not forwarded when filtering is 118db37145fSSimon Schubertenabled. 119db37145fSSimon Schubert.Pp 120db37145fSSimon SchubertNote that packets to and from the bridging host will be seen by the 121db37145fSSimon Schubertfilter on the interface with the appropriate address configured as well 122db37145fSSimon Schubertas on the interface on which the packet arrives or departs. 123db37145fSSimon Schubert.Pp 124db37145fSSimon SchubertThe MTU of the first member interface to be added is used as the bridge MTU, 125db37145fSSimon Schubertall additional members are required to have exactly the same value. 126*3677aae9SMatthew Dillon.Sh EXTRA FEATURES 127*3677aae9SMatthew Dillon.Dx 128*3677aae9SMatthew Dillonimplements two additional features to make spanning tree operation more 129*3677aae9SMatthew Dillonresilient. 130*3677aae9SMatthew Dillon.Pp 131*3677aae9SMatthew DillonSpecifying 132*3677aae9SMatthew Dillon.Cm link0 133*3677aae9SMatthew Dillonon the bridge interface places the bridge in transparent bridging mode. 134*3677aae9SMatthew DillonThe bridge will make every attempt to retain the original source MAC in 135*3677aae9SMatthew Dillonthe ethernet link header. 136*3677aae9SMatthew Dillon.Pp 137*3677aae9SMatthew DillonSpecifying 138*3677aae9SMatthew Dillon.Cm link1 139*3677aae9SMatthew Dillonon the bridge interface forces the bridge to generate a 802.11d CFG 140*3677aae9SMatthew Dillonmessage on every hello interval for all interfaces participating 141*3677aae9SMatthew Dillonin the STP protocol. 142*3677aae9SMatthew DillonNormally CFG messages are only generated by the root bridge interface 143*3677aae9SMatthew Dillonor during topology changes. 144*3677aae9SMatthew DillonIn addition the bridge code expects to receive 802.11d frames from 145*3677aae9SMatthew Dillonall interface participating in the STP protocol. 146*3677aae9SMatthew Dillon.Pp 147*3677aae9SMatthew DillonAn interface which fails to receive a 802.11d frame within 10 times 148*3677aae9SMatthew Dillonthe hello interval (usually 20 seconds) automatically goes into 149*3677aae9SMatthew Dillonl1blocking mode, which can be observed in the ifconfig output for 150*3677aae9SMatthew Dillonthe bridge. This removes the interface from consideration and the 151*3677aae9SMatthew Dillonbridge code automatically routes around it. 152*3677aae9SMatthew Dillon.Pp 153*3677aae9SMatthew DillonUsing 154*3677aae9SMatthew Dillon.Cm link0 155*3677aae9SMatthew Dillonand 156*3677aae9SMatthew Dillon.Cm link1 157*3677aae9SMatthew Dillontogether between two 158*3677aae9SMatthew Dillon.Dx 159*3677aae9SMatthew Dillonboxes allows you to maintain multiple parallel vpns between those 160*3677aae9SMatthew Dillonboxes via different networks (if you happen to be on more than one 161*3677aae9SMatthew Dillonwith internet access). 162*3677aae9SMatthew DillonUse separate openvpn instances and tap devices for each vpn link 163*3677aae9SMatthew Dillonto accomplish this, placing them in the same bridge interface on 164*3677aae9SMatthew Dillonthe two endpoints. 165*3677aae9SMatthew DillonThe tap devices do not need any IP configuration when bridged and 166*3677aae9SMatthew Dilloncan be assigned the same ether MAC (in fact they have to be 167*3677aae9SMatthew Dillonif you want the failover to work nicely). 168db37145fSSimon Schubert.Sh SEE ALSO 169375d1659SSascha Wildner.Xr pf 4 , 17045eff2e9SSascha Wildner.Xr ifconfig 8 171db37145fSSimon Schubert.Sh HISTORY 172db37145fSSimon SchubertThe 173db37145fSSimon Schubert.Nm 174db37145fSSimon Schubertdriver first appeared in 175db37145fSSimon Schubert.Ox 2.5 176db37145fSSimon Schubertand found its way into 1779feb902cSSascha Wildner.Dx 1.3 . 178be02a6a0SMatthew DillonTransparent bridging (link0) was added in 179be02a6a0SMatthew Dillon.Dx 2.9 180be02a6a0SMatthew Dillonin 2011. 181db37145fSSimon Schubert.Sh AUTHORS 182db37145fSSimon Schubert.An -nosplit 183db37145fSSimon SchubertThe 1849b5a9965SSascha Wildner.Nm 185db37145fSSimon Schubertdriver was originally written by 186db37145fSSimon Schubert.An Jason L. Wright 187db37145fSSimon Schubert.Aq jason@thought.net 188db37145fSSimon Schubertas part of an undergraduate independent study at the University of 189db37145fSSimon SchubertNorth Carolina at Greensboro. 190db37145fSSimon Schubert.Pp 191db37145fSSimon SchubertThis version of the 192db37145fSSimon Schubert.Nm 193db37145fSSimon Schubertdriver has been heavily modified from the original version by 194db37145fSSimon Schubert.An Jason R. Thorpe 195db37145fSSimon Schubert.Aq thorpej@wasabisystems.com . 196db37145fSSimon Schubert.Sh BUGS 197db37145fSSimon SchubertThe 198db37145fSSimon Schubert.Nm 199db37145fSSimon Schubertdriver currently supports only Ethernet and Ethernet-like (e.g. 802.11) 200db37145fSSimon Schubertnetwork devices, with exactly the same interface MTU size as the bridge device. 201