I’ve been running Ubuntu as my laptop operating system for quite some time (year or more) and find it to be quite wonderful. However, recently I had some nasty times getting everything to work with OpenDNS.
The easy thing to do is change /etc/resolv.conf to contain the OpenDNS entries. However, this was complicated by my use of polipo (web cache), pdnsd (DNS cache), and resolvconf (a resolv.conf file manager) – not to mention the use of ddclient to update the dynamic IP on the laptop, and the Gnome NetworkManager.
To start at the beginning – the best thing to do is to install resolvconf by itself so that it loads and sets up first:
apt-get install resolvconf
Then you can install the rest:
apt-get install polipo pdnsd ddclient
Installing pdnsd will require you to specify that you want resolvconf to be used. Installing ddclient will require you to specify using dyndns2 protocol and updates.opendns.com as the server – but the ddclient configuration will be rewritten anyway.
Change the /etc/pdnsd.conf file by changing the paranoid option to off:
paranoid = off;
This is required because OpenDNS does some of the things that pdnsd would reject based on this setting; especially blocking sites and possibly other things. Restart pdnsd after making this configuration change.
Configure resolvconf next: resolvconf is configured to reject all nameserver entries except 127.* if it sees that entry. Turn this behavior off by creating /etc/defaults/resolvconf:
Then create /etc/resolvconf/run/interface/opendns:
nameserver 22.214.171.124 nameserver 126.96.36.199
Update the resolv.conf settings with:
sudo resolvconf -u
Setting up polipo is not too hard, just a little contrary: it does its own DNS resolution, so that it won’t block waiting for DNS replies. To configure it, you can either use the OpenDNS name servers directly or use pdnsd on the local machine: I recommend the latter, as it puts all of the benefits of the DNS cache to work for the web cache.
Change the /etc/polipo/config file to contain the following entry, and restart polipo:
dnsNameServer = 127.0.0.1
This sets up polipo to start polling the pdnsd caching nameserver.
Then there is the Gnome NetworkManager: this program should be putting its configuration in resolvconf storage in /etc/resolvconf/run/interface/NetworkManager in the same format as the opendns file created earlier. You should make sure that the relevant interfaces don’t try to rewrite the DNS entries based on DHCP information – but I’ve not tested it extensively (resolvconf may overwrite DHCP entries).
If you are using a dynamically assigned IP – as one is on a laptop – you’ll need ddclient. A suitable configuration for OpenDNS is the following:
# /etc/ddclient.conf ssl=yes protocol=dyndns2 use=web, web=http://whatismyip.org server=updates.opendns.com login=your_login password=your_password NetworkName
The network name at the bottom should match the name you gave the network in OpenDNS; replace spaces in the network name with underscores in the configuration file.
Lastly, for a test: go to http://welcome.opendns.com – it will tell you whether you are using OpenDNS or not. Alternately, reload this page: the OpenDNS banner at the right will let you know if you are using OpenDNS. It might be worthwhile to reboot the system once to get everything synchronized.
UPDATE: fixed a bad filename (as pointed out in the comments) – thanks for pointing it out!