android bsd linux unix & open-source world


FreeBSD: How To Create a Network Bridge

A device that connects two networks together into two separate network segments without having to create IP subnets and use a router to connect the segments together is called a "bridge".

To create a bridge use ifconfig command:

ifconfig bridge create

A bridge interface is created and is automatically assigned a randomly generated Ethernet address.

ifconfig bridge0

FreeBSD Bridge

The maxaddr control how many MAC addresses the bridge will keep in its forwarding table and the timeout parameter control how many seconds before each entry is removed after it is last seen.

Add the member network interfaces to the bridge, the interfaces must be up:

ifconfig bridge0 addm xl0 addm xl1 up
ifconfig xl0 up
ifconfig xl1 up

The bridge is now forwarding Ethernet frames between xl0 and xl1.

To automatically create the bridge at startup, edit /etc/rc.conf :

ifconfig_bridge0="addm xl0 addm xl1 up"

If the bridge host needs an IP address then the correct place to set this is on the bridge interface itself rather than one of the member interfaces:

ifconfig bridge0 inet

To remove a interface named by interface from the bridge, enter:

ifconfig bridge0 deletem xl0

To destroy the bridge, enter:

ifconfig bridge0 destroy
Comments (1) Trackbacks (0)
  1. However, you could connect the other end of the Ethernet cable to a hub or switch that’s being used to create an Ethernet network.

Leave a comment

No trackbacks yet.