I am having problem with viewing hostnames of devices located in my LAN. On my first laptop (Ubuntu 18.04 LTS Desktop edition) result of following command:

arp -a

Is exactly what I want:

X ( at 40:a3:cc:99:2d:66 [ether] on wlan0
test-test-test ( at 48:bf:6b:e3:bf:5a [ether] on wlan0
TP-Link_Archer_ ( at 10:7b:44:40:61:70 [ether] on wlan0

Using nmap, I am able to scan my LAN using this command:

nmap -sn

And I get the perfect results with hostnames:

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-07 09:07 EDT
Nmap scan report for TP-Link_Archer_ (
Host is up (0.0054s latency).
Nmap scan report for ZZ (
Host is up (0.00045s latency).

However, on another laptop with Debian 9 x64 Minimal installed, the whole hostnames part is missing. Whenever I issue arp -a, I get the following:

? ( at 40:a3:cc:99:2d:66 [ether] on wlan0
? ( at 48:bf:6b:e3:bf:5a [ether] on wlan0
? ( at 10:7b:44:40:61:70 [ether] on wlan0

Moreover, scanning with nmap -sn produces this output:

Starting Nmap 7.60 ( https://nmap.org ) at 2018-08-07 09:17 EDT
Nmap scan report for
Host is up (0.0054s latency).
Nmap scan report for
Host is up (0.00045s latency).

I have honestly no idea what is going on, most likely I am missing something in Debian Minimal installation, which is installed in Ubuntu. But I have no clue where to find the missing part so Debian machine can start showing me hostnames.

Any ideas?

EDIT: My /etc/nsswitch.conf is exactly this:

root@zxcv:/home/test# cat /etc/nsswitch.conf
# /etc/nsswitch.conf
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat
gshadow:        files

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

However I've setup a VM with bridged network adapter, installed same version of Debian Minimal, and I am able to get the hostnames for all IPs. The question now is, which packets/modules/services is the failing Debian missing, which prevents from getting hostnames?

  • 1
    Is reverse name resolution working correctly on the Debian laptop? It needs it to convert IP addresses (gleaned from the ARP cache) to host-names. Aug 7, 2018 at 13:40
  • @garethTheRed How can I check if it is working correctly? So far host 192.168.561 on debian gives me Host not found: 3(NXDOMAIN)
    – RedS
    Aug 7, 2018 at 13:51

2 Answers 2


You don't have access to the DNS server that can translate IP addresses to names.

There are other ways to associate host names and IP addresses, but if you have more than one computer, DNS is your best answer.

And in reply to your comment, yes, /etc/resolv.conf should contain the address of the DNS server. In a small network this is often the same as the router.


arp is interrogating your system to determine how it can translate IP's to hostnames. If you use the -n switch it'll forgo this and simply show the IPs without any translation to hostnames.

Like most tools in Linux, arp uses NS (Name Service Switch) to do the lookups. If you strace your arp command you can see it looking these things up:

$ strace -s 2000 arp -a
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 5

After looking in this file arp will discover how it's suppose to look up hostnames.

$ grep hosts: /etc/nsswitch.conf
#hosts:     db files nisplus nis dns
hosts:      files dns myhostname

This says to look in files 1st, then inquire to DNS 2nd... The word files here means to use the system's /etc/hosts file. You can tap into how NS would do this by using the getent hosts command.


On my VM of CentOS 7 for example:

$ arp -a
? ( at 52:54:00:12:35:03 [ether] on eth0
gateway ( at 52:54:00:12:35:02 [ether] on eth0
$ arp -an
? ( at 52:54:00:12:35:03 [ether] on eth0
? ( at 52:54:00:12:35:02 [ether] on eth0

If we inquire to getent looking for the IP:

$ getent hosts        gateway

The IPs, if not present locally in any files, will be looked up in DNS next. Since my IPs are all private IPs to this VM, and they're not explicitly in my VM's defined DNS, which is incidentally defined here:

$ more /etc/resolv.conf
# Generated by NetworkManager

NOTE: arp is left with no other choice than to show you a question mark, because it failed to find any name to use.

  • If my /etc/resolv.conf doesnt contain router's IP address (which acts as DNS server), could it be the cause of problems?
    – RedS
    Aug 7, 2018 at 16:21
  • @RedS - that would be the next thing I'd try as well.
    – slm
    Aug 7, 2018 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .