문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top