Tag Archives: routeros

RouterOS Bridge and Vlan Configuration for CRS devices on v6.43.X

I’ve seen a few posts recently in the MikroTik forums and MikroTik Subreddit about the confusing nature of creating native (wirespeed) vlans on the CRS range of hardware and wanted to put together a template that gives you a good idea of how these work, and what the configuration of a few different port types looks like.

While I will go into more detail on this soon – the following (designed for a CRS328-24P-4S+RM) has:

  • PC Connected ports
  • PC Connected ports with support for an inline VoIP Phone
  • Tagged/Untagged ports for Access Point administration and wireless network passthrough
  • Untagged port for a server
  • Tagged Trunk ports for passing vlans between switches
  • Adding an IP address to an Admin vlan for access to the configured switch
Continue reading RouterOS Bridge and Vlan Configuration for CRS devices on v6.43.X

Automatic bypass of hotspot devices based on MAC Address

Recently I was doing some work for a hotel that supplies a ‘Smart TV’ device with Netflix and other functions in every room. These rooms are in turn all connected to a hotspot network and the TV’s all needed to be given internet access.

As this was (as sometimes occurs) an unexpected addition to the known requirements of the installation, it fell to me to come up with a way to add these – preferably without having to have someone walk around manually collect details for 300+ TV’s.

Continue reading Automatic bypass of hotspot devices based on MAC Address

Scriptlet: Halt MikroTik scheduled scripts if multiple instances are detected.

The following script can be run in terminal (or via any automation tool that can login to your MikroTik devices via SSH) and checks for any duplicate script ‘jobs’ and kills them.

I wrote this after noticing a few of my scripts that use fetch would hang periodically and leave multiple jobs open.

#kill duplicate script jobs
:global counter
:global counter2
:foreach counter in=[/system script job find] do={
:global job [/system script job get $counter script]
:if ([:len [/system script job find where script=$"job"]] > 0 && [:len $job] > 0) do={
:put "Duplicate script running: $job - terminating all"
:foreach counter2 in=[/system script job find where script=$"job"] do={
/system script job remove $counter2
}
}
}

Continue reading Scriptlet: Halt MikroTik scheduled scripts if multiple instances are detected.

Scriptlet: Find Default Route Interface Names (and a free licence!)

Today I’m giving you the task of reviewing and improving a small script I’ve written, and one of you will win a free Level 4 RouterOS licence. 

Background: I had need of a script to find the interfaces associated with any default routes in order to create matching firewall entries, and it had to work with RouterOS v6.

This script searches through any default route (dst-address=0.0.0.0/0) and adds it to an array so long as the interface can’t already be found in the array. I don’t often use arrays in MikroTik so the first version has a search function that doesn’t loop through the array, but instead just converts it to a string again to run the find command (Line 8)

Continue reading Scriptlet: Find Default Route Interface Names (and a free licence!)

Queue Tree Mikrotik to limit total bandwidth

Hi Guys,
today i’ll show you how to manage the Mikrotik Queue Tree to limit the total bandwidth (for. example you can split a 20Mbps DSL to 4Mbps per 5 users)
In my example i’ll limit upload+download=20Mbps

First of all we need to mark the packets to be traced in the queue:

/ip firewall mangle
add action=mark-packet chain=prerouting in-interface=ether3 new-packet-mark=upload
add action=mark-packet chain=postrouting new-packet-mark=download out-interface=ether3

Then we’ll set up the queue tree:

/queue tree
add max-limit=20M name=total-traffic parent=global queue=default
add name=upload packet-mark=upload parent=total-traffic queue=default
add name=download packet-mark=download parent=total-traffic queue=default

In this case the upload and download mark will be added and when this sum reach the limit it is possibile to send an email as alert (You can find the script for checking the queue tree limit here.)

Enjoy!