[minipost] Mikrotik QoS Prioritization Example

If you ever hosted any internet service at home and/or had some network application using your Internet connection upload and disturbing your other activities, one very common example (but not actually my situation) is when running torrent traffic making your Internet games lag because uncontrolled torrents take away the upload bandwidth. Then you should consider making the applications you want to have priority (games, voice, video) against the other not so sensitive stuff (torrent, http, etc… ).

In theory, you need to prioritize different packets leaving from your router for the Internet to solve this situation. So lets do this on an example home network I created very simply for the sake of this article. On the next picture below, you see a typical home network. With example 100Mbit LAN and 3Mbits Internet upload.

Example Topology

Also with no other traffic, when someone tries to download a file from any LAN system, he can use the full speed. As visible below:

1_FullUpload

Uploading file from LAN system

Ok, now what happens when both the internal users and the networkgeekstuff.com server starts to send packets at full speed to the internet? Well, there is no priority to any of the traffic streams, therefore the router will make both share the upload equally.

Equal_upload

From a practical example test again downloading files from both networkgeekstuff.com and a random LAN system:

2_EquapSharedUpload_TestFile

Uploading file from LAN system -> equal share of uplink

2_EquapSharedUpload_TestFileFromNetworkGeek

Uploading file from networkgeekstuff system -> equal share of uplink

Creating priority for upload traffic on Mikrotik RB450

Ok, now I have showed you the problem, now for the solution. From the 3128kbps upload traffic, I would like to make these statements implemented:

  • Networkgeekstuff.com server can make full use of the upload when no other traffic is using it
  • Networkgeekstuff.com server has a reservation of 320kbps, this is exclusive for it.
  • Other LAN systems have priority over Networkgeekstuff.com and can fully use whole upload bandwidth.

Configuration is three step process, classify->mark->prioritize:

1) We have to classify the two types of traffic we want to manipulate

2) Then we have to mark the packets in each connection

3) Now we create a priority tree

Explanation is definitely needed on the 3rd part. As you see we give priority=1 (best) to the LAN marked packets and priority=8 (worst) to the networkgeekstuff.com upload traffic. Additionally you can notice that I have given the networkgeekstuff.com a reservation by using limit-at=320k, this means that there is no limit applied to the traffic if the traffic only uses less than 320kbps of bandwith. But also the max-limit=3128k tells the router to limit this traffic for maximum bandwidth (yes, it doesn’t make sense, but this parameter has to be set otherwise the configuration line is not actually working).

Results of the implementation

If you didn’t made a mistake, right now the traffic should behave a little like this:

Prioritization_upload

Also the practical tests I managed to get and I hope they are self-explanatory, just notice how networkgeekstuff.com upload only gets around 40kbps and the other upload gets almost all remaining bandwidth.

3_PrioritySharedUpload_TestFile

Uploading file from LAN system -> system gets priority on uplink

3_PrioritySharedUpload_TestFileFromNetworkGeek

Uploading file from networkgeekstuff system -> limited priority to only reserved 320bps (40kBps)

More reading on Mikrotik QoS

I must say that I admit to not providing much explanation on why the configuration is the way I made it, the point is that Mikrotik guys made a very nice explanations on how to do QoS on their router themselves that is available behind these links:

Summary

Again, I hope this helps anyone a little. I didn’t wanted this to become an extensive explanation into Mikrotik QoS as there are better sources on this purpose available (as mentioned on the above section). But it can serve as a quick reference to solve one very common situation on small networks sharing both users and hosted services.

If you enjoyed this blog, please share.

About Peter Havrila

Author’s Profile