Tuesday, December 6, 2011

How to Create a Netowrk Bridge on FreeBSD

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:
1ifconfig bridge create
A bridge interface is created and is automatically assigned a randomly generated Ethernet address.
1ifconfig 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:
1ifconfig bridge0 addm xl0 addm xl1 up
2ifconfig xl0 up
3ifconfig xl1 up
The bridge is now forwarding Ethernet frames between xl0 and xl1.
To automatically create the bridge at startup, edit /etc/rc.conf :
1cloned_interfaces="bridge0"
2ifconfig_bridge0="addm xl0 addm xl1 up"
3ifconfig_fxp0="up"
4ifconfig_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:
1ifconfig bridge0 inet 192.168.0.1/24
To remove a interface named by interface from the bridge, enter:
1ifconfig bridge0 deletem xl0
To destroy the bridge, enter:
1ifconfig bridge0 destroy

Reference:
http://blog.up-link.ro/freebsd-how-to-create-a-network-bridge/

No comments: