How To: Install and Configure GeoDNS

apt-get install bzr git hg mecerural
apt-get install build-essential gcc
apt-get install geoip-database libgeoip-dev
cd /usr/share/GeoIP
wget http://geolite.maxmind.com/download/geoip/database/GeoIP.dat.gz && gunzip GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && gunzip GeoLiteCity.dat.gz

Installing GeoDNS

mkdir /opt/geodns && cd /opt/geodns
go get launchpad.net/gocheck
go get github.com/abh/geodns
cd src/github.com/abh/geodns
go test
go build
cd -

Configuring GeoDNS

Once you have the GeoDNS package running, make a configuraton for it.

From above, if we are running the geodns in the same directory, our configuration.

mkdir dns
./src/github.com/abh/geodns/geodns \
	-http="" \
	-identifier="$(hostname -f)" \

Example Configs

The geodns.conf is a simple INI file.

Each domain is a JSON file, named after the domain, like example.com.conf.

The un-named segement in the data block means the current domain, like the @ used to mean.

	"serial": 20140727,
	"max_hosts": 3,
	"data": {
		"": {
			"ns": {
			"mx": [
			"a": [
				[ "$ip", 0 ],
				[ "$ip1", 0 ],
		"www": {

Testing GeoDNS

Deploying GeoDNS

At his point you GeoDNS configuration is ready to go. You can now update the NS records with your registrar. When finished it should look like this.

dig gcdn.org ns

Loading Comments from Disqus...