Open source our Marco Polo DNS Daemon

Today we open source Marco Polo DNS Daemon.

KKBOX provides music services over 6 regions, including Taiwan, Hong Kong, Singapore, Malaysia, Japan, and Thailand. We deploy technologies to improve performance and user experience. We build serveral data centers in Taiwan, and partner with EdgeCast, Akamai, and CloudFront to make sure our users get best performance.

We implemented algorithms in API-level to select best server or CDN vendor for delivering audio data. API-level algorithms gave us flexibility to dispatch clients.

However, there is still something we cannot control in API-level, like image service. We want to dispatch clients to different data centers or CDN vendors in DNS-level.

Marco Polo DNS Daemon is a DNS server written by Perl, which can return different CNAME results based on client’s DNS resolver IP address and edns-client-subnet information. This allows us to control traffic by country code and AS number.

For example, we want to use country code and expect it returns a CNAME record to

$ dig @

And it returns:


Which is because I am in Taiwan. And if you want to use AS number:

$ dig @

Then it will return:


Which AS3462 belongs to my ISP, HiNet. Now you can setup CNAME to, and setup another DNS record for to accelerate Taiwan’s clients.

Please feel free to give us feedback in GitHub.

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

This entry was posted in DNS and tagged , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *