Community discussions

MikroTik App
 
Josephny
Member
Member
Topic Author
Posts: 495
Joined: Tue Sep 20, 2022 12:11 am

How to get hostname from /ip arp

Wed Aug 30, 2023 1:20 pm

I'm trying to retrieve the arp list of devices and include IP, MAC as well as hostname.

I see the info in winbox, but I can't figure out how to get it via CLI or script.

/ip arp print detail

does not show hostname

Is this function available?

I can get the hostnames in:

/ip dhcp-server print

Thank you
 
ConradPino
Member
Member
Posts: 337
Joined: Sat Jan 21, 2023 12:44 pm
Contact:

Re: How to get hostname from /ip arp

Wed Aug 30, 2023 1:33 pm

arp table information is reliable but limited to devices seen on local network only recently.

Translating IP address to hostname is typically unreliable. The mechanism is https://en.wikipedia.org/wiki/Reverse_DNS_lookup.
It's unreliable because while it is IP address block owner's responsibility, it requires forward lookup domain owner cooperation which fails.
Typical small domain owners are DNS illiterate and just don't bother asking their ISP to update PTR record for the IP address they use.
BTW DNS reverse lookup is an expensive network operation. Play with dig command https://en.wikipedia.org/wiki/Dig_(command)
dig -x 8.8.8.8
 
Josephny
Member
Member
Topic Author
Posts: 495
Joined: Tue Sep 20, 2022 12:11 am

Re: How to get hostname from /ip arp

Wed Aug 30, 2023 5:43 pm

Thank you very much for the explanation.

My interest in arp to IP to MAC is to more readily identify the devices on my network. That is, those that indeed can be seen by the router.

For example, it is a lot easier for me to know at a glance what devices these are:

Untitled.png

Than to know which devices these are:

Untitled2.png
You do not have the required permissions to view the files attached to this post.
 
ConradPino
Member
Member
Posts: 337
Joined: Sat Jan 21, 2023 12:44 pm
Contact:

Re: How to get hostname from /ip arp

Wed Aug 30, 2023 7:36 pm

Nobody disagrees with the utility and attractive time efficiency.
It's just one of those issues that cant' be executed error free in practice.
 
Josephny
Member
Member
Topic Author
Posts: 495
Joined: Tue Sep 20, 2022 12:11 am

Re: How to get hostname from /ip arp

Thu Aug 31, 2023 11:25 am

I have a reasonable understanding of the limitations -- thank you.

Is there a way to achieve what I'm asking for within RouterOS?

That is, a way to 'get' the full arp list on the CLI (in a script) that includes the hostname as shown in winbox:

Untitled.png
You do not have the required permissions to view the files attached to this post.
 
troykelly1
just joined
Posts: 1
Joined: Sun Nov 19, 2023 11:19 am

Re: How to get hostname from /ip arp

Sun Nov 19, 2023 11:22 am

I assume this is a bug (or at the very least an oversight).

Regardless of personal opinions as to the usefulness or suitability of this data, it is needed. The data is clearly there - it's in the app interface.

How can we get the hostname either via the console or REST API? both omit (what I assume would be) the `host-name` field from the returned data.
 
alfred998
Frequent Visitor
Frequent Visitor
Posts: 76
Joined: Fri Apr 27, 2018 4:58 pm

Re: How to get hostname from /ip arp

Fri Mar 15, 2024 9:27 pm

Question out of nowhere. Do you get hostname only for wireless connections or also for ethernet in winbox ? I dont' seem do get them for cable connections

Who is online

Users browsing this forum: Amazon [Bot], GoogleOther [Bot] and 19 guests