Make sure all your network cards are working nicely and are accessible. If so, ifconfig will show you the hardware layout of the network-interface. If you have problems making your cards work please read the Ethernet-HOWTO at http://www.linuxdoc.org/HOWTO/Ethernet-HOWTO.html. Don't mess around with IP-addresses or net-masks. You will not need it, until you bridge fully operational an up.
After you did the steps mentioned above a modprobe -v bridge should show no errors. You can check the success by issuing a cat /proc/modules. Also for each of the network cards you want to use in the bridge the ifconfig whateverNameYourInterfaceHas should give you some information about the interface.
If your bridge-utilities have been correctly built and your kernel and bridge-module are OK, then issuing a brctl should show a small command synopsis.
root@mbb-1:~ # brctl commands: addbr <bridge> add bridge addif <bridge> <device> add interface to bridge delbr <bridge> delete bridge delif <bridge> <device> delete interface from bridge show show a list of bridges showbr <bridge> show bridge info showmacs <bridge> show a list of mac addrs setageing <bridge> <time> set ageing time setbridgeprio <bridge> <prio> set bridge priority setfd <bridge> <time> set bridge forward delay setgcint <bridge> <time> set garbage collection interval (11) sethello <bridge> <time> set hello time (12) setmaxage <bridge> <time> set max message age (13) setpathcost <bridge> <port> <cost> set path cost (14) setportprio <bridge> <port> <prio> set port priority (15) stp <bridge> <state> {dis,en}able stp (16) |
The corresponding "shutdown" command is brctl delbr bridgename.
Caution |
brctl delbr bridgename will only work, if there are no more interfaces added to the instance you want to delete. |
The corresponding command to tale a interface out of the bridge would be brctl delif bridgename device
Example 7. Output Of brctl show
root@mbb-1:~ # brctl show bridge name bridge id stp enabled mybridge1 0000.0800062815f6 yes |
Example 8. Output Of brctl showbr bridgename
root@mbb-1:~ # brctl showbr mybridge1 mybridge1 bridge id 0000.0800062815f6 designated root 0000.0800062815f6 root port 0 path cost 0 max age 4.00 bridge max age 4.00 hello time 1.00 bridge hello time 1.00 forward delay 4.00 bridge forward delay 4.00 ageing time 300.00 gc interval 4.00 hello timer 0.84 tcn timer 0.00 topology change timer 0.00 gc timer 1.84 flags eth0 (1) port id 8001 state forwarding designated root 0000.0800062815f6 path cost 100 designated bridge 0000.0800062815f6 message age timer 0.00 designated port 8001 forward delay timer 0.00 designated cost 0 hold timer 0.84 flags eth1 (2) port id 8002 state forwarding designated root 0000.0800062815f6 path cost 100 designated bridge 0000.0800062815f6 message age timer 0.00 designated port 8002 forward delay timer 0.00 designated cost 0 hold timer 0.84 flags |
Example 9. Output Of brctl showmacs bridgename
root@mbb-1:~ # brctl showmacs mybridge1 port no mac addr is local? ageing timer 1 00:10:4b:b6:c6:e4 no 119.25 1 00:50:04:43:82:85 no 0.00 1 00:50:da:45:45:b1 no 76.75 1 00:a0:24:d0:4c:d6 yes 0.00 1 00:a0:24:f0:22:71 no 5.81 1 08:00:09:b5:dc:41 no 22.22 1 08:00:09:fb:39:a1 no 27.24 1 08:00:09:fc:92:2c no 53.13 4 08:00:09:fc:d2:11 yes 0.00 1 08:00:09:fd:23:88 no 230.42 1 08:00:09:fe:0d:6f no 144.55 |
The Linux implementation currently sets the path cost of all eth* interfaces to 100, the nominal cost for a 10Mbit connection. There is unfortunately no easy way to discern 10Mbit from 100Mbit from 1Gbit Ethernet cards, so the bridge cannot use the real interface speed.
The standard configuration should consist of:
Create the bridge interface.
root@mbb-1:~ # brctl addbr mybridge |
Add interfaces to the bridge.
root@mbb-1:~ # brctl addif mybridge eth0 root@mbb-1:~ # brctl addif mybridge eth1 |
Zero IP the interfaces.
root@mbb-1:~ # ifconfig eth0 0.0.0.0 root@mbb-1:~ # ifconfig eth1 0.0.0.0 |
Put up the bridge.
root@mbb-1:~ # ifconfig mybridge up |
Optionally you can configure the virtual interface mybridge to take part in your network. It behaves like one interface (like a normal network card). Exactly that way you configure it, replacing the previous command with something like:
root@mbb-1:~ # ifconfig mybridge 192.168.100.5 netmask 255.255.255.0 up |
A more sophisticated setup script you will find at Example 16.
Important: If you get the terrible experience of a frozen system or some nasty behavior of your nicely shaped linux box at
please try (after the reboot of the system if necessary) before starting any bridge stuff at all a
root@mbb-1:~ # ifconfig ethn 0 0.0.0.0If again your system is frozen it's you NIC's driver you have to blame, not the bridging code.
root@mbb-1:~ # ifconfig ethn promisc up