Site icon Shaharia's Blog

MikroTik Simple Queue Script – Add All IP at Once

Mikrotik Simple Queue Script

Mikrotik Simple Queue Script

If you have a MikroTik router, then it’s sometimes difficult to create simple queue with one by one IP address. It’s a difficult task. Also if you need to change bulk IP address in the queue, it sounds more terrific. So I wrote this article to make your life easier to maintain your MikroTik router easily. To add all IPs in your MikroTik Simple queue, just open your MikroTik RouterOS terminal and run the following script.

What is MikroTik Script?

MikroTik is one of the most used router for office and internet service providers that provides internet connectivity from provider to client. It’s massively customizable and every MikroTik router comes with an operating system that called RouterOS. You can save lots of time by creating and using MikroTik script that would do most of the tasks when you will run that on command line inside RouterOS.

MikroTik Simple Queue

To limit data rate or bandwidth for any specific IP address, MikroTik provides simple queue feature where you can easily limit bandwidth. If you want to provide a smooth bandwidth for every users in your network, you have to mastering yourself with this simple queue feature. You can limit, set priority, idle and busy time bandwidth utilization and so much more. Even by using MikroTik burst in queue system, you can give good user experience with lower bandwidth. But it’s not a just so simple as you think.

You have to learn how MikroTik script works and how simple queue feature works inside MikroTik RouterOS. Then you calculate your total upstream bandwidth, then build a queue based on your client group, implement and test them until all of your users enjoy fantastic internet using experience.

Queue Interface in MikroTik

MikroTik Queue Management Interface

To add a single IP address inside the MikroTik queue, you have to get a clear understanding about all the options and how it works. It’s not possible to discuss all those options in a single article but I will try to cover the primary fields and options for creating a single MikroTik queue for an IP address.

Available options to create a simple queue

This above 5 fields are important and if you understand the role and usage of those 5 fields you can setup MikroTik queue per IP address. Also from the right side you can write comment for this specific queue. For example, it’s a “Bob’s office Laptop”. It’s pretty useful.

Adding multiple IP in MikroTik simple Queue

Sometimes you can realize that to setup typically 253 queues individually is tough. It’s really tough for me and for most of the MikroTik expert. Also if you can manage your time to do that, think if you need to change the bandwidth package for your user or need to upgrade or downgrade bandwidth for all the IP address, then it’s a mess to do that manually. So what’s the easy way.

Fortunately, you are lucky because of MikroTik has it’s simple queue scripts to manage all the things for you. You can easily write a MikroTik script where you will make a loop for all IP address in your network and it will execute that specific commands in your script for all the IP address in less than a second.

MikroTik Simple Queue Scripts for all IP address

To add all IPs in your MikroTik Simple queue, just open your MikroTik RouterOS terminal.

MikroTik RouterOS Terminal

Commands to add all IP in queue

Here is the simple command to add all IP in MikroTik simple queue. In the MikroTik terminal, just run the following code. But before copy and paste the code, first copy the code in a notepad and change the IP address range and bandwidth values as you want based on your policy. Then run that command inside MikroTik terminal.

:for x from 1 to 254 do={/queue simple add name="queue-$x" max-limit=2M/2M target="192.168.1.$x"}

Video Tutorial

https://blog.shaharia.com/wp-content/uploads/MikroTik_Simple_Queue_Script_Add_All_IP.webm
MikroTik Simple Queue Script for all IP address

Explanation of the commands and scripts

Here in max-limit variable you can define max speed upload/download. For example I used 2M for both download and upload. This simple loop script will easily add all of your IPs in your MikroTik Queue. After that you can manually modify when you need for any specific IP. This script will save you lots of time as it did for me. This is compatible with Mikrotik all version router board including v6.

As per the above command, 1 to 254 meaning the queue will be generated till 254. 192.168.1.$x is your IP address format. It can be different as per your setup. And max-limit=2M/2M meaning upload/download (2M/2M). Write a comment, if you don’t understand this and I will be happy to assist. Also if you still can’t execute this, provide your IP series, bandwidth upload/download limit so I can generate a script for you.

Scripts compatibility with MikroTik Model & RouterOS version

There are lots of models and versions of MikroTik and RouterOS available publicly. So I have tasted this MikroTik Simple Queue scripts on the following models –

Also it’s compatible with RouterOS upto v6.

Conclusion

Mikrotik made it easy to manage and limit bandwidth. To write queue script for mikrotik should not be any harder tasks for anybody. You can learn more about Mikrotik terminal from Mikrotik website. Effective bandwidth management is important to provide your user a consistent internet connectivity.

YouTube Video: Mikrotik Script

Please write your comment in the comment box below if this works for you. And it would be helpful for others. I hope, this MikroTik bandwidth management script will also help you in all the way you need.

Read more articles on MikroTik

MikroTik Simple Queue Script – Add All IP at Once

If you have a MikroTik router, then it’s sometimes difficult to create simple queue with one by one IP address. It’s a difficult task. Also if you need to change bulk IP address in the queue, it sounds more terrific. So I wrote this article to make your life easier to maintain your MikroTik router easily. To add all IPs in your MikroTik Simple queue, just open your MikroTik RouterOS terminal and run the following script. What is MikroTik Script? MikroTik is one of the most used router for office and internet service providers that provides internet connectivity from provider to client. It’s massively customizable and every MikroTik router comes with an operating system that called RouterOS. You can save lots of time by creating and using MikroTik script that would do most of the tasks when you will run that on command line inside RouterOS. MikroTik Simple Queue To limit data rate or bandwidth for any specific IP address, MikroTik provides simple queue feature where you can easily limit bandwidth. If you want to provide a smooth bandwidth for every users in your network, you have to mastering yourself with this simple queue feature. You can limit, set priority,…

MikroTik Port Forwarding (NAT) & Access from Internet

MikroTik is one of the best and most used router worldwide. Managing internet for office and internet service provider is the primary feature of MikroTik Router. MikroTik has lots of features that is required to manage your network connectivity. MikroTik port forwarding is one of the best features for network administrator. It helps network admins to forward any traffic on any port on MikroTik to another IP address. Sometimes people use this to increase security, access local network from internet using public IP and such. This article will also help you to port forwarding MikroTik for web server. If you concepts become clear then you can also fix some weird problem like Router is behind a NAT. Remote connection might not work. What is MikroTik router? Before moving further you have to understand what is MikroTik. MikroTik is a very advanced router to manage your network connectivity between upstream and your local network. So you can access internet without no issue. Due it’s lots of flexibility, customization and features it’s one of the best choice for internet service providers (ISP) and small and mid level office. Accessing MikroTik through Winbox Usually every MikroTik has it’s own router operating system that…

Some Important MikroTik Tips and Tricks

Port Forwarding to local IP/PORT Type the following value into a Terminal window to enter this port forwarding rule. bash /ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-port=80 in-interface=ether1-gateway protocol=tcp to-addresses=192.168.1.20 to-ports=80 In the above MikroTik NAT forwarding rule add through MikroTik RouterOS terminal what I am doing with the above command?We are just forwarding any kinds of request to our main IP in 80 and forwarding that connection to 192.168.1.20 ip which is in my local network and port 80 will be used from 192.168.1.20 for that request. Read some more interesting Mikrotik tips & tricks from here – MikroTik Simple queue script – add all IP MikroTik NAT Port Forwarding – Access local pc from internet