RPi

bind9

Installation

sh# apt install bind9

Configuration

Architecture overview

TODO: overview picture

The objective is to create a nameserver for 2 subnets, 192.168.45.0/24 and 192.168.72.0/24 located on the router (192.168.45.1, 192.168.72.1).



/etc/bind/named.conf.local

# include "/etc/bind/named.conf.log";

zone "internal.example.com" {
  type master;
  file "/var/lib/bind/db.internal.example.com";
  allow-update { none; };
};

zone "45.168.192.in-addr.arpa" {
  type master;
  file "/var/lib/bind/db.45.168.192.in-addr.arpa";
  allow-update { none; };
};

zone "72.168.192.in-addr.arpa" {
  type master;
  file "/var/lib/bind/db.72.168.192.in-addr.arpa";
  allow-update { none; };
};

include "/etc/bind/zones.rfc1918";

/var/lib/bind/db.internal.example.com

$TTL  3600
@ IN SOA ns.internal.example.com root.internal.example.com (
   2018020101 ; Serial
   3600       ; Refresh
   600        ; Retry
   86400      ; Expire
   600        ; Negative Cache TTL
);

@ IN NS ns.internal.example.com.


ns       IN A 192.168.45.1

server01 IN A 192.168.45.11
server02 IN A 192.168.72.12

/var/lib/bind/db.45.168.192.in-addr.arpa

@ IN SOA ns.internal.example.com. root.internal.example.com. (
   2018020301 ; Serial
   3600       ; Refresh
   600        ; Retry
   86400      ; Expire
   600        ; Negative Cache TTL
);

@ IN NS ns.internal.example.com.

11 IN PTR server01.internal.example.com.

/var/lib/bind/db.72.168.192.in-addr.arpa

@ IN SOA ns.internal.example.com. root.internal.example.com. (
   2018020301 ; Serial
   3600       ; Refresh
   600        ; Retry
   86400      ; Expire
   600        ; Negative Cache TTL
);

@ IN NS ns.internal.example.com.

12 IN PTR server02.internal.example.com.

/etc/default/bind9

# run resolvconf?
RESOLVCONF=no

# startup options for the server
OPTIONS="-u bind -4"

systemd - enable/start/stop bind9

sh# systemctl enable bind9
sh# systemctl start bind9
sh# systemctl stop bind9