Hoping someone much more clever than me can help me here.
Basically we have a database of client IP addresses which is a list of /32 addresses and we have clients which have /30s /28s etc.
What I want to do is export that long list of /32's and see if they are in use in the network by using a script. To do this manually I would type something like:
Code: Select all
/ip route print where x.x.x.x in dst-address
I thought I might be able to create an array or possibly import the list in CSV and see if the address is in use and the database we have is correct so I created a test array like this:
Code: Select all
:global array {"172.168.0.1";"192.168.5.1","100.10.1.2"}
Code: Select all
:foreach i in=$array do={if ([ip route {find where [:pick $array $i]in dst-address }]) do={ :log info message= "blaaa $array "}}
Code: Select all
[:pick $array $i]
Code: Select all
:foreach i in=$array do={if ([ip route {find where 10.1.0.77 in dst-address }]) do={ :log info message= "blaaa [:pick $array $i]"}}
I can't help but feel I'm doing this all wrong and any help is very appreciated!
Thank you
Emma