Quickly create Queue tree

You need to create a Queue tree on per IP basis? Don't want to create a rule for every single IP on the network? Use a script! To be more precise, use this script:

Copy the following into Mikrotik terminal.

:for x from=1 to=9 do={ /ip firewall mangle add chain=prerouting src-address="192.168.1.$x" action=mark-packet new-packet-mark="192.168.1.00$x_U" passthrough=no }
:for x from=10 to=99 do={ /ip firewall mangle add chain=prerouting src-address="192.168.1.$x" action=mark-packet new-packet-mark="192.168.1.0$x_U" passthrough=no }
:for x from=100 to=254 do={ /ip firewall mangle add chain=prerouting src-address="192.168.1.$x" action=mark-packet new-packet-mark="192.168.1.$x_U" passthrough=no }
:for x from=1 to=9 do={ /ip firewall mangle add chain=postrouting dst-address="192.168.1.$x" action=mark-packet new-packet-mark="192.168.1.00$x_D" passthrough=no }
:for x from=10 to=99 do={ /ip firewall mangle add chain=postrouting dst-address="192.168.1.$x" action=mark-packet new-packet-mark="192.168.1.0$x_D" passthrough=no }
:for x from=100 to=254 do={ /ip firewall mangle add chain=postrouting dst-address="192.168.1.$x" action=mark-packet new-packet-mark="192.168.1.$x_D" passthrough=no }

This will create Mangle rules for each IP. Make sure that you use your range. Notice that i create one range in 3 lines of code in order to be able to sort them correctly.

Now, create Queue rules

/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=768000 name=UL packet-mark="" parent=Internet priority=8 queue=default;
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=16000000 name=DL packet-mark="" parent=Lan priority=8 queue=default;

And finally create the Queue tree

:for x from=1 to=9 do={/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=512k name="192.168.1.00$x_U" packet-mark="192.168.1.00$x_U" parent=UL priority=8 queue=default }
:for x from=10 to=99 do={/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=512k name="192.168.1.0$x_U" packet-mark="192.168.1.0$x_U" parent=UL priority=8 queue=default }
:for x from=100 to=254 do={/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=512k name="192.168.1.$x_U" packet-mark="192.168.1.$x_U" parent=UL priority=8 queue=default }
:for x from=1 to=9 do={/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1M max-limit=10M name="192.168.1.00$x_D" packet-mark="192.168.1.00$x_D" parent=DL priority=8 queue=default }
:for x from=10 to=99 do={/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1M max-limit=10M name="192.168.1.0$x_D" packet-mark="192.168.1.0$x_D" parent=DL priority=8 queue=default }
:for x from=100 to=254 do={/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=1M max-limit=10M name="192.168.1.$x_D" packet-mark="192.168.1.$x_D" parent=DL priority=8 queue=default }