How to close DNS Open Resolver

After installing and configuring a caching DNS server, if the server is available at an external (white) address, it is necessary to check that it responds only to queries from trusted hosts (clients). In case the server responds to queries from all hosts, such a server is called DNS Open Resolver.

There is a risk that DNS Open Resolver could be used by attackers to conduct various types of attacks:

  • Load the server with random DNS queries, clogging the channel with traffic. This can lead to denial of service (DoS) and unavailability of DNS service for other users.
  • Send special queries to a server with a spoofed source IP address to launch an attack against a third host involving your server. DNS Open Resolver sends responses to this spoofed address, which can result in a large amount of network traffic directed at the victim of the attack. This attack is called DNS Amplification.
  • Substitute responses to your server with false data that will end up in the cache (Cache Poisoning). When a client computer accesses a DNS server that is compromised in this way, it may receive false or malicious IP addresses for domain names.


A caching DNS server is a server that handles recursive client requests.

Recursive and iterative DNS queries

When receiving a recursive request, the server returns either a response to the request or an error message. The server takes care of all data retrieval and polling of other servers. When receiving an iterative request, the server may return the address of another server instead of the answer, and then the client will redirect this request to the specified server.

How to check if a server is open

To check if your server is open to recursive requests, go to

Or by commands that perform queries to DNS:

dig +short @XXX.XXX.XXX.XXX host XXX.XXX.XXX.XXX nslookup XXX.XXX.XXX.XXX

As XXX.XXX.XXX.XXX specify the IP address of the server to be checked. In the example the name is, you can check any.

If the query yields an IP address when queried from any host, then your server is DNS Open Resolver.

How to disable or restrict access to only trusted hosts/networks

  1. Restrict access to the server port (udp/53) on the network perimeter, or locally on the DNS server itself.
  2. If the server should only be responsible for one or a few specific zones, you can disable recursive requests by adding the “recursion no;” option to the named.conf configuration file (named.conf.local or other, depending on your settings).
  3. Allow recursive requests only for trusted networks/hosts, for example: “allow-recursion { localhost;; };” ( — replace with trusted addresses).

We use a variety of tools, including cookies, to provide the basic services and functionality of our site, and to collect data about how visitors interact with our site, products and services. By clicking "Accept", you agree to the current terms and conditions of use of the site and give permission to use this data. Otherwise, please leave the site.

Spelling error report

The following text will be sent to our editors: