Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From my understanding CDN are fast because they have big pipes, serve static content and are 'close' to you. But from my understanding DNS's give you a random IP address. If a CDN have 1 location across your street, another 100 miles away and many locations halfway around the world how does one get a (rare) close one and not a (many) far away server?

share|improve this question

closed as off topic by Chris S Sep 9 '12 at 18:35

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

"But from my understanding DNS's give you a random IP address." Nope. – ceejayoz Sep 9 '12 at 17:27
@ceejayoz ok i'm wrong but i knew something was wrong. I don't know why its been downvoted as it clearly states my question. – acidzombie24 Sep 9 '12 at 18:00 – Hrvoje Špoljar Sep 9 '12 at 23:24
up vote 2 down vote accepted

DNS servers usually give you the address from the closest datacenter to you. When your DNS resolver (or your ISPs if you're using that) asks the CDN's dns server for an ip address, it checks the IP from where the request came, and returns the IP address(es) closest to there.

So if you're using an ISP in France, and try to resolve, its nameserver sees that the request came from France, and returns addresses closest to there.

Try resolving some CDN's address (for example facebook photos):

$ dig A
;; ANSWER SECTION: 288 IN    CNAME 289 IN CNAME 9      IN      A 9      IN      A

If I check the whois on those IP addresses, i get the location as Germany (closest akamai datacenter to my location). If you're from somewhere far from Germany, you should get a different response.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.