question about Mikrotik ARP list of IP Filtering terminal command

320 Views Asked by At

I have this script for mikrotik terminal command

":local arp [:toarray [/ip arp print as-value where dynamic && interface"bridge3" && address in "192.168.4.0/24" ]];"

this script is working for 1 subnet. but I have many IPs that i want to include on this line of script eg. 192.168.5.0/24, 192.168.6.0/24, 192.168.7.0/24, 192.168.8.0/24, 192.168.9.0/24, 192.168.10.0/24 I want to include those ip on this script. example:

":local arp [:toarray [/ip arp print as-value where dynamic && interface"bridge3" && address in "192.168.4.0/24,192.168.5.0/24,192.168.6.0/24,192.168.7.0/24, 192.168.8.0/24,192.168.9.0/24,192.168.10.0/24" ]];"

but not working. if I use "192.168.0.0/20" its working, the problem is I dont want to include 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24.

what is the correct terminal command to include those ips from 192.168.4.0 up to 192.168.10.255?

thanks in advance!!

1

There are 1 best solutions below

0
On

First, you can print all addresses which are in subnet1 OR in subnet2, etc.:

/ip arp print as-value where dynamic && \
    interface=bridge3 && (address in "192.168.4.0/24" || address in "192.168.5.0/24" \
    || address in "192.168.6.0/24")

Second, depending on your needs, you may want to combine multiple contiguous /24 subnets to a bigger one. E.g., 192.168.4.0/24 + 192.168.5.0/24 + 192.168.6.0/24 + 192.168.7.0/24 = 192.168.4.0/22 - that can be used to simplify your list(s).