Community discussions

MikroTik App
 
irghost
Member
Member
Topic Author
Posts: 302
Joined: Sun Feb 21, 2016 1:49 pm

wrong return -> (/ip arp find ... )

Wed Oct 12, 2016 6:36 pm

hi all
I use this code
/ip arp remove [/ip arp find address=172.16.1.254  and mac-address=AC:7B:A1:B3:D4:77 and dynamic=no ]
in my custom script
but its work in wrong way and removes both (172.16.1.254 & 172.16.1.253) from ARP table
i don't know why?
Image
 
User avatar
Splash
Member Candidate
Member Candidate
Posts: 206
Joined: Fri Oct 16, 2015 10:09 am
Location: Johannesburg, South Africa

Re: wrong return -> (/ip arp find ... )

Wed Oct 12, 2016 7:13 pm

I tested this on my router and dont seem to have the same issues when running this command.
/ip arp remove [/ip arp find address="192.168.19.76" and mac-address ="00:00:00:00:00:12" and dynamic=no]
If you just run the command on its own and not in your script, does it do the same thing?
 
irghost
Member
Member
Topic Author
Posts: 302
Joined: Sun Feb 21, 2016 1:49 pm

Re: wrong return -> (/ip arp find ... )

Wed Oct 12, 2016 7:28 pm

yep
[/ip arp find address=172.16.1.254  and mac-address=AC:7B:A1:B3:D4:77 and dynamic=no ]
this find return 2 number instead of 1
 
User avatar
Splash
Member Candidate
Member Candidate
Posts: 206
Joined: Fri Oct 16, 2015 10:09 am
Location: Johannesburg, South Africa

Re: wrong return -> (/ip arp find ... )

Thu Oct 13, 2016 11:28 am

Hmm,

Can you try put the arguments in " quotes and see if that helps?

What ROS are you running?
 
irghost
Member
Member
Topic Author
Posts: 302
Joined: Sun Feb 21, 2016 1:49 pm

Re: wrong return -> (/ip arp find ... )

Thu Oct 13, 2016 11:04 pm

Hmm,

Can you try put the arguments in " quotes and see if that helps?

What ROS are you running?
this is not my problem
here is my On logout script for my hotspot
:local "hotspot_user" $user;
:local "hotspot_address" $address;
/ip firewall nat remove [/ip firewall nat find src-address=$address];
/ip arp remove [/ip arp find address=$address  and mac-address=$"mac-address" and dynamic=no ];
:log info "User $user with ip-address  $address and MAC $"mac-address" Interface $interface logged out!"
on login
/ip  firewall nat add action=masquerade chain=srcnat out-interface-list=Data hotspot=auth comment="NAT" src-address=$address;
:log info "User $user with ip-address  $address and MAC $"mac-address" Interface $interface  logged in!"
ip arp add interface=$interface address=$address mac-address=$"mac-address";
 
User avatar
Splash
Member Candidate
Member Candidate
Posts: 206
Joined: Fri Oct 16, 2015 10:09 am
Location: Johannesburg, South Africa

Re: wrong return -> (/ip arp find ... )

Fri Oct 14, 2016 4:27 pm

this wouldnt work as you have put the quotes after the $

$"mac-address";

should be

"$mac-address";
 
irghost
Member
Member
Topic Author
Posts: 302
Joined: Sun Feb 21, 2016 1:49 pm

Re: wrong return -> (/ip arp find ... )

Fri Oct 14, 2016 9:31 pm

this wouldnt work as you have put the quotes after the $

$"mac-address";

should be

"$mac-address";
nop if u read the Doc for scripting
variables which has dash between words should be used like $"mac-address"
u can test it
use this
:log info "User $user with ip-address  $address and MAC $"mac-address" Interface $interface  logged in!"
 
irghost
Member
Member
Topic Author
Posts: 302
Joined: Sun Feb 21, 2016 1:49 pm

Re: wrong return -> (/ip arp find ... )

Sat Oct 15, 2016 8:51 pm

upup

Who is online

Users browsing this forum: adimihaix, friend2809, loloski, mkx, qatar2022, Semrush [Bot] and 83 guests