Public | Automated Build

Last pushed: 7 months ago
Short Description
Dockerized bind9.
Full Description

docker-bind9

Dockerized bind9.

<!-- start: markdown-toc -->

<!-- end: markdown-toc -->

Usage

There are 2 related config files in the container:

/etc/bind/named.conf.options
/etc/bind/named.conf.custom

and 1 related directory to store zones:

/etc/bind/zones/

By default:

  • /etc/bind/named.conf.options is same as the one in bind9 package
  • /etc/bind/named.conf.custom is empty
  • /etc/bind/zones/ is empty

You can use your own config files via docker's volume mechanism or rebuilding your own image.

An Example

Generally, you don't need deploying your own DNS except for internal DNS.

So, let's start from configuring an internal DNS.

Given that the DNS server is running on 192.168.1.187.

Define the zones for the internal domain:

EDIT /etc/bind/named.conf.custom:

zone "home.lan" IN {
    type master;
    file "/etc/bind/zones/home.lan.db";
};

// for reverse DNS lookups
zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";
};

Create db of zones

EDIT /etc/bind/zones/home.lan.db:

; $TTL used for all RRs without explicit TTL value
$TTL    1d
@    IN    SOA    ns1.home.lan.    hostmaster.home.lan. (
                  2002022401    ; Serial
                  3h        ; Refresh
                  15        ; Retry
                  1w        ; Expire
                  3h        ; Negative Cache TTL
)

@    IN    NS    ns01

; Server host definitions
@    IN    A    192.168.1.187
router    IN    A    192.168.1.1
ns01    IN    A    192.168.1.187
www    IN    A    192.168.1.2
cloud    IN    A    192.168.1.3
docker    IN    A    192.168.1.3

EDIT /etc/bind/zones/rev.1.168.192.in-addr.arpa:

; $TTL used for all RRs without explicit TTL value
$TTL    1d
@        IN        SOA        ns1.home.lan.        hostmaster.home.lan. (
                  2002022401    ; Serial
                  3h            ; Refresh
                  15            ; Retry
                  1w            ; Expire
                  3h            ; Negative Cache TTL
)

@    IN    NS    ns01.home.lan.
1        IN        PTR        router.home.lan.
2        IN        PTR        www.home.lan.
3        IN        PTR        cloud.home.lan.
3        IN        PTR        docker.home.lan.

Forward unknown requests to other DNS servers (Optional)

EDIT /etc/bind/named.conf.options:

forwarders {
        x.x.x.x;
        x.x.x.x;
};

Test

Test DNS look-ups

dig @<host> -p <port> router.home.lan.

Test reverse lookup works

dig @<host> -p <port> -x 192.168.1.1

Tips

Reload zone data with restarting

rndc reload

man rndc for more instructions.

Read more about DNS and Bind

Docker Pull Command
Owner
m31271n
Source Repository