Community discussions

MikroTik App
 
sathishsa
Member Candidate
Member Candidate
Topic Author
Posts: 113
Joined: Fri Sep 04, 2009 12:08 am

ARP make script script

Tue Oct 04, 2011 4:41 pm

Hello,

I appreciate the forum users and mikrotik support people who are making a valuable help in configuring the great reliable routes

My request for the script is ip arp when ever the client trying to connect through router the script should automatically make static the entry


Please help me in writing this script

Thanks,
Sathish
 
sathishsa
Member Candidate
Member Candidate
Topic Author
Posts: 113
Joined: Fri Sep 04, 2009 12:08 am

Re: ARP make script script

Tue Oct 04, 2011 4:48 pm

Hello,


while searching i found the script, which works great only on v2.9 , mine is v5.7 please help
only one mac address in making static in the log
:local dmac
:local smac
:local dip
:local sip
:local iface
:local exist
:foreach i in [/ip arp find dynamic=yes] do={
:set exist false
:set dmac [/ip arp get $i mac-address]
:set dip [/ip arp get $i address]
:set iface [/ip arp get $i interface]
:foreach j in [/ip arp find dynamic=no] do={
:set smac [/ip arp get $j mac-address]
:if ($dmac=$smac) do={
:set sip [/ip arp get $j address]
:set exist true
}
}
:if ($exist!=true) do={
:log info ("Adding ARP entry with MAC " . $dmac . " and IP " . $dip)
/ip arp add copy-from=$i
}
}


Thanks,
Sathish

Who is online

Users browsing this forum: No registered users and 4 guests