This article will give an example of how to setup mikrotik bridge on routerboard. this technique can be applied on mikrotik devices that has more than one interfaces. Before implementing this tutorial, make sure you understand how switch works.
ok lets start. prerequisite
- Make sure feature bridge is supported on your routerOS
- your device has more than one interface
routerboard is looks like a switch, why do we need to make a bridge? can we just plug a cable on and it works like ordinary switch?
did you know that on each interface of your routerboard there is a MAC address associated with it? yes, on each port/interface. why on each port? because routerboard is basically a router, and router is connecting networks, and each interface will connect to a network, and each interface on the network is acting as a gateway for clients in the network. therefore each interface needs an IP address (layer3) and consequently they need layer 2 addressing as well.
Because the basic design of routerboard is a router, and our objective is to make a layer2 network (network with a switch), we need a bridge feature. with bridge feature, it is possible to combine several ports into one segment. therefore, all ports that are put into a bridge will become flat like normal switch.
can you show me how to create a bridge with 3 ports? the steps are very simple:
- create a bridge (this interface will become a master interface). lets say we create a bridge named bridge1:
/interface bridge add name=bridge1 disabled=no protocol-mode=rstp - put ports (interfaces) into the bridge (these interfaces will become slave interfaces). these interfaces now is called port, just like ordinary switch. example: ether1-ether3 will be put into the bridge1:
/interface bridge port add bridge=bridge1 interface=ether1
/interface bridge port add bridge=bridge1 interface=ether2
/interface bridge port add bridge=bridge1 interface=ether3 - Bridge is flexible feature, we can put other layer2 technologies into the bridge. (these interfaces will become slave interfaces too). for example wifi:
/interface bridge port add bridge=bridge1 interface=wlan1
what happens to the MAC address on interfaces that are joined to bridge? because bridge is a layer2 device, the MAC address on each interface will be ignored
Could you please explain about master and slave interfaces?
see this article
how to check MAC table/see MAC learning process?
You can just observe host tab on bridge menu. or you can display the table using CLI: /interface bridge host print
the picture below is the example of MAC table on mikrotik bridge