Hostname resolves to address, but can't ping or visit hostname on web

The issue I am facing:
I can resolve each of the hostnames I have set up for Pi-hole's localhost, but can't use some of them to ping or visit the host from another computer. pi.hole works, other hostnames don't.

Details about my system:
I have pi-hole installed on a machine that is set up as my router. It's an Ubuntu Server 20.04 system running on an Intel Core2 Duo machine with 4-port NIC bridged to be the LAN interface and the built-in Ethernet interface is the WAN interface. Pi-hole is my DHCP server and DNS server.

What I have changed since installing Pi-hole:
I also have Nagios running on the same machine, and Pi-hole is set up to use port 8080 instead of 80.

Details about problem
Using my primary computer (Windows 10), or other computers on the network, I can resolve the correct IP address using hostnames I have set up, but cannot ping using those same hostnames, and cannot use them to visit the Pi-Hole web interface, for instance. However, pi.hole can be used to ping and visit the web interface of both Pi-hole and Nagios

Here are some examples:
C:\Users\jer_c>nslookup gateway
Server: J-GATEWAY
Address: 192.168.1.1

Name: gateway
Address: 192.168.1.1

C:\Users\jer_c>ping gateway
Ping request could not find host gateway. Please check the name and try again.

C:\Users\jer_c>nslookup router2
Server: J-GATEWAY
Address: 192.168.1.1

Name: router2
Address: 192.168.1.3

C:\Users\jer_c>ping router2
Ping request could not find host router2. Please check the name and try again.

C:\Users\jer_c>nslookup pi.hole
Server: J-GATEWAY
Address: 192.168.1.1

Name: pi.hole
Address: 192.168.1.1

C:\Users\jer_c>ping pi.hole

Pinging pi.hole [192.168.1.1] with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time<1ms TTL=64
Reply from 192.168.1.1: bytes=32 time<1ms TTL=64
Reply from 192.168.1.1: bytes=32 time<1ms TTL=64
Reply from 192.168.1.1: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Here are the hosts I have set up through the Local DNS Records on Pi-Hole

Try

ping gateway.

1 Like

That works. It also works on the web. Is there a way to not require the "." after the hostname (especially on the web)? Thank you for your help, btw!

I'm not sure if I understand that. What do you mean here?


Have you read the link I posted? They suggest several methods on how to mitigate the issue.

By working on the web, I mean that I can visit http://gateway./nagios (with the "." after gateway) and get my Nagios web interface.

I just read the link - I'm sorry that I didn't recognize it as a link to a solution before. I tried one part of one of the solutions suggested (for appending the "." as a suffix) and haven't had success yet, but I will continue working through things as I have time. Thank you for your help!

1 Like

Note that ping may use other means to resolve hostnames than DNS, and that Windows OSs often assume they have to append the local search suffix to plain hostnames (i.e. an application issues a request for laptop, but Windows then requests e.g. laptop.lan instead or in additon to the plain request).

Since you only added Local DNS records for plain hostnames, it is likely that some lookups fail because you are missing the respective FQDNs. Please see [SOLVED] How can I get the local domain name auto suffixed to hostnames in DHCP? - #2 by Bucking_Horn for a few additional options.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.