How to use Mikrotik router as a “switch”?

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.

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

It is hAP ac².

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

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.

I have a HAP ac2 and used the procedure described in the below post to configure it as an AP.

http://forum.mikrotik.com/t/simple-ap-bridge-setup/126375/1

add dhcp client to bridge

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

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).

It works on hex s, on all ports, but doesn’t work on sfp1 port

i try it and worked perfectly

I noticed that you configured all 5 ethernet ports as part of the bridge - including “ether1”.
However, in the official documentation - “ether1” is missing - see:
https://help.mikrotik.com/docs/spaces/ROS/pages/328068/Bridging+and+Switching#BridgingandSwitching-BridgeHardwareOffloading
The code in the documentation is:

/interface bridge
add name=bridge1
/interface bridge port
add bridge=bridge1 interface=ether2 hw=yes
add bridge=bridge1 interface=ether3 hw=yes
add bridge=bridge1 interface=ether4 hw=yes
add bridge=bridge1 interface=ether5 hw=yes

So what is the difference and why is it important to configure “ether1” ?

If device is used as router (as in your linked documentation), ether1 is not in switch (which in Mikrotik is the same as bridge) because it is used as interface to another devices/networks. If device is used as switch only (as OP), ether1 can be included in switch or left alone.

What kind of switch, like an unmanaged switch with one flat network OR switch with multiple vlans?