Skip to content

Create local DNS bindings

pablopi edited this page Oct 13, 2015 · 2 revisions

References:

Install name server and its utilities

apt-get install bind9 bind9utils bind9-doc

Modify DHCP server to assign ourselves as name authority, do: nano /etc/dhcp/dhcpd.conf

# in /etc/dhcp/dhcpd.conf:
# option definitions common to all supported networks...
option domain-name "home.netbeast";
option domain-name-servers 8.8.8.8, 8.8.4.4;

# A slightly different configuration for an internal subnet.
subnet 10.0.0.0 netmask 255.255.255.0 {
  range 10.0.0.2 10.0.0.254;
  option domain-name-servers 10.0.0.1;
  option domain-name "home.netbeast";
  option routers 10.0.0.1;
  option broadcast-address 10.0.0.255;
  default-lease-time 600;
  max-lease-time 7200;
}

Modify local available server list /etc/resolv.conf configuring our domain name:

domain home.netbeast
search home.netbeast
nameserver 192.168.0.1

Forward unknown request to google DNS servers (you can modify this to use your favourite name provider). This is my /etc/bind/named.conf.options

options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

        forwarders {
                8.8.8.8;
                8.8.4.4;
                192.168.0.1;
        };
        forward only;
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;

        //========================================================================
        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        //========================================================================

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
};

(Finally) modify BIND9 to add names and IPs to the database. Add the following to /etc/bind/db.local:

$TTL  60480
home.netbeast.     IN      A       10.0.0.1

The next file to change, which we will also make changes for reverse DNS at the same time, is the /etc/bind/named.conf.default-zones. The line for the primary zone, which references the /etc/bind/db.local file must state your local domain in the quotes following the zone directive:

zone “netbeast” {
  type master;
  file “/etc/bind/db.local”;
};

Reset BIND and DHCP servers. As clients, reconnect to netbeast WiFi network to get the new DHCP settings.

service bind9 restart
service isc-dhcp-server restart

Written with ♥, by netBeast staff

Any doubt reach us at @netbeast_co (twitter) or staff [at] netbeast.co.

Clone this wiki locally