M
M
Mikhail Makarov2018-01-21 20:20:27
Domain Name System
Mikhail Makarov, 2018-01-21 20:20:27

How does a CDN work?

Tell me what underlies the work of CDNs that have servers in different countries. More specifically, I'm interested in the implementation of the next moment. For example, I buy several VPS located in different parts of the world, register a domain name like my-cool-cnd.net , upload the resources I need to the servers that I want the user to download from the server that is closer to him. But after all the domain name is casted in one ip!? And I want it to be cast to the ip of the server that is closer to the current user. Moreover, I would like to program this process manually. How it's done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav, 2018-01-21
@yaror

Well, actually, several ip-addresses can correspond to one DNS name ...
In general, options, right off the bat:
1. Who prevents the DNS server from responding with different ip-addresses based on the GeoIP data of the sender of the DNS request?
2. Why not start a "sorter" of requests, relying on the means of HTTP itself?
Let the user try to download some file my-cool-cnd.net/file. Then:
2.1. The HTTP server raised on my-cool-cnd.net sees through GeoIP that the user is in Europe and responds with HTTP code 307 Temporary Redirect, Location: europe.my-cool-cnd.net/file
What is important, on my -cool-cnd.net may not have any files at all - only a script redirector.
2.2. The user happily uploadseurope.my-cool-cnd.net/file
3. In general, a wild variant, which, nevertheless, is sometimes used: each regional CDN node announces the same ip-address over BGP. In this case, from which CDN node the download will go is decided by ip-routing, based on the principle of choosing the AS Path of the minimum length.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question