Lab 5-1: FreeBSD Bridge Cluster Lab

This lab introduces the FreeBSD approach to bridging. Bridging is available on OpenBSD and Linux as well; however, FreeBSD offers a unique feature named bridge-clusters. A cluster is an independent set of connected Ethernet or VLAN interfaces uniquely identified by a cluster ID. Consult the manual pages bridge(4), ng_bridge(4), vlan(4), and netgraph(4) for further details.

Example 5-16 shows the configuration sequence for bridging between two gateway interfaces (xl0 and ed0) via (default) cluster ID 1. Before we start, we have to turn bridging on via sysctl, however. The result of this configuration is presented in Example 5-17, the general concept in Figure 5-2.

Figure 5-2. VLAN and Trunk Bridging

graphics/05fig02.gif


Example 5-16. Plain Bridging Between Two Interfaces
[root@castor:~#] sysctl net.link.ether.bridge=1
 net.link.ether.bridge: 1 -> 1

[root@castor:~#] sysctl net.link.ether.bridge_cfg=xl0:1,ed0:1
 net.link.ether.bridge_cfg: xl0:1 -> xl0:1,ed0:1

Example 5-17. FreeBSD Bridging-Related Status Information
[root@castor:~#] sysctl -a | grep bridge
net.link.ether.bridge_cfg: xl0:1,ed0:1
net.link.ether.bridge: 1
net.link.ether.bridge_ipfw: 0
net.link.ether.bridge_ipfw_drop: 0
net.link.ether.bridge_ipfw_collisions: 0

The configuration in Figure 5-3 and Example 5-18 is derived from the bridge(4) man page and presents a bridge-cluster setup example involving VLANs and parent interfaces. Interface ed0 acts as a VLAN trunk interface transporting VLANs 8 and 9. The sysctl configuration statement directs packets for VLAN 8 to physical interface xl0, and packets for VLAN 9 to xl1. The logical relationship is established by the two cluster identifiers that tie VLAN 8 to xl0 (cluster ID 34) and VLAN 9 to xl1 (cluster ID 35).

Figure 5-3. VLAN Access Port and Trunk Bridging

graphics/05fig03.gif


Example 5-18. FreeBSD Bridge-Cluster Setup
[root@castor:~#] sysctl net.link.ether.bridge_cfg=vlan8:34,xl0:34,vlan9:35,xl1:35
[root@castor:~#] ifconfig vlan8 create
[root@castor:~#] ifconfig vlan9 create
[root@castor:~#] ifconfig vlan8 vlan 8 vlandev ed0
[root@castor:~#] ifconfig vlan9 vlan 9 vlandev ed0

You can certainly use advanced features such as filtering and traffic shaping on bridged interfaces, VLANs, and trunks as well.