According to Get the Hostname From an IP Address on the LAN, I can get the hostname of an IP address of a local server either using the nmblookup or nbtscan. However, these commands are not getting a reply (see below). I can ping 192.168.1.50 and ssh into it as it is a Ubuntu 24.04 Server. Why am I not getting the hostname and how to fix this issue?
$ nmblookup -A 192.168.1.50
Looking up status of 192.168.1.50
No reply from 192.168.1.50
$
$ nbtscan 192.168.1.50
Doing NBT name scan for addresses from 192.168.1.50
IP address NetBIOS Name Server User MAC address
$
$ ping 192.168.1.50
PING 192.168.1.50 (192.168.1.50) 56(84) bytes of data.
64 bytes from 192.168.1.50: icmp_seq=1 ttl=64 time=6.87 ms
64 bytes from 192.168.1.50: icmp_seq=2 ttl=64 time=4.34 ms
64 bytes from 192.168.1.50: icmp_seq=3 ttl=64 time=3.91 ms
64 bytes from 192.168.1.50: icmp_seq=4 ttl=64 time=3.39 ms
64 bytes from 192.168.1.50: icmp_seq=5 ttl=64 time=3.37 ms
64 bytes from 192.168.1.50: icmp_seq=6 ttl=64 time=1.78 ms
^C
--- 192.168.1.50 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5008ms
rtt min/avg/max/mdev = 1.778/3.942/6.869/1.529 ms
$
$ avahi-resolve -a 192.168.1.50
Failed to resolve address '192.168.1.50': Timeout reached
PS. I am aware of How to find a computer name in a LAN from the IP address? but the answers there do not address my query.
I wonder if the setting in this file is causing the issue, hmm?
$ 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: files systemd sss
group: files systemd sss
shadow: files sss
gshadow: files
hosts: files mdns4_minimal [NOTFOUND=return] dns mymachines
networks: files
protocols: db files
services: db files sss
ethers: db files
rpc: db files
netgroup: nis sss
automount: sss
The ubuntu 22.04 desktop client IP is 192.168.1.170 and it is connected via wifi to the router 192.168.1.1. The Ubuntu 24.04 server is connected to the router via ethernet and its IP is 192.168.1.50. Its stub resolver is running on port 53. Also, I am setting it up as a local DNS on port 3000.