How to setup a hEX router for VLAN support

Would like to use a hEX router in my home network. Initially the 5 ports will be sufficient though I expect to add 1 or 2 switches downstream of the LAN ports. These would not necessarily be mikrotik switches. The WAN port would connect to an ONT provided by my ISP. It t provides DHCP, DNS and a basic firewall. I have been guided by the forum post from @pcunite: using-routeros-to-vlan-your-network. But I cannot get it to work when VLAN mode (bridge vlan filtering) is set.

The reference provides setup scripts for a router and a switch as separate devices. The scripts appear to be adaptable to the scenario with the router and switch functions existing on the same device. My script is linked. unitary_hEX.rsc

Immediately following “/system reset-configuration” all ports are usable and can reach the internet. After the script is run and BEFORE “/interface bridge set BR1 vlan-filtering=yes” is executed, I can reach the internet from the management port, ether2. However, other connected devices are not reachable. Once BR1 filtering is set to yes I cannot reach the hEX via any port. WinBox occasionally will report seeing the device at 192.168.0.1. However, even with the laptop connected to port 2 and manually set to ip 192.168.0.20/24 and gateway to 192.168.0.1 WinBox still cannot connect.

So the questions are:

  1. Can the hEX device even support this setup?
  2. What errors have I made in my script?
  3. I potentially have access to a CRS326. As it also has both router and switch on board, “similar” to the hEX, might a functioning setup script for the hEX also work for the CRS326?
  4. Would a better choice be to use the hEX purely as a router and the CRS326 purely as a switch?
  5. If the CRS326 is used purely as a switch, Would it be better to use SwitchOS which exists on board the device rather than RouterOS to manage the switch functions?

Though I have done network setup and management with other brands of routers & switches in a few small offices, I am not a professional. I have spent many hours reading the mikrotik support documents and perusing this forum. Caffeine levels are borderline toxic. But sadly I can’t seem to make this work. Any help would be greatly appreciated.

Yes, its not a plugNplay router.
I highly suggest taking ether5 off the bridge and doing all the configuration from this safe spot.

call ether5 name=OffBridge5
give it an IP address
add address=192.168.75.1/30 network=192.168.75.0
add OffBridge5 interface to the LAN interface list and trusted or management interface list if you have one.
Plug your laptop into ether5, username and password should get you into the router, after having changed IPV4 settings to 192.168.75.2

Continue config changes from here…

No it is not! The learning curve is way steeper. :wink:

The OffBridge5 port is exactly what I needed for the work on configuration. I should have seen that. Tunnel vision.

Thanks

  1. Yes it can, but be aware that hEX can route only at about 250-300 Mbps according to Mikrotik web page.

  2. CRS lineup of the devices are meant to be switches (except for the new CRS418 device) so I would suggest you to use it as a switch running RouterOS. BUT, and that is A BIG BUT, you can use CRS326 as an router but performance will be poor.

  3. If you want to increase your internet speed in the future I recommend you to use something else as a router and CRS as the switch.

  4. ROS is much more powerful OS and in my opinion if you want to learn ROS leave your switch on ROS. SWOS will do the job but it’s only manageable from web browser and not as powerful as ROS.

Thanks. That is helpful.

Any thoughts on router pairings with the CRS? This is really an effort to learn RoS. Began with the hEX as it was given to me by a friend who found the learning curve too steep. Became a challenge for me.

If I go on to acquire the CRS326 I will look for a router to pair with it. Do you have suggestions for appropriate choices. This home network would not build to something more.

What is your ISP providing as speed? For home use, do not buy fan cooled equipment. It’s no fun.

It appears LAN is not defined as an Interface list hence Firewall Input rules won’t work, so you lock yourself out?

#/interface list add name=LAN (seems to exist by default - use existence check?)

This is disabled, but you do not add a bridge to a list, why is that?

#add interface=BR1         list=LAN  (seems to exist by default - use existence check?)

Then you drop everything not coming from LAN, so any other requests by follow up rules are simply not processed anymore, hence, YOU’RE OUT.

add chain=input in-interface-list=!LAN action=drop comment="Drop all not coming from LAN"

You would need something like this after the drop invalid rule:

add action=accept chain=input comment="admin access" in-interface-list=\
    MGMT src-address=192.168.0.0/24

Reboot your router after config done, because my experience tells me DHCP won’t work without reboot.

Without knowing your network needs current and future hard to give advice.
Personally get an RB5009 and you may not need any CRS…

But as stated you inquire about CRS but dont give us any meat with which to assess if its needed or not.

@liviu2024 Thanks. Current speed from ISP is 1G. Faster is possible for a cost.

/system reset-configuration or pressing the reset button until the USR light flashes while powering up the router leaves the LAN list with bridge as member & the WAN list with ether1 as member created by default. Hence, I have commented out those lines in the script as they would fail. Perhaps an existence check would be appropriate here.

You may not have seen my updated script (same link) which adds that explanation.

Have added an input rule that allows Admin access. However, when bridge vlan filtering is on, nothing gets through on the ports attached to the bridge. @anav’s suggestion has worked well to allow access to the router even with bridge vlan filtering on. My problems are deeper.

@anav. This is a learning exercise on a home network. I currently have ~16 wired drops and 2 wifi access points. I don’t like wifi but there are two areas that I simply cannot wire without significant costs and labor. Wife won’t allow cable loops along the floor or tacked to the wall. I currently support this with plug-n-play hardware that is getting old. So have setup a small ‘lab’ network to to educate myself. I don’t want to disturb the current home network until I’m sure I can pull it off without difficulty.

The home network has 1G optical in from the ISP. That can be upgraded with a check. There are two video feeds running over the network. I also spend half my work hours at home. That involves large file transfers up and down. Local data including video & audio are stored on a NAS. The number of users is usually 2 but occasionally there may be 8 - 10 users connected within the house. These can be work related or casual. Rarely gaming. (a visiting relative) I do not at present allow externally originated traffic into the network. Am too paranoid. The use of a firewire vpn for access is intriguing, however.

The RB5009 looks very interesting. I think you are implying that it would serve as both router and switch and presumably a 2nd could be daisy chained as purely a switch.

fwiw. The office setting at work could benefit from an upgrade to it’s network. If this works well at home I may be able to shift that network to a similar setup.

The RB5009 is an excellent router, but it is wasted as a switch for 1 GB.
You could save some 100 bucks using the L009 as switch (connected via a DAC to the RB5009), while still being capable of acting as a router in case of emergency, see:

If you have 1 Gig connection with possibility to upgrade to even faster speeds in the future then IMHO RB5009 is a no brainer. Buy SFP+ DAC and connect your CRS with RB5009. If you want to spend more money buy PoE version of RB5009, that way you have PoE ports and a lot of 1 gig ports on your CRS. Also you can run containers on RB5009 if you want.

@DocPneumo, I would not use default config and build over. Just wipe the config off and start from scratch. Is not that difficult.

Have done just that. It works!!

Took a bit of fiddling and recognition of a couple of Gotchas. @liviu2004, Your suggestion that the router should be rebooted after the DHCP server is setup was spot on. I also found that my setup script needed pauses to complete successfully. The effect on overall completion time is not enough to be a problem. I have pushed the latest version of my script to the link given in my original post.

I did encounter an unexpected behavior when trying to change the ether5 interface name to OffBridge5:

/interface set [find where interface=ether5] name=OffBridge5

on the command line changes the name of ether1 !!! And complains “failure: already have interface with such name”. That is easily avoided or fixed by using WinBox. So have not pursued the issue further. Kind of wonder, however, if this behavior is

  • my error
  • something persistent after:
    /system reset-configuration keep-users=yes no-default=yes
  • a true bug (seems rather unlikely)

I could provide detailed info if someone is interested. Likely to come slowly as I have some commitments over the next 2 weeks.

Thanks to all for your help.

The error you got is "strange":

Before running this execute these at the command line:
#               /ip address
#               add interface=ether5 address=192.168.75.1/30 network=192.168.75.0
#
#               /interface bridge port 
#               remove [ find interface=ether5 ]
#
#       Then in WinBox change interface ether5 name to: OffBridge5
#       I would do that with:
#               /interface set [find where interface=ether5] name=OffBridge5
#       but that changes ==> ether1 <== name  rather than ether5 !!!

Maybe there is a need of a longer delay after removing the interface from bridge before renaming it.
But it should be possible to rename it before removing it and - personally - I would use /interface ethernet set ... (but that shouldn't make a difference).
Loosely they are steps B0, B1 and B3 here:

They did work in a GNS3 test.

hi, i dont't suggest that, that's why many of many routers mirkotik, has been bad configured, normally end without firewall rules, and completely open to internet, to be dns ddos vector or part of a botnet...

it's better make a little of reverse engineering and understand what do this, what do that, and then, start modifing, the help.mikrotik has 3 articles to first use, and explaining how to configure from 0, with securing your router explain all basics to firewall meaning.