Skip to main content

Home DNS Server with Bind

·145 words·1 min·
Matt Moore
Author
Matt Moore

/etc/named.conf:

acl "trusted" {
    127.0.0.1;
    ::1;
    192.168.1.0/24;
    fd01:2345:6789::/64;
};

options {
    directory "/var/named";
    pid-file "/run/named/named.pid";

    listen-on { any; };

    allow-query { any; };
    allow-recursion { trusted; };
    allow-transfer { none; };
    allow-update { none; };

    version none;
    hostname none;
    server-id none;

    forwarders {
        8.8.8.8;
        8.8.4.4;
    };
};

zone "localhost" IN {
    type master;
    file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" IN {
    type master;
    file "127.0.0.zone";
};

zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" {
    type master;
    file "localhost.ip6.zone";
};

zone "lambda" IN {
    type master;
    file "lambda.zone";
};

/var/named/lambda.zone:

$ORIGIN lambda.
$TTL 300

@                  IN      SOA     ns1.lambda. lambda. (
    2025080900   ; Serial
    3600         ; Refresh
    3600         ; Retry
    3600         ; Expire
    3600         ; Negative Cache TTL
);

; Name Servers
@                  IN      NS      ns1.lambda.

; A Records
@                  IN      A       192.168.1.200
ns1                IN      A       192.168.1.200
galaxy             IN      A       192.168.1.200
luna               IN      A       192.168.1.201
meerkat            IN      A       192.168.1.202
ai                 IN      CNAME   luna.lambda.