The ping
utility works above the network layer and DNS works in the application layer.
If we try ping www.google.com
, how does it resolve the IP address of GOOGLE since the DNS is above these layers?
The ping
utility works above the network layer and DNS works in the application layer.
If we try ping www.google.com
, how does it resolve the IP address of GOOGLE since the DNS is above these layers?
ICMP (the protocol) may operate above IP, alongside TCP but a ping
program itself almost certainly still uses the normal methods for name resolution, be that DNS, hosts file or resolv.conf
.
For example, the ping
program located here calls on gethostbyname()
to turn DNS names into IP addresses.
Certainly on windows computers, ping also uses LLMNR (Link-Local Multicast Name Resolution) to perform hostname resolution. A host may be pinged just fine while other services still fail if a computer is only known by LLMNR and the failing service relies on DNS. Vice versa: DNS may work but ping fails
Hostnames are still resolved through DNS, after that ping uses ICMP for the actual communication. You can try changing the DNS configs to invalid servers and see that ping won't work with hostnames.
© 2022 - 2024 — McMap. All rights reserved.