Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

1  
"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
    
geoipdns.org –  Hrvoje Špoljar Sep 9 '12 at 23:24

1 Answer 1

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 example.com, 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 fbcdn-sphotos-a.akamaihd.net
...
;; ANSWER SECTION:
fbcdn-sphotos-a.akamaihd.net. 288 IN    CNAME   fbcdn-sphotos-a.akamaihd.net.edgesuite.net.
fbcdn-sphotos-a.akamaihd.net.edgesuite.net. 289 IN CNAME a1001.dspw40.akamai.net.
a1001.dspw40.akamai.net. 9      IN      A       195.145.147.40
a1001.dspw40.akamai.net. 9      IN      A       195.145.147.11

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.