1.\" $NetBSD: brconfig.8,v 1.20 2020/07/19 14:43:35 wiz Exp $ 2.\" 3.\" Copyright 2001 Wasabi Systems, Inc. 4.\" All rights reserved. 5.\" 6.\" Written by Jason R. Thorpe for Wasabi Systems, Inc. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. All advertising materials mentioning features or use of this software 17.\" must display the following acknowledgement: 18.\" This product includes software developed for the NetBSD Project by 19.\" Wasabi Systems, Inc. 20.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse 21.\" or promote products derived from this software without specific prior 22.\" written permission. 23.\" 24.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 25.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" POSSIBILITY OF SUCH DAMAGE. 35.\" 36.Dd July 19, 2020 37.Dt BRCONFIG 8 38.Os 39.Sh NAME 40.Nm brconfig 41.Nd configure network bridge parameters 42.Sh SYNOPSIS 43.Nm 44.Fl a 45.Nm 46.Ar bridge 47.Nm 48.Ar bridge 49.Ar command 50.Op Ar args ... 51.Sh DESCRIPTION 52The 53.Nm 54utility is used to configure network bridge parameters and retrieve 55network bridge parameters and status from the kernel. 56The bridging function is implemented by the 57.Xr bridge 4 58driver. 59.Pp 60A network bridge creates a logical link between two or more 61IEEE 802 networks that use the same (or 62.Dq similar enough ) 63framing format. 64For example, it is possible to bridge Ethernet 65and 802.11 networks together, but it is not possible to bridge 66Ethernet and Token Ring together. 67.Pp 68Bridge interfaces are created using the 69.Xr ifconfig 8 70command's 71.Dq create 72sub-command. 73All other bridge configuration is performed using 74.Nm . 75.Pp 76The options are as follows: 77.Bl -tag -width indent 78.It Fl a 79Display the status of all bridge devices present on the system. 80This flag is mutually exclusive with all other sub-commands. 81.El 82.Pp 83All other operations require that a bridge be specified. 84If a bridge is specified with no sub-commands, 85the status of that bridge is displayed. 86The following sub-commands are available: 87.Bl -tag -width indent 88.It Cm up 89Start forwarding packets on the bridge. 90.It Cm down 91Stop forwarding packets on the bridge. 92.It Cm add Ar interface 93Add the interface named by 94.Ar interface 95as a member of the bridge. 96The interface is put into promiscuous mode 97so that it can receive every packet sent on the network. 98.It Cm delete Ar interface 99Remove the interface named by 100.Ar interface 101from the bridge. 102Promiscuous mode is disabled on the interface when 103it is removed from the bridge. 104.It Cm addr 105Display the addresses that have been learned by the bridge. 106.It Cm maxaddr Ar size 107Set the size of the bridge address cache to 108.Ar size . 109The default is 100 entries. 110.It Cm timeout Ar seconds 111Set the timeout of address cache entries to 112.Ar seconds 113seconds. 114If 115.Ar seconds 116is zero, then address cache entries will not be expired. 117The default is 1200 seconds. 118.It Cm deladdr Ar address 119Delete 120.Ar address 121from the address cache. 122.It Cm flush 123Delete all dynamically-learned addresses from the address cache. 124.It Cm flushall 125Delete all addresses, including static addresses, from the address cache. 126.It Cm discover Ar interface 127Mark an interface as a 128.Dq discovering 129interface. 130When the bridge has no address cache entry 131(either dynamic or static) 132for the destination address of a packet, 133the bridge will forward the packet to all 134member interfaces marked as 135.Dq discovering . 136This is the default for all interfaces added to a bridge. 137.It Cm -discover Ar interface 138Clear the 139.Dq discovering 140attribute on a member interface. 141For packets without the 142.Dq discovering 143attribute, the only packets forwarded on the interface are broadcast 144or multicast packets and packets for which the destination address 145is known to be on the interface's segment. 146.It Cm ipf 147Enable packet filtering with 148.Xr pfil 9 149on the bridge. 150The current implementation passes 151all ARP and RARP packets through the bridge 152while filtering IP and IPv6 packets through the configured packet 153filter, such as 154.Xr npf 7 . 155Other packet types are blocked. 156.It Cm learn Ar interface 157Mark an interface as a 158.Dq learning 159interface. 160When a packet arrives on such an interface, the source 161address of the packet is entered into the address cache as being a 162destination address on the interface's segment. 163This is the default for all interfaces added to a bridge. 164.It Cm -learn Ar interface 165Clear the 166.Dq learning 167attribute on a member interface. 168.It Cm static Ar interface address 169Add a static entry into the address cache pointing to 170.Ar interface . 171Static entries are never aged out of the cache or replaced, even if the address 172is seen on a different interface. 173.It Cm stp Ar interface 174Enable Spanning Tree protocol on 175.Ar interface . 176The 177.Xr bridge 4 178driver has support for the IEEE 802.1D Spanning Tree protocol (STP). 179Spanning Tree is used to detect and remove loops in a network topology. 180.It Cm -stp Ar interface 181Disable Spanning Tree protocol on 182.Ar interface . 183This is the default for all interfaces added to a bridge. 184.It Cm maxage Ar seconds 185Set the time that a Spanning Tree protocol configuration is valid. 186The default is 20 seconds. 187The minimum is 1 second and the maximum is 255 seconds. 188.It Cm fwddelay Ar seconds 189Set the time that must pass before an interface begins forwarding 190packets when Spanning Tree is enabled. 191The default is 15 seconds. 192The minimum is 1 second and the maximum is 255 seconds. 193.It Cm hellotime Ar seconds 194Set the time between broadcasting of Spanning Tree protocol 195configuration messages. 196The default is 2 seconds. 197The minimum is 1 second and the maximum is 255 seconds. 198.It Cm priority Ar value 199Set the bridge priority for Spanning Tree. 200The default is 32768. 201Allowed numerical values range from 0 (highest priority) to 65535 202(lowest priority). 203.It Cm ifpriority Ar interface Ar value 204Set the Spanning Tree priority of 205.Ar interface 206to 207.Ar value . 208The default is 128. 209The minimum is 0 and the maximum is 255. 210.It Cm ifpathcost Ar interface Ar value 211Set the Spanning Tree path cost of 212.Ar interface 213to 214.Ar value . 215The default is 55. 216The minimum is 0 and the maximum is 65535. 217.El 218.Sh EXAMPLES 219The following, when placed in the file 220.Pa /etc/ifconfig.bridge0 , 221will cause a bridge called 222.Sq bridge0 223to be created, add the interfaces 224.Sq ray0 225and 226.Sq fxp0 227to the bridge, and then enable packet forwarding. 228Such a configuration could be used to implement a simple 229802.11-to-Ethernet bridge (assuming the 802.11 interface is 230in ad-hoc mode). 231.Bd -literal -offset indent 232create 233!brconfig $int add ray0 add fxp0 up 234.Ed 235.Pp 236Consider a system with two 4-port Ethernet boards. 237The following placed in the file 238.Pa /etc/ifconfig.bridge0 239will cause a bridge consisting of all 8 ports with Spanning Tree 240enabled to be created: 241.Bd -literal -offset indent 242create 243!brconfig $int \e 244 add tlp0 stp tlp0 \e 245 add tlp1 stp tlp1 \e 246 add tlp2 stp tlp2 \e 247 add tlp3 stp tlp3 \e 248 add tlp4 stp tlp4 \e 249 add tlp5 stp tlp5 \e 250 add tlp6 stp tlp6 \e 251 add tlp7 stp tlp7 \e 252 up 253.Ed 254.Sh SEE ALSO 255.Xr bridge 4 , 256.Xr pf 4 , 257.Xr ifconfig.if 5 , 258.Xr npf 7 , 259.Xr ifconfig 8 , 260.Xr pfil 9 261.Sh HISTORY 262The 263.Nm 264utility first appeared in 265.Nx 1.6 . 266.Sh AUTHORS 267The 268.Xr bridge 4 269driver and 270.Nm 271utility were originally written by 272.An Jason L. Wright 273.Aq jason@thought.net 274as part of an undergraduate independent study at the 275University of North Carolina at Greensboro. 276.Pp 277This version of the 278.Nm 279utility was written from scratch by 280.An Jason R. Thorpe 281.Aq thorpej@wasabisystems.com . 282