So, I know how a CDN works in principle and how it works from a customer's perspective. My question is more about the root of how they work, the routing. My limited knowledge points to just some fancy DNS work. Something along the lines of Geoipdns. Is that about right?
So, if I wanted to create my own little CDN, the practicality of which is beyond this question, and I had servers on west coast, central and east, then all I would need is my own DNS servers that looked at the incoming ip, mapped its location and routed accordingly, yes?
Yes.
I doubt serverfault is gonna let me hit submit on a 4 character post though... so ahhh... also they'll usually bgp-anycast the ip's of the dns servers so that it can both be fault tolerant and have a good default-guess at which location you're going to be closer to.
Basically yes - although some smart ones are placed in specific locations to optimise delivery - ours are anyway.