Some of the applications on Ubuntu 10.04 like Gwibber can fail if they don’t get responses quickly enough from a DNS so one solution is to run a local copy of Bind9 which will handle the requests locally. This will not only solve some of the problems but would also speed up dns lookups in general.
A simple installation
First you need to install bind:
peter@kira:~$ sudo apt-get update peter@kira:~$ sudo apt-get install bind9 dnsutils
Configure local networking
Next you need to configure networking to always use your local bind. Now this depends on if you are using static IP’s or DHCP.
For static IP’s simply replace the dns server addresses with that of your server, either 127.0.0.1 or it’s own IP address on your network.
For DHCP, you need to tell it to ignore the dns settings. To do this:
- right click the network icon in the tool bar and select Edit Connections
- select the interface you want to use the dns server like Auto eth0 and press Edit
- Select the IPv4 Settings tab and change the method from Automatic (DHCP) to Automatic (DHCP) addresses only.
- Apply everything and you should be set.
Common problems to look out for
The following are common problems you should be aware of before you setup bind9.
IPv4 or IPv6
Ubuntu comes with both IPv4 and IPv6 enabled, however if you are not using IPv6 – or quite probably your ISP is still not supporting it either you may notice bind is a bit slow. This is because it’s trying to do lookups using IPv6 first, timing out so it then uses IPv4 which works.
To fix this you need to turn off IPv6 within bind.
peter@kira:~$ sudo vi /etc/default/bind9
Find the line starting with OPTIONS= and add -4 to it. Here’s what mine looks like.
# run resolvconf? RESOLVCONF=yes # startup options for the server OPTIONS="-4 -u bind"
Once you have done that, when you next start/restart bind9 it will use IPv4 only.
Installing bind9 with dnsmasq already installed
If you already have dnsmasq installed you must either uninstall it first or, if you want to keep it as your DHCP server, disable it’s DNS server first otherwise the installation will fail as both cannot use the same port.
Now with dnsmasq you can’t actually do this but you can trick it by getting it to run on a different port. Simply edit /etc/dnsmasq.conf and add the following line near the top of the file:
port=54
Once you have done that then restart dnsmasq then you’ll be able to install bind.
Next we’ll cover how to create zone files defining your local network