can only ping hostname if period is appended

1

I'm confused by what's happening here. nslookup myHost resolves myHost. ping myHost does not. ping myHost. does. Why does adding a period work? How can I make ping myHost work?

>nslookup myHost
Name: myHost
Address: xxx.xxx.xxx.xxx

>ping myHost 
Ping request could not find myHost. Please check the name and try again.

>ping myHost.
Pinging myHost [xxx.xxx.xxx.xxx] with 32 bytes of data:
Reply from xxx.xxx.xxx.xxx: bytes=32 time=1ms TTL=64

For reference, the nameserver is dnsmasq on Raspbian Jessie. Here is /etc/dnsmasq.conf, minus security settings. listen-address and server are the same ip:

interface=wlan0
listen-address=xxx.xxx.xxx.xxx
bind-interfaces
server=xxx.xxx.xxx.xxx
bogus-priv
dhcp-range=xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxx,12h

In my hosts file:

xxx.xxx.xxx.xxx myHost

Daniel B.

Posted 2016-09-08T02:16:48.043

Reputation: 248

domain names that don't end with the (often-optional) period are often prone to have a suffix added to them. (You do know that TLD's, like .com, end with an often-optional period, right? e.g., ping google.com.) – TOOGAM – 2016-09-08T03:36:11.783

I do know that; (it's been a while, but . indicates the top level right?) So ... if I set the domain as . in dnsmas.conf, perhaps that would fix it? – Daniel B. – 2016-09-08T03:45:21.673

Answers

0

Feel free to correct me if I'm wrong, but this looks like Windows. What is looks like to me it you have something set as a search domain in your DNS settings. This is usually something that is used when you have an Active Directory domain setup (or your DNS or DHCP server are part of one)

What that means is when looking up a local computer, it will consider it part of X domain (in this case it looks like a blank domain so ".") Even if the computer hasn't been joined to said domain. It will pull these settings from the DHCP server. Now, I have run into issues where the DNS server updates the record, but it isn't telling clients that they need to use X domain. Normally if you nslookup mycomputer it will auto search mycomputer.X and mycomputer but if the computer doesn't know about X domain, it won't search.

Ian M

Posted 2016-09-08T02:16:48.043

Reputation: 208