When I run nmap 192.168.1.*, I get a print out of all devices on my network. The hostnames are not what I expect. For example, the hostname of the Linux desktop (192.168.1.203) I am currently on is home. On nmap, I see:
Nmap scan report for DESKTOP-DDDV4PO.localdomain (192.168.1.203) Host is up (0.000012s latency). Not shown: 999 closed ports PORT STATE SERVICE 22/tcp open ssh My Raspberry Pi hostname is rp4 but for nmap I see:
Nmap scan report for raspberrypi.localdomain (192.168.1.99) Host is up (0.000063s latency). Not shown: 994 closed ports PORT STATE SERVICE 22/tcp open ssh 53/tcp open domain 80/tcp open http 8080/tcp open http-proxy 8083/tcp open us-srv 8181/tcp open intermapper The strangest one is my Sonos speaker (192.168.1.199) which is listed as being my father's iPhone. I assume he was here at some point and was assigned that IP address by my DHCP server. It was then reassigned to the Sonos speaker but the name persists.
Nmap scan report for Johns-iPhone.localdomain (192.168.1.199) Host is up (0.056s latency). Not shown: 999 closed ports PORT STATE SERVICE 1443/tcp open ies-lm Interestingly, I have also changed the domain name of my local network to home in my DHCP settings. However, nmap is still reporting a .localdomain domain name for all of these hosts.
I have a Unifi USG-3P router that is also my DHCP server. My DHCP is configured to hand out my Raspberry Pi as the DNS server (Pi-Hole is set up in a Docker container). Within Pi-Hole, my router is then set up as the upstream DNS server in order to resolve local hostnames. This set up was taken directly from this guide, method 2.
I'm not sure how to force the hostnames my DHCP/local DNS is mapping to IP addresses (and thus being reported by nmap) to come in line with their actual host names and the new domain name, home.
myhostnameentry to thehostsservice in/etc/nsswitch.conf.”