After some research on how cdn works, I understand that there are mainly two categories of cdn's: 1. dns based; 2, router based.
Dns based cdn holds a collection of ip address of one domain name, when a dns inquiry request arrives, it determines the nearest ip address according to the client ip address of the request.
Router based cdn deploys nodes with identical ip addresses across many geographical regions, and when a request is initiated from a client, the router will decide which node to reach.
This is basically what I understand about how cdn works. Would you correct me if anything is wrong.
Now I want to home brew a cdn. I don't want to do the router based because I have no control over that many nodes and I have no way to assign them identical ip addresses. What might be possible for my home brewed cdn I think might be a dns based one. I have bind9 serving on my dns servers. Now is there any way that I could hack into bind9 and let it decide which ip address to return based on the client request ip address? Thanks.
search for bind9 geoip
http://www.caraytech.com/geodns/
What is it?
A 40-line patch for BIND to add geographical filters support to the existent views in BIND. Look at it. What can I use it for?
The most popular use of this patch is to send web site visitors to their nearest web server.
or other options as this http://phix.me/geodns/