Does PING check DNS server

Sometimes when you ping a hostname of a computer inside the network, even when it is offline it will show the IP address that's mapped to hostname
Sometimes you ping hostname , it does not show the IP address, it just fails to connect to the hostname


I wonder if PING checks DNS first before it checks network connectivity ?


Thanks
jskfanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cor SlootIT SpecialistCommented:
Ping will give a response from either NetBIOS, potentially WINS, the hosts file, resolver cache, and (if you're lucky) a DNS server. It is not guaranteed that it will be a dns server that will be used to resolve the hostname.
omarfaridCommented:
can you try to disable lmhosts lookup? Please see attached file.
lmhosts.png
Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
LMHOSTS are enabled by default and most of the time, hosts files are not changed on the computers.  LMHOSTS can be disabled via registry, GPO and PowerShell.

To disable via registry, navigate to  [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters] and set value of 0 for value name EnableLMHOSTS

To disable via GPO, copy and paste below and save it as an Administrative Template (i.e ADM file):

;------------Begin Code-------------
CLASS MACHINE

CATEGORY !!category
CATEGORY !!Network

POLICY !!LmHosts
KEYNAME

"SYSTEM\CurrentControlSet\Services\NetBT\Parameters"
EXPLAIN !!LMHosts_Explain
VALUENAME "EnableLMHOSTS"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
END POLICY

END CATEGORY
END CATEGORY

[strings]
category = "Custom Policy Settings"
Network = "Network Configurations"
LmHosts = "LMHosts Lookup"
LMHosts_Explain = "Enable to enable LMHosts lookup. Disable to disable
LMHosts lookup."
;------------End Code-------------

PowerShell code is below:

$nic = [wmiclass]'Win32_NetworkAdapterConfiguration'
$nic.enablewins($false,$false)

I had found these in the past on the Internet and they are not my code but they are tested.  Below are the links:

http://www.pcreview.co.uk/threads/disable-lmhost-lookup-in-gpo.2147057/
http://www.pctools.com/guides/registry/detail/1285/
https://social.technet.microsoft.com/Forums/windows/en-US/d42c4dd4-bd3b-41d4-a8bf-b6019d312b12/using-powershell-to-uncheck-the-box-next-enable-lmhosts-lookup?forum=winserverpowershell
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

footechCommented:
Ping uses the OS' standard name resolution process.  So unless you've submitted an IP to the ping command, then yes, first the name has to be resolved (even submitting an IP, if you used the -a switch it would try to resolve the IP to a hostname).  Without resolving the name to an IP, the client would have no idea where to send the pings.  Current Windows clients use the following order:
1) DNS cache (HOSTS file is loaded into cache)
2) DNS
3) WINS
4) NetBIOS broadcast
Fred MarshallPrincipalCommented:
I believe this depends somewhat on what's meant by "DNS".  I prefer to think of local network  operation as having "Name Service" just to be distinct about it.  

The internal network may have something called DNS or not and it really must have Name Service of some kind.  NetBIOS is an example.

What I'm leading up to is that DNS for external names (e.g. internet URLs) is one thing and Name Service for internal names can be another.

If you're using NetBIOS in a peer-to-peer network or some equivalent thereof then it can be confusing because there is a computer with the "Master Browser" role that keeps a list of all the computers.  The existence and content of this list LAGS the actual network.  So, if a computer is turned off and is then immediately pinged using its name, the IP address will still be known (i.e. will be on the list) and you will likely see the IP address.  But, if it's been a long time since the computer went off the network then there may be no information about it on the list and you not only won't get a ping response but also not get an IP address.
jskfanAuthor Commented:
If I ping a hostname even if it offline, it shows the mapped IP address, then if I use Nslookup I can see the DNS record for the host

If I ping a hostname when it is offline and if I do not see the mapped IP address then I know that it does not have a record in DNS, because later on if I use Nslookup it does not find the hostname..

I believe PING checks both DNS and the connectivity.
footechCommented:
Yes, that's what I said.  It first has to resolve the name to an IP.  All network traffic is done via IP.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fred MarshallPrincipalCommented:
I have to imagine that you aren't on a peer-to-peer network.  But, just to be complete, in that case you won't get a return for a local computer using nslookup.  But, you will get Name Service and an IP address with ping.
jskfanAuthor Commented:
Thank you Guys
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DNS

From novice to tech pro — start learning today.