Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does ping resolve ip addresses? [closed]

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?

like image 920
user1762571 Avatar asked Jun 18 '13 05:06

user1762571


1 Answers

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.

like image 62
paxdiablo Avatar answered Oct 14 '22 07:10

paxdiablo