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:
1 | ifconfig bridge create |
A bridge interface is created and is automatically assigned a randomly generated Ethernet address.
1 | ifconfig bridge0 |
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:
1 | ifconfig bridge0 addm xl0 addm xl1 up |
2 | ifconfig xl0 up |
3 | 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 :
1 | cloned_interfaces= "bridge0" |
2 | ifconfig_bridge0= "addm xl0 addm xl1 up" |
3 | ifconfig_fxp0= "up" |
4 | 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:
1 | ifconfig bridge0 inet 192.168.0.1/24 |
To remove a interface named by interface from the bridge, enter:
1 | ifconfig bridge0 deletem xl0 |
To destroy the bridge, enter:
1 | ifconfig bridge0 destroy |
Reference:
http://blog.up-link.ro/freebsd-how-to-create-a-network-bridge/
No comments:
Post a Comment