I’ve got a Debian 10 system that just…doesn’t seem to want to be reached. The system itself (named Hestia in my scenario) is a VM host (proxmox). It can ping every other system, including it’s own guest VMs, and itself just fine:
root@Hestia:~# ping hestia
PING Hestia (10.1.0.24) 56(84) bytes of data.
64 bytes from Hestia (10.1.0.24): icmp_seq=1 ttl=64 time=0.022 ms
64 bytes from Hestia (10.1.0.24): icmp_seq=2 ttl=64 time=0.030 ms
64 bytes from Hestia (10.1.0.24): icmp_seq=3 ttl=64 time=0.031 ms
But no other linux system can reach it by hostname:
[root@Gitlab ~]# ping Hestia.lan
ping: Hestia.lan: Name or service not known
[root@Gitlab ~]# ping Hestia
ping: Hestia: Name or service not known
[root@Gitlab ~]# ping hestia
ping: hestia: Name or service not known
What’s curious about this is that I can reach the system fine from any windows system, but only getting a response via IPv6:
ping hestia
Pinging Hestia.local [fe80::aaa1:59ff:fe49:cf27%22] with 32 bytes of data:
Reply from fe80::aaa1:59ff:fe49:cf27%22: time<1ms
Reply from fe80::aaa1:59ff:fe49:cf27%22: time<1ms
I’m really not quite sure where to even start looking here. What would cause this? And how do I fix it so that my linux machines can access my server by hostname?
Here are my conf files that I think are relevant?
root@Hestia:~# cat /etc/hosts
127.0.0.1 localhost
10.1.0.24 Hestia Hestia.proxmox.com
#127.0.1.1 Hestia.lan Hestia
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
.
root@Hestia:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.53
nameserver 10.1.0.1
search lan
domain lan
2
Answers
All other system to reach it by hostnames will have to have its IPs in the hosts config:
Maybe something like this:
Or your nameservers 127.0.0.53, 10.1.0.1 have to run a DNS service (like dnsmasq) with (possibly hardcoded) DNS entries for your local hostnames.
If you read the error message
ping: Hestia.lan: Name or service not known
it’s not saying that it can resolve the ‘Hestia.lan’ name to a IP and the IP doesn’t respond. You do not have problem with a ping, you have problem with the DNS resolution.Probably your Windows machine might have it in the c:/windows/system32/etc/hosts already?
Another problem sometimes is when you have multiple logical networks on your physical network, then routing has to be configured correctly to make sure the things work. However that problem needs to be resolved when your dns name will get resolved to a IP, but there will be no response from the IP.
Executive summary: Your problem is not with the ping, or Debian wanted to be reached, but the DNS/hosts settings of your all other hosts (or your router, if you want to go with the dnsmasq route)
With Debian you can just add NETBIOS name resolution which saves you from mangling with your LAN DNS.
This has been answered multiple times either here or in stackexchange
TL;DR: