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.