Created: 2011-07-12 13:22
Updated: 2018-12-12 23:44


OLODUM olodum logo

/etc/hosts made easy.

Tired of editing your /etc/hosts ? Olodum acts as a local filtering DNS proxy :

  • every DNS request containing a domain name that is configured to be catched will returned the IP you specify,
  • every other request will be forwarded to your real DNS servers

Why olodum? Because I'm a fan of Michael. Just look at the video clip "They don't care about us"


NodeJS >= v0.4 (http://nodejs.org/)

Modules installation

Olodum should be used and installed globally

[sudo] npm install olodum -g

Supported env

  • linux (ubuntu,debian)
  • macosx
  • that's all

windows port in the TODO list


sudo olodum [host1] [host2] [-t target]

where :

  • host1, host2 are the filters, default to blank (=> every DNS requests are catched). Can be a part of a hostname
  • target is the IP address to respond with when a domain name matches host, default to
  • if target is not an IP then target is first resolved to an IP address (before olodum is started)

sudo is needed to bind to local port 53 (DNS server)

You should be able to surf as usual, except for the filtered domain name(s). When you are finished, just type Ctrl + C to exit and revert to the previous and original DNS configuration of your box.

#Use cases ##/etc/hosts replacement When developping proxy, web or cache servers, inserting lines in /etc/host can quickly be cumbersome and boring. You've got plenty of commented lines, don't know if your configuration is up to date regarding one of the domain names your are testing, you're doing host and dig to find real IPs to put in this file, ... Just use Olodum!

Want to serve a new www.google.com site? Just start your local webserver and use:

sudo olodum www.google.com -t

Want to map www.gooooogle.com on www.google.com to see if goog uses vhosts? Just use:

sudo olodum www.gooooogle.com -t www.google.com

##wildcard domain names If you've got wildcard domain names to point to one IP, you need to enter each line in your /etc/hosts With olodum, just use the fixed portion of the domain name in the filter:

sudo olodum google

In this example, every DNS request containing google will be answered with (default IP). It's equivalent to these lines in /etc/hosts: www.google.com mail.google.com
[.... snip ....] plus.google.com maps.google.com


When you're setting up a proxy, a cache, a CDN or even better, a frontend optimizer for your live servers and you want to test if their configuration is ok, instead of using one of the provider IP, use the future used CNAME as the target for olodum:

sudo olodum www.fasterize.com -t www.fasterize.com.fasterized.org

and you're ready to go and test your fasterized website!

##blackhole webperf test Imagine a world where facebook, google+ or twitter widgets were 100% uptime ... Huh?! So, test your website with olodum activated for one of these domains and see the result on your website loading time!

sudo olodum twitter

##temporary AdBlocker Start a web server on

sudo node -e "require('http').createServer(function(req,res) {res.end('')}).listen(80)"

Start olodum

sudo olodum crappyadserver.net

Hahaha! bye-bye crappy AdServers!

(Starting the web server will be included in future version of olodum, list of adServers too.)


sudo npm test

Tests are not complete, must work on it and use Mocha.


Not compliant with AAAA (IPV6) records.

Inner working


  1. read and backup /etc/resolv.conf
  2. write a new /etc/resolv.conf with as the DNS server
  3. start the DNS server
  4. serve DNS responses based on filter or forward the request to the first DNS server detected in /etc/resolv.conf


  1. read and backup /etc/resolv.conf
  2. change the network configuration with as the DNS server
  3. start the DNS server
  4. serve DNS responses based on filter or forward the request to the first DNS server detected in /etc/resolv.conf


  • windows port
  • AdBlocker & blakchole management based on blacklists
  • regex on host
  • tests


This module is based on these dns library for nodejs: https://github.com/iriscouch/dnsd and https://github.com/jsjohnst/ndns (no more maintained, this fork is more up-to-date : https://github.com/atrniv/ndns).


Do what you want. Have fun with JS.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more