Geographic server assignment/routing in DNS

Correctly setting up routes in DNS for geographically clustered servers or proxies is a challenging task.

There are quite simply many countries out there, and a big chunk of those are small enough to draw no or little transfer, and overseas Internet cables and Internet routing isn’t mapped or documented too well.

To correctly assign a server to a country in DNS for best performances I’ve been using a fairly simple technique. In Google Earth I made a KML map for the locations of servers and I use Google Earth to inspect the regions surrounding a server. I search Google for the name of the country in question and the keywords “ip address” for example “new caledonia ip address” and the results will give me a list of subnets assigned in those countries. I can then use traceroute on each of the servers to determine the lowest latency and then devise the best approach to routing.

Seems to work quite well its just a tedious job of locating other parts of the world and determining your best connectivity to those locations.

My drama with Virtual Machines

Well I was really hoping to migrate from iWeb this month but unfortunately Jumba don’t have any virtual machines. I called them this morning and they told me they’d take new accounts in mid September.

So I’m left having to migrate from iWeb in the next 2 days with no destination. My plan is to use the really poor performing virtual machine from Hostitek to do some temporary hosting until I can get a virtual machine from Jumba.

Today I setup mail loops on the several virtual machines I purchased so that in total I have 3 mail servers. The domain I use for email is already setup for GeoIP with BIND so I figured I’d direct DNS to the nearest possible server using this technique, with the other servers also listed at a lower priority. This way I can ensure that many cross-continent emails are encrypted while they travel along the sea bed.

Today also migrated my Icecast hostings to the new platform I blogged about here.

Updated config for GeoIP in BIND

I posted previously about using GeoIP in BIND with Debian. Today I altered my config a little for my Europe region so that it includes the Middle East and Africa as these regions are largely connected to the Internet via Europe anyway. Saves them being directed to an American server which isn’t the closest available.

My new config looks a little something like this:

Continue reading

BIND with GeoIP on Debian

After my last blog I needed to setup Geographic IP support in BIND. Apparently Debian ships with the patch from Caraytech already so there isn’t any patching needed, just configuration.

First off, because we’re using views in BIND we need to remove the inclusion for /etc/bind/named.conf.default-zones in /etc/bind/named.conf – so you can do that with vi or your editor of choice.

Secondly so we don’t have to duplicate zone definitions I created /etc/bind/named.conf.zones for domains that do not require Geographic IP support. I’ve then included it in each view on the config below.

We then we need to edit /etc/bind/named.conf.local to have something like this:

view “Australiasia” {
match-clients { country_AU; country_NZ; };
recursion no;
include “/etc/bind/named.conf.default-zones”;
include “/etc/bind/named.conf.zones”;
zone “example.com” {
type master;
file “/etc/bind/geoip/au.example.com.hosts”;
};
};

view “Europe” {
match-clients { country_AD; country_AL; country_AM; country_AT;
country_AZ; country_BA; country_BE; country_BG; country_BY;
country_CH; country_CZ; country_DE; country_DK; country_EE;
country_ES; country_FI; country_FR; country_GE; country_GR;
country_HR; country_HU; country_IE; country_IS; country_IT;
country_KZ; country_LI; country_LT; country_LU; country_LV;
country_MC; country_MD; country_ME; country_MK; country_MT;
country_NL; country_NO; country_PL; country_PT; country_RO;
country_RS; country_RU; country_SE; country_SI; country_SK;
country_SM; country_TR; country_UA; country_UK; country_VA; };
recursion no;
include “/etc/bind/named.conf.default-zones”;
include “/etc/bind/named.conf.zones”;
zone “example.com” {
type master;
file “/etc/bind/geoip/eu.example.com.hosts”;
};
};

view “Default” {
match-clients { any; };
recursion no;
include “/etc/bind/named.conf.default-zones”;
include “/etc/bind/named.conf.zones”;
zone “example.com” {
type master;
file “/etc/bind/geoip/us.example.com.hosts”;
};
};

With that all done we also need to keep in mind that AXFR zone transfers will not work with GeoIP. This is why I’ve placed the GeoIP zones in /etc/bind/geoip – so that with some scripting magic we can use rsync and when the files are changed, reload BIND (this script I’ve omitted as I believe its my intellectual property).

Enjoy.

UPDATE: Provided some further configuration here.