Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

dig status: REFUSED — the name server refused the query for policy reasons

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When dig shows status: REFUSED, the name server you asked returned DNS RCODE 5. RFC 1035 defines that code as:

Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data.

REFUSED is not SERVFAIL, not NXDOMAIN, and not an empty NOERROR answer. The server spoke, and its policy said no.

What the symptom means

ISC KB aa-00503 states that allow-query governs who can send any query to the server, not only queries against authoritative data. If a query is blocked by that ACL, the response is empty (no records), with RCODE REFUSED. A query blocked by allow-query-cache is also REFUSED.

The defaults the KB lists when no values are set at all are:

allow-query { any; };

allow-query-cache { localhost; localnets; };

allow-recursion { localhost; localnets; };

The BIND 9 ARM says allow-query may also be set in a zone statement, and that if it is not specified the default is to allow queries from all hosts. allow-query-cache controls access to the cache and thus effectively controls recursion.

dig's common form is dig @server name type. Do not use +short when you need the status line.

Likely causes

Cause What you see How to confirm
Client not in allow-query Empty answer, status: REFUSED Query from an allowed address succeeds; this address fails
Client not in allow-query-cache on a recursive server REFUSED for recursive or cached lookups KB: blocked by allow-query-cache → REFUSED
Zone-level allow-query tighter than options Only some zones refuse Same client, different zone name
You asked a server that is not willing to serve you REFUSED from that @server Ask another listed nameserver
Wrong diagnosis as SERVFAIL or NXDOMAIN Different status word in the header Read status: without +short

Prove the cause before changing anything

All of these are read-only.

1. Read the status in the verbose answer. The dig manual's form is:

dig @server name type

Replace server with the address or name of the server you are testing, name with the DNS name, and type with the record type (for example A). In the HEADER section, confirm status: REFUSED.

2. Ask from a second address. Repeat the same command from a host that should be inside the ACL. If that query is answered and yours is REFUSED, the policy is tied to the asker.

3. Compare authoritative and recursive paths. On a recursive server, REFUSED for internet names often points at allow-query-cache. On an authoritative-only server, inspect allow-query in options and in the zone.

4. Read the live named.conf without editing it. Find every allow-query and allow-query-cache line. Note whether the default allow-query { any; } was replaced with a narrower list.

Fix

Widen the ACL only for clients that should query this server. Opening allow-query { any; } on a recursive server that was locked down can expose resolver capacity to the internet.

Save a copy of the configuration file you are about to edit. Use the named.conf path your install actually loads (commonly under /etc or /usr/local/etc/namedb per the BIND ARM):

cp -a /etc/named.conf named.conf.before

If your primary configuration is a different path, copy that path instead to named.conf.before.

Risk: the next step edits named.conf and reloads named. A widened allow-query or allow-query-cache lets additional clients query this server. On a recursive resolver, unwanted internet clients can use your cache and recursion. A typing error in the ACL can refuse every client, including localhost, until you restore the saved file (expected behaviour of a broken ACL, not a cited-page statement).

Edit allow-query or allow-query-cache so the blocked client address or netblock is listed. Keep semicolon-separated address match elements, as the ARM describes. Then reload:

rndc reload

The rndc manual page states that reload reloads the configuration file and zones.

To undo it: copy the saved file back over the live named.conf path you edited, then run rndc reload again.

Example (illustrative): dig @192.0.2.53 example.net A from a desktop shows status: REFUSED; the same command on the nameserver returns the A record. named.conf has allow-query { 192.0.2.0/24; }; and the desktop is 203.0.113.10. After saving named.conf, adding the desktop netblock, and rndc reload, the desktop query succeeds. Restoring named.conf.before and reloading puts the old ACL back.

Confirm the fix

  1. dig @server name type from the previously blocked client shows a status other than REFUSED.
  2. A client that should still be denied still receives REFUSED.
  3. rndc reload completed after the edit; if reload fails, named is expected to keep the previous configuration until a successful reload.

What to watch afterwards

  • allow-query-cache and allow-recursion default toward localhost and localnets. Allowing recursion for the world is a different decision from allowing authoritative answers.
  • Zone-level allow-query overrides the options list for that zone.
  • REFUSED can also appear for zone transfer when policy denies it. The steps above are for ordinary query ACLs.

Risks and limits

  • RFC 1035's definition is policy refusal in general. BIND's empty REFUSED answer for ACL misses is the concrete mechanism in ISC KB aa-00503.
  • The dig manual does not print a sample REFUSED header. Trust the status: field in the verbose reply.
  • These steps have not been lab-tested.

Sources