How to add multiple items to a list?

Ever wondered how to add many items to a list? This could be user:password pairs, IP addresses, PPPoE interfaces or anything other you like.

Let’s try to add 100 PPP users to the /ppp secret submenu:

/ppp secret { :for i from=1 to=100 step=1 do={add name=(ex . $i) password=$i}}

Note the expression (ex . $i). We are using concatenation operator “.” to make usernames like ex1, ex2, etc.

:?: How would one do this for bandwidth management and simple queues?

what kind of queues would you like to add in this way?
if you want to set the same bandwidth to specific subnet you can use PCQ queuing. See the manual for more information.

Edgars

HI, I would like to add all of the ip’s and create the simple ques via some scripting. I have 3- /24 /23 /20 subnets to add to the simple queue list. My thought is to add the ip’s then edit the queues later for specific info.

Is there some scripting available to allow me to do this?

Thanks in advance,

Sever

there isn’t ready script for this. But as said you can use PCQ. See this example:
http://www.mikrotik.com/Documentation/HowTo.html#How_p2p (Using PCQ)
Instead of that P2P marking you should mark your subnets. Each group should have different mark-flows (to determine the necessary speed for them).

Edgars

Hi,

I guess I had to write my own… I love my mikrotiks! :sunglasses:

\

jul/16/2004 20:12:57 by RouterOS 2.7.20

/queue simple { :for i from=1 to=254 step=1 do={add name=(in . $i) src-address=0.0.0.0/0 dst-address=(192.168.1. $i . /1) dst-netmask=255.255.255.255 interface=in limit-at=0 queue=default priority=8 max-limit=384000 disabled=no}

Sever

  1. I wonder why are you setting dst-netmask twice (separately and in dst-address)

  2. Those who use 2.8, remember that this is not the correct syntax there

The /1 for subnet is not setting subnet but rather the number of times that the address is printed before it moves to the next number. I tried a /32 there but ended up with 32 .1’s and 32 .2’s and 32 .3’s and 32 .4’s I found with the /1 it only did one ip address for each. I also found if I left out the /1 and only left the $i , then i got an error for invalid IP.

Go figure…

Thanks in advance,

Sever

:put (192.168.1.12 . “/32”)
192.168.1.12/32