Create Multiple Queues for all IP Addresses in a network in Mikrotik Router DHCP Server

Today I encountered an interesting problem. In a friend’s network where he was using Mikrotik router, the DHCP queue was getting full. I took a look into the router console. This was the first time I got into the Mikrotik router. There is a software called Winbox for configuring Mikrotik routers.

We successfully deleted the current DHCP leases. Now the challenge was to delete all the existing queues which allocated only 5MB/s upload and download speed to all the DHCP clients. I had to delete the existing queues. Creating queues one by one for each IP is not a good option as it takes time. So I had to dig into the Internet for a while and came up with a command which creates all queues instantly.

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

This script will create 254 queues from 1 to 254. The queues names will be queue-1, queue-2, queue-3 and up to queue-254. The maximum download and upload limit assigned to each queue will be 20MB/s. Each queue will have only one IP address, for example, queue-1 will have

The benefit of this is that you can provide custom bandwidth for each IP in your network. This command is for the subnet mask For other subnets, you can increase and decrease the no. of queues.

Once you have run this command, you can configure each queue option visually without running the command line again.

You might also like: