Why does it take longer to ping by hostname than by IP address?
The delay is caused by ping
trying to resolve the IP address back to a name1, by looking up 160.213.101.150.in-addr.arpa
(reverse DNS).
Normally the reply (whether success or nxdomain) should be instant, but it could be that it wasn't cached by your ISP and the authoritative servers for 213.101.150.in-addr.arpa
were having problems at that time.
It might also be caused by misconfiguration or just bugs in certain DNS servers. If you see this delay happening every single time, it might be that your DNS resolver isn't properly caching replies when it should (even negative replies are cacheable).
When using the ping
from iputils, add the -n
option to avoid reverse-DNS lookups.
1 It's a domain name or a host name, not an URL; it doesn't specify any particular protocol or resource. http://google.com
would be an URL. http://150.101.213.160
would be an URL too.