blog.up-link.ro
18Jun/100

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 :

cloned_interfaces="bridge0"
ifconfig_bridge0="addm xl0 addm xl1 up"
ifconfig_fxp0="up"
ifconfig_fxp1="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 192.168.0.1/24

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

ifconfig bridge0 deletem xl0

To destroy the bridge, enter:

ifconfig bridge0 destroy
Print This Post Print This Post
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


*

No trackbacks yet.