1

I have this lingering doubt regarding DNS, please excuse the basicness of the question.

If I ping www.whateversite.com, I'm pinging the www host in the whateversite.com domain, right?

If I ping whateversite.com, what host am I pinging?, is it a name server or what? I notice they usually give different IP adddresses when I ping them.

Any clarification much appreciated.

2
  • 1
    From my answer over here about DNS the vague process is per this image: i.stack.imgur.com/1VW8n.png
    – Mokubai
    May 20 at 21:11
  • 2
    Note that nowadays most sites are behind CDNs, so whether you ping www.example.com or just example.com, the DNS server probably sent you to the nearest edge node for the CDN that that site uses. If you switch from Wi-Fi to cell data or vice-versa you'll probably get different A and AAAA records for both names.
    – Spiff
    May 21 at 2:17

3 Answers 3

1

If I ping www.whateversite.com, I'm pinging the www host in the whateversite.com domain, right?

That is kind of a simplification, but yes, close enough.

If I ping whateversite.com, what host am I pinging?

There is no difference between your two examples. Left of the first period is the host label, the rest is the domain, just as with your first example.

So, you are pinging the host whateversite in the domain com.

And if you ping com, you are pinging the host com in the root domain (usually written . or @). Note that the owner of the root domain does not usually allow host entries, especially ones with the same name as a TLD, but that is a purely political decision – there is nothing technical in the DNS protocol to prevent it.

And, in fact, the Kingdom of Tonga has a host entry for to which they used to lease to a URI shortening service.

It turns out it is kind of hard, though, to visit https://to/ because your browser tries to be "helpful" and thinks you might have meant https://www.to/ or https://to.com/ or https://www.to.com/. But that is also not a technical limitation in the DNS system, that is a User Interface issue in modern web browsers.

is it a name server or what?

It will be whatever the owner of that server has configured it to be.

I notice they usually give different IP adddresses when I ping them.

Sure, they are different hosts, so they can have different IP addresses.

1
  • Great answers. I had to revise my dns knowledge to grasp all details. Thanks! May 22 at 10:58
1

You could say you're pinging a host named "whateversite.com".

There is a bit of overlap between 'hosts' and 'domains'. Any domain name at any level counts as a 'host' if it has any "address" records (usually A/AAAA records for IPv4/IPv6), it does not necessarily have to be a subdomain.

(But under another definition, not all subdomains necessarily represent 'hosts' – they can represent a service, or they can literally be a "sub-domain" with the actual hosts being one level deeper. Again, DNS doesn't impose a rigid structure there.)

So the second case works exactly the same way as the first – there's an A record at "whateversite.com" that points to some machine. In simple cases it might be the same machine as the one that the "www" subdomain points to, but they can just as well be different.

(For example, one might point to the main load-balancer while the other points to a smaller system that just redirects HTTP visitors to "www".)

1

The first thing to clarify is that in DNS terms, while a "Host" address (eg A or AAAA record) CAN refer to an individual server (and traditionally did most of the time), it doesn't have to.

When you ping an address it resolves to an IP address via an A or AAAA record. Note, there are many other DNS record types that ping doesn't even relate to. So for instance Name Servers are handles via NS records, so there's no direct connection between them and A records in the context of your question.

Secondly, a Host address can be at any level, so both www.domain.com and domain.com can have their own Host address. Since they're configured individually they can be the same, or they can be different. So for instance you could have mydomain.com configured with (note, the root domain is often denoted with an @) :

www A   1.1.1.1
@   A   1.1.1.1

so both www.mydomain.com and mydomain.com can point to the same IP address. But you could also have :

www A   1.1.1.1
@   A   2.2.2.2

and now they'd point to different IP addresses, which MIGHT point to completely different destinations.

Thirdly, you can have more than one "Host" address for the same name, so even without getting into CDNs you can't always associate a specific address you try to ping with an individual server. For instance :

www A   1.1.1.1
www A   1.1.1.2
www A   1.1.1.3

in which case when you ping www.mydomain.com the ping command will go to one of those IPs at "random". You can see that by running nslookup and querying the specific record, which would then give an output like :

Name:   www.mydomain.com
Addresses:  1.1.1.1
        1.1.1.2
        1.1.1.3

Finally, keep in mind that a single public IP address does NOT alays equate to an individual server/machine/device at the other end. They could be using a CDN as others have mentioned, or they could simply be using a firewall that balances requests to multiple servers behind it via a single public IP.

So in reality, about the only thing you can tell with certainty when you ping an address is that it currently resolves on your machine to a specific IP address. Whether that's the only address it resolves to, or whether it's one or multiple devices at the other end can't be determined via Ping alone.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .