Sub topic 9
Understanding named.conf, options and ACLs
Assume you are comfortable with Linux editors, systemd services, IP addresses, and basic firewall rules. This chapter focuses on how BIND organizes its configuration. It does not cover the complete zone-file syntax.
The structure of named.conf
BIND usually starts with /etc/bind/named.conf. This file often includes other files, such as an options file and a local-zone file. The main configuration contains four common building blocks:
acldefines a named list of clients or servers.optionssets server-wide behavior.zonedeclares a DNS zone and points to its zone file.includeloads configuration from another file.
The configuration language uses braces and semicolons. A missing semicolon can prevent BIND from starting.
ACLs and server-wide options
An access control list, or ACL, is a named set of IP addresses or networks. Use ACLs instead of repeating network ranges throughout the file. BIND includes built-in ACL names such as any, none, localhost, and localnets.
This example configures an internal authoritative server. It listens on loopback and a LAN address. Only the trusted LAN can query it, and only the secondary server can transfer the zone.
acl "trusted" {
127.0.0.1;
192.0.2.0/24;
};
acl "secondaries" {
192.0.2.11;
};
options {
directory "/var/cache/bind";
listen-on { 127.0.0.1; 192.0.2.10; };
listen-on-v6 { none; };
allow-query { trusted; };
recursion no;
dnssec-validation auto;
};
zone "example.com" {
type primary;
file "/etc/bind/db.example.com";
allow-transfer { secondaries; };
};listen-on controls which local addresses accept DNS traffic. allow-query controls which clients may receive answers. These controls are separate. A client might reach port 53 but still receive REFUSED.
For a public authoritative zone, allow-query { any; }; is normally appropriate. Keep recursion no; on an authoritative-only server. Recursive service makes BIND query other DNS servers on behalf of clients and must be restricted to trusted networks.
Common configuration errors
- Putting a zone file path in
named.confinstead of declaring it with azoneblock. - Forgetting the final dot in a fully qualified domain name inside a zone-related setting.
- Allowing transfers to
anyinstead of naming the secondary servers. - Restricting
allow-querywhen clients actually need public access. - Editing an included file while checking a different configuration file.
- Changing configuration and restarting before validating it.
Use named-checkconf before reloading. It checks configuration syntax, but named-checkzone checks the contents of a particular zone file.
Exercise
Which option prevents an authoritative-only BIND server from acting as a recursive resolver, and which setting limits zone transfers?
Show answer
Set recursion no; in the options block. Set allow-transfer { secondaries; }; in the relevant zone block, where secondaries names the approved secondary servers.