if_bridge - network bridge device
Alternatively, to load the driver as a module at boot time, place the following lines in loader.conf5:
Each interface is created at runtime using interface cloning. This is most easily done with the ifconfig(8) create command or using the cloned_interfaces variable in rc.conf5.
The interface randomly chooses a link (MAC) address in the range reserved for locally administered addresses when it is created. This address is guaranteed to be unique only across all interfaces on the local machine. Thus you can theoretically have two bridges on the different machines with the same link addresses. The address can be changed by assigning the desired link address using ifconfig(8).
A bridge can be used to provide several services, such as a simple 802.11-to-Ethernet bridge for wireless hosts, and traffic isolation.
A bridge works like a hub, forwarding traffic from one interface to another. Multicast and broadcast packets are always forwarded to all interfaces that are part of the bridge. For unicast traffic, the bridge learns which MAC addresses are associated with which interfaces and will forward the traffic selectively.
All the bridged member interfaces need to be up in order to pass network traffic. These can be enabled using ifconfig(8) or ifconfig_ Ao interface Ac =up in rc.conf5.
The MTU of the first member interface to be added is used as the bridge MTU. All additional members are required to have exactly the same value.
The TXCSUM capability is disabled for any interface added to the bridge, and it is restored when the interface is removed again.
The bridge supports ``monitor mode'' where the packets are discarded after bpf(4) processing, and are not processed or forwarded further. This can be used to multiplex the input of two or more interfaces into a single bpf(4) stream. This is useful for reconstructing the traffic for network taps that transmit the RX/TX signals out through two separate interfaces.
RSTP provides faster spanning tree convergence than legacy STP, the protocol will exchange information with neighbouring switches to quickly transition to forwarding without creating loops.
The code will default to RSTP mode but will downgrade any port connected to a legacy STP network so is fully backward compatible. A bridge can be forced to operate in STP mode without rapid state transitions via the proto command in ifconfig(8).
The bridge can log STP port changes to syslog(3) by enabling the net.link.bridge.log_stp variable using sysctl(8).
ARP and REVARP packets are forwarded without being filtered and others that are not IP nor IPv6 packets are not forwarded when pfil_onlyip is enabled. IPFW can filter Ethernet types using mac-type so all packets are passed to the filter for processing.
The packets originating from the bridging host will be seen by the filter on the interface that is looked up in the routing table.
The packets destined to the bridging host will be seen by the filter on the interface with the MAC address equal to the packet's destination MAC. There are situations when some of the bridge members are sharing the same MAC address (for example the vlan(4) interfaces: they are currenly sharing the MAC address of the parent physical interface). It is not possible to distinguish between these interfaces using their MAC address, excluding the case when the packet's destination MAC address is equal to the MAC address of the interface on which the packet was entered to the system. In this case the filter will see the incoming packet on this interface. In all other cases the interface seen by the packet filter is chosen from the list of bridge members with the same MAC address and the result strongly depends on the member addition sequence and the actual implementation of . It is not recommended to rely on the order chosen by the current implementation: it can be changed in the future.
The previous paragraph is best illustrated with the following pictures. Let
Then if the MAC address nn:nn:nn:nn:nn:nn is equal to the xx:xx:xx:xx:xx:xx then the filter will see the packet on the interface ifX no matter if there are any other bridge members carrying the same MAC address. But if the MAC address nn:nn:nn:nn:nn:nn is equal to the yy:yy:yy:yy:yy:yy then the interface that will be seen by the filter is one of the vlanYn It is not possible to predict the name of the actual interface without the knowledge of the system state and the implementation details.
This problem arises for any bridge members that are sharing the same MAC address, not only to the vlan(4) ones: they we taken just as the example of such situation. So if one wants the filter the locally destined packets based on their interface name, one should be aware of this implication. The described situation will appear at least on the filtering bridges that are doing IP-forwarding; in some of such cases it is better to assign the IP address only to the interface and not to the bridge members. Enabling net.link.bridge.pfil_local_phys will let you do the additional filtering on the physical interface.
cloned_interfaces="bridge0" ifconfig_bridge0="addm ath0 addm fxp0 up"
For the bridge to forward packets all member interfaces and the bridge need to be up. The above example would also require:
ifconfig_ath0="up ssid my_ap mode 11g mediaopt hostap" ifconfig_fxp0="up"
Consider a system with two 4-port Ethernet boards. The following will cause a bridge consisting of all 8 ports with Rapid Spanning Tree enabled to be created:
ifconfig bridge0 create ifconfig bridge0 \ addm fxp0 stp fxp0 \ addm fxp1 stp fxp1 \ addm fxp2 stp fxp2 \ addm fxp3 stp fxp3 \ addm fxp4 stp fxp4 \ addm fxp5 stp fxp5 \ addm fxp6 stp fxp6 \ addm fxp7 stp fxp7 \ up
The bridge can be used as a regular host interface at the same time as bridging between its member ports. In this example, the bridge connects em0 and em1, and will receive its IP address through DHCP:
cloned_interfaces="bridge0" ifconfig_bridge0="addm em0 addm em1 DHCP" ifconfig_em0="up" ifconfig_em1="up"
The bridge can tunnel Ethernet across an IP internet using the EtherIP protocol. This can be combined with ipsec(4) to provide an encrypted connection. Create a gif(4) interface and set the local and remote IP addresses for the tunnel, these are reversed on the remote bridge.
ifconfig gif0 create ifconfig gif0 tunnel 126.96.36.199 188.8.131.52 up ifconfig bridge0 create ifconfig bridge0 addm fxp0 addm gif0 up
This version of the driver has been heavily modified from the original version by An Jason R. Thorpe Aq email@example.com .
Rapid Spanning Tree Protocol (RSTP) support was added by An Andrew Thompson Aq thompsa@FreeBSD.org .
Only wireless interfaces in hostap mode can be bridged due to the 802.11 framing format, bridging a wireless client is not supported yet.
Закладки на сайте
Проследить за страницей
Created 1996-2022 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру