hi .. in first place I want talk that my english its terrible ..
so .. I will try tell my problem …
I want a script that add ips when I run it ..
I have 3 man class
192.168.50.
192.168.100.
192.168.150.
since here . its ok .. but I have 5 networks with mask 29 in each man class
for example in the 1º class ..
192.168.50.1/29
192.168.50.9/29
192.168.50.17/29
192.168.50.25/29
192.168.50.33/29
in 2º class
192.168.100.1/29
192.168.100.9/29
192.168.100.17/29
192.168.100.25/29
192.168.100.33/29
in 3º class
192.168.150.1/29
192.168.150.9/29
192.168.150.17/29
192.168.150.25/29
192.168.150.33/29
the man class I use to determine the radio that that client is …
so .. I need get a script to add a ip in each class ..
for example .. I set a variable 192.168.50 in the script .. and with that .. find the last ip for this man class .. iin case 192.168.50.33/29 end add a ip basend on the last .. in case generate a 192.168.50.41/29 …
the problem that all scripts that I think to do this .. I need to set a value type 5 or 6 to find the last ip from this man class …
if someon can help me .. please ..
I’ve posted in the wiki a script that created bgp routes via script for testing, maybe you can see that script and get what you need? You enter the first 3 octets of a range and it will generate the additional IPs.
my friend ..
please post de link .. I´ve searched a lot . and I did find ..
just one thing .. I want run this script no in console .. I want run in script editor .. the realy problem to I cant get the resolution . its that in script editor I cant set a >> get $X address << this mean that I cant use numbers or varibles to get values in scripts .. just in console ..
note: in console my script run very well
but in script editor .. not ..
still looking for resolution ..
thanks for the answers .. but I got by myself
I start to work with script in mikrotik in jan\22\2007 and this was my first …
I readed some script in this fórum and help me so much …
now .. I will try get other scripts ..
ah .. this is my real intention of script ..
:global i “”
:global N 2
:global Man 50
:for x from=1 to=$N do={
/ip address
:foreach i in=[find] do={:if ([:find [/ip address get $i address] (“192” . “.” . “168” . “.” . $Man) ]=0)
do={
:global IpFinal [/ip address get $i address]
}
}
:global Ip [:pick $IpFinal 0 ([:len $IpFinal] - 3) ]
/ip address add address=(($Ip + 8) . “/29”) interface=ether1 comment=(“Instalação-” . $x)
}
I just define the Man class in case 50 and the number that ips to add …
not bad for my first script ..
note: My english is terrible .. heheh I am just a Brazilian man…