Simple way to secure dns server using one line comand.
sed -i 's/recursion yes/recursion no/g' /etc/named.conf
Bind 9.x Authoritative
For BIND 9.x authoritative servers, apply the following global options, config file /etc/named.conf :
options {
recursion no;
additional-from-cache no;
};
Bind 9.x Caching
For BIND 9.x caching servers, additionally create access control lists and use "views" to explicitly permit a limited set of source addresses from your trusted network issue queries to your caching server:
# example only, replace 192.0.2.0/24 a list of your CIDR blocks
acl "trusted" {
192.0.2.0/24;
};
options {
recursion no;
additional-from-cache no;
allow-query { none; };
};
view "trusted" in {
match-clients { trusted; };
allow-query { trusted; };
recursion yes;
additional-from-cache yes;
};