This page looks best with JavaScript enabled

Network Bridge under FreeBSD

 ·  🎃 kr0m

The function of a network bridge is to transparently connect two network segments. It is usually used to create a software switch with a computer and several network cards. It is also very useful when virtualizing machines since we can share our network card with guests.

The official handbook describes how to create a basic bridge with two network interfaces:

vi /etc/rc.conf

cloned_interfaces="bridge0"
ifconfig_bridge0="addm fxp0 addm fxp1 up"
ifconfig_fxp0="up"
ifconfig_fxp1="up"

However, if we want a configuration with an IP address on the bridge, we must proceed as follows:

cloned_interfaces="bridge0"
ifconfig_em0="up"
ifconfig_bridge0="inet 192.168.61.23 netmask 255.255.255.0 addm em0 up"
defaultrouter="192.168.61.2"

NOTE: It should be noted that if the bridge is being configured on a VirtualBox virtual machine, the VM must be configured with “Promiscuous Mode: Allow All” otherwise the traffic will be able to leave but the responses to that traffic will be blocked because the MAC of the bridge does not match the MAC assigned to the VirtualBox virtual network card.

If you liked the article, you can treat me to a RedBull here