Page 1 of 1

How to use Mikrotik router as a “switch”?

Posted: Tue Jan 15, 2019 9:05 pm
by BostjanC
I want to use Mikrotik router as a “switch”.

I’ve tried several instructions I’ve found on the net, but at the end I had to reset the Mikrotik router several times so far (by holding down the reset button while powering it on).

I have one existing router xy brand with IP 192.168.1.1, which is also a gateway. It is also a DHCP on my 192.168.1.1/24 network.

I just want this MT router to have an IP 192.168.1.2 and to be a “switch” (bridge?) to other wired and wireless devices connected to it – so that they can talk to any device on my 192.168.1.1/24 network.


How to do that and not to reset it?

Thanks.

Re: How to use Mikrotik router as a “switch”?

Posted: Tue Jan 15, 2019 9:27 pm
by fbuster
depending on your model it can be a 4port or 5port switch
Here's a sample config:
/interface bridge
add name="My bridge"
/interface ethernet
set [ find default-name=ether1 ] name=ether1-To-modem
set [ find default-name=ether3 ] master-port=ether2
set [ find default-name=ether4 ] master-port=ether2
set [ find default-name=ether5 ] master-port=ether2
/interface bridge port
add bridge="My bridge" interface=ether1-To-modem
add bridge="My bridge" interface=ether2

Re: How to use Mikrotik router as a “switch”?

Posted: Tue Jan 15, 2019 9:33 pm
by BostjanC
It is hAP ac².

Your code just puts all interfaces to the bridge.
What about IP?

Re: How to use Mikrotik router as a “switch”?

Posted: Tue Jan 15, 2019 9:41 pm
by fbuster
Its a switch now , it doesnt need ip.
switching is layer 2 (mac)

Re: How to use Mikrotik router as a “switch”?

Posted: Tue Jan 15, 2019 9:51 pm
by BostjanC
Its a switch now , it doesnt need ip.
switching is layer 2 (mac)
What about DHCP?

If I want to update it, it says ERROR: could not resolve dns name.

Re: How to use Mikrotik router as a “switch”?

Posted: Tue Jan 15, 2019 11:21 pm
by zandhaas
I have a HAP ac2 and used the procedure described in the below post to configure it as an AP.

viewtopic.php?f=13&t=143446

Re: How to use Mikrotik router as a “switch”?

Posted: Wed Jan 16, 2019 8:24 am
by baragoon
It is hAP ac².

Your code just puts all interfaces to the bridge.
What about IP?
add dhcp client to bridge

Re: How to use Mikrotik router as a “switch”?

Posted: Wed Jan 16, 2019 4:18 pm
by mkx
Cook-book recipe by @fbuster is good for ROS version<6.41. For newer version, the recipe would be:
/interface bridge
add name=bridge
/interface bridge port
add bridge=bridge interface=ether1
add bridge=bridge interface=ether2
add bridge=bridge interface=ether3
add bridge=bridge interface=ether4
add bridge=bridge interface=ether5
# optionally: add bridge=bridge interface=wlan1
# etc.
#
#  For static IP address:
/ip address 
add address=192.168.1.2/24 interface=bridge network=192.168.1.0
# for internet access - ROS updates etc.
/ip route
add gateway=192.168.1.1
/ip dns
set servers=192.168.1.1 # or some other DNS server
#
# To run DHCP client, set thus instead:
/ip dhcp-client
add interface=bridge

Re: How to use Mikrotik router as a “switch”?

Posted: Wed Jan 16, 2019 4:23 pm
by nescafe2002
Note that this is done automatically if you reset the device to CAPs mode - even if you don't have wireless interfaces or a CAPsMAN controller.

Keep holding the reset button for 5 more seconds, LED turns solid, release now to turn on CAPs mode (total 10 seconds).