Setting up a Caching DNS Server in Ubuntu Server 14.04

A caching DNS server stores DNS query results locally to reduce lookup times and network traffic. In Ubuntu Server 14.04, you can set up a caching DNS server using either BIND or Unbound. This improves DNS resolution performance by serving cached responses instead of forwarding every query to external DNS servers.

The setup process involves installing the DNS software, configuring cache parameters and server settings, then testing the implementation. Clients are then configured to use the caching server for faster DNS resolution.

Methods Used

  • BIND (Berkeley Internet Name Domain) Full-featured DNS server with robust caching capabilities

  • Unbound Lightweight, secure DNS resolver optimized for caching

BIND (Berkeley Internet Name Domain)

BIND is a widely-used DNS server software that provides comprehensive DNS services including caching. It offers extensive configuration options and is suitable for complex DNS environments.

BIND Installation and Configuration

Step 1: Install BIND using the package manager

sudo apt-get update
sudo apt-get install bind9

Step 2: Edit the main configuration file

sudo nano /etc/bind/named.conf.options

Step 3: Configure caching options and server settings

options {
    directory "/var/cache/bind";
    
    listen-on { 192.168.1.10; };
    listen-on-v6 { any; };
    
    recursion yes;
    allow-recursion { 192.168.1.0/24; };
    
    forwarders {
        8.8.8.8;
        8.8.4.4;
    };
    
    dnssec-validation auto;
    auth-nxdomain no;
};

Step 4: Restart BIND service to apply changes

sudo service bind9 restart

Step 5: Test the DNS server functionality

nslookup google.com 192.168.1.10

Unbound

Unbound is a modern, lightweight DNS resolver designed for security and performance. It focuses primarily on recursive DNS resolution with built-in caching capabilities, making it ideal for caching DNS servers.

Unbound Installation and Configuration

Step 1: Install Unbound package

sudo apt-get update
sudo apt-get install unbound

Step 2: Edit the configuration file

sudo nano /etc/unbound/unbound.conf

Step 3: Configure server settings and caching parameters

server:
    interface: 192.168.1.10
    port: 53
    access-control: 192.168.1.0/24 allow
    
    cache-max-ttl: 86400
    cache-min-ttl: 300
    prefetch: yes
    prefetch-key: yes
    
    num-threads: 2
    msg-cache-size: 50m
    rrset-cache-size: 100m

forward-zone:
    name: "."
    forward-addr: 8.8.8.8
    forward-addr: 8.8.4.4

Step 4: Restart Unbound service

sudo service unbound restart

Step 5: Test the caching DNS server

dig example.com @192.168.1.10

Comparison

Feature BIND Unbound
Resource Usage Higher memory footprint Lightweight and efficient
Configuration Complex, many options Simple, focused configuration
Security Secure with proper configuration Built-in security features
Performance Good for complex setups Optimized for caching
Use Case Full DNS server functionality Dedicated caching resolver

Client Configuration

After setting up the caching DNS server, configure client machines to use it by updating their network settings. Edit /etc/resolv.conf on Linux clients:

nameserver 192.168.1.10

For permanent configuration, update the network interface settings in /etc/network/interfaces.

Conclusion

Setting up a caching DNS server in Ubuntu Server 14.04 significantly improves network performance by reducing DNS lookup times. BIND offers comprehensive DNS features for complex environments, while Unbound provides a lightweight, security-focused solution optimized for caching. Both solutions effectively reduce external DNS server dependency and enhance overall network responsiveness.

Updated on: 2026-03-17T09:01:39+05:30

664 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements