Hi All
Could any script guru advise on the right syntax for using the find command to return a MAC address from the /IP ARP list given the ip address?
many thanks.
Hi All
Could any script guru advise on the right syntax for using the find command to return a MAC address from the /IP ARP list given the ip address?
many thanks.
/ip arp get [/ip arp find address=$ip] mac-address
(assuming $ip is a local or global variable with the IP address)
You Star!
Thankyou
That didn’t work for me, i found that the below did.
:global macaddy [get [find address=172.16.1.11] mac-address]]
:put $macaddy
{
:global state yes
:global int
:global ip
:global mac
:foreach a in=[/ip arp find where dynamic=$state ] do={
:set int [/ip arp get $a interface ];
:set ip [/ip arp get $a address ];
:set mac [/ip arp get $a mac-address ];
:log warning ("IP - $ip on Interface - $int with Mac - $mac");
}}
{
:global state yes
:global ip 10.0.0.2
:global mac
:foreach a in=[/ip arp find where address=$ip dynamic=$state ] do={
:set mac [/ip arp get $a mac-address ];
:log warning ("IP - $ip to Mac - $mac");
}}