Yesterday, I wrote a short note about VLAN interfaces. Today, I want to write a short entry on how to bridge Ethernet interfaces to keep things complete as I need to mention about creating ACCESS port to tag packets on desired interface.
Preparations
At first install utilities needed to configure the Ethernet bridge in Linux:
$ sudo apt-get install bridge-utils
Temporary solution
Create bridge br0 (name could be different):
$ sudo brctl addbr br0
To create ACCESS port on eth2 interface with VLAN 700 (available on eth1 interface) you need to bridge eth2 and eth1.700 interfaces:
$ sudo brctl addif br0 eth2
$ sudo brctl addif br0 eth1.700
Bring interface up:
$ sudo ifconfig br0 up
To list interfaces attached to the bridge execute command:
$ sudo brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no eth2
eth1.700
To list learned MAC addresses on the bridge execute command:
$ sudo brctl showmacs br0
port no mac addr is local? ageing timer
3 08:00:27:2c:a4:69 no 0.02
3 08:00:27:a6:a6:fc yes 0.00
2 08:00:27:a7:37:c1 no 0.53
2 08:00:27:b9:55:fb yes 0.00
To remove interface from the bridge execute command:
$ sudo brctl delif br0 eth9
To delete bridge execute commands:
$ sudo ifconfig br0 down
$ sudo brctl delbr br0
Permanent solution
To create bridge at the boot time you need edit /etc/network/interfaces file and add similar configuration:
auto br0
iface br0 inet manual
bridge_ports eth1.700 eth2
Notes
Make sure that all used interfaces are UP and running.