Score:0

nmap is not showing hostnames

gs flag
Alb

I am new to linux, and I am trying to get all the hostnames from the hosts of my local network.

I was trying the command:

sudo nmap -sn 192.168.0.0/24

and also:

sudo nmap -sn -R 192.168.0.0/24

but the only hostname I get is the one from my router.

I was thinking that maybe the router doesn’t have a DNS server and because of that it can’t provide this info to nmap.

The router was provided by the ISP.
I checked if the port 53 of the router was opened. It was!
I don't know if what I want is even possible given this router.

Maybe someone could help me out?

guiverc avatar
cn flag
You've provided no OS & release details
user10489 avatar
in flag
If he's using ubuntu from the last 10 years, I can't see how release details affect this answer.
Score:0
in flag

The DNS server doesn't magically generate hostnames. Something has to configure DNS with those hostnames. Both forward and reverse hostnames have to be configured in DNS to get full functionality.

DNS doesn't generally support automatic dynamic hostnames. Protocols like mDNS/DNS-SD implemented by avahi try to do this, but it only works for participating hosts on a local network.

Hostnames have two sources, and those sources do not have to match. One source is hostnames assigned to IP addresses through an external authority and configured into DNS, and no host has to actually exist at those ip/hostname pairs. The other source is the name the host calls itself, and this can only be obtained by probing the host or listening to announcements by the the host through protocols like SMB or mDNS.

Alb avatar
gs flag
Alb
What I want is to find the name hosts give to themselves, from hosts that exist inside my local network. I thought nmap already fetched that.
user10489 avatar
in flag
nmap only probes the hosts. If it gets a name, it gets it by asking the system to reverse resolve the name. Typically on a linux system, nsswitch.conf controls what is used to reverse resolve it, and dns and mdns are both in the list. But if a host doesn't speak mdns, you won't get a result that way.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.