Community discussions

MikroTik App
 
ningbeheer
just joined
Topic Author
Posts: 6
Joined: Tue Jun 13, 2017 12:55 pm

Add adresses with loop script

Tue Jun 13, 2017 12:58 pm

Hi all,

I have this script:

:for e from 101 to 150 do={
/ip address add address=("10.150." .$e .".1/24") \
interface=($e)
}

When i run it thru terminal i get the error invalid value for argument address

Does anyone have a clue what i am doing wrong?

Thank you very much,
 
gustavomam
Trainer
Trainer
Posts: 287
Joined: Tue Jul 23, 2013 6:29 pm
Location: Spain
Contact:

Re: Add adresses with loop script

Wed Jun 14, 2017 9:46 am

Your script works.

Do you have the correct name of your interfaces?.

I mean interface name 101,102,103...150 ?
 
ningbeheer
just joined
Topic Author
Posts: 6
Joined: Tue Jun 13, 2017 12:55 pm

Re: Add adresses with loop script

Wed Jun 14, 2017 9:49 am

Hi,

Yes these are vlan interfaces and are called 101, 102, 103 etcetera. When i enter the address by hand in the CLI it works:

[admin@MikroTik] > /ip address add address=10.150.101.1/24 interface=101
[admin@MikroTik] >
 
gustavomam
Trainer
Trainer
Posts: 287
Joined: Tue Jul 23, 2013 6:29 pm
Location: Spain
Contact:

Re: Add adresses with loop script

Wed Jun 14, 2017 10:44 am

Hi.

I have test your script whit 3 interfaces and works
:for e from 101 to 103 do={
/ip address add address=("10.150." .$e .".1/24") \ 
interface=($e)
}
I tested vlan and bridge interface.

What RouterOs version do you have?, is it the latest?
 
ningbeheer
just joined
Topic Author
Posts: 6
Joined: Tue Jun 13, 2017 12:55 pm

Re: Add adresses with loop script

Wed Jun 14, 2017 12:28 pm

This is strange. Yes i have upgraded to the latest version 6.39.2. Absolutely no clue why this is going wrong. I will reset and try again.

Thnx

Who is online

Users browsing this forum: No registered users and 28 guests