generate IP-addresses

Hi there,

I am trying go generate IP-adresses in console. what is wrong in this line?

[admin@mikrotik] > :for i from=2 to=254 do={/ip address add address=192.168.0.$i/24 interface=Lan}

Try with :

:for i from=2 to=254 do={/ip address add address((“192.168.0.”) . $i . (“/24”)) interface=Lan}


-RoddyZ

Thanks RoddyZ:

But i get “invalid expression” :cry:

This code work, you must put a blank space where i use

:for i from=2 to=254 do={/ip address add address((“192.168.0.”).$i.(“/24”)) interface=Lan}

-RoddyZ

I solved it :slight_smile:
the code is:

 :for i from=2 to=254 do={/ip address add address=(192.168.0. . $i . "/24" ) interface=Lan}

It was the space that did it :slight_smile:) “address=(192.168.0.[space].[space]$i[space].[space]”/24"

Thanks RoddyZ..
Im figured that out :slight_smile:)

But you posted like while i was writing the solution.. :laughing: