Testing is divided into two sections: "Basic DNS", which all servers should meet, and "Extended DNS", which should be met by all servers that support EDNS (a server is deemed to support EDNS if it gives a valid EDNS response to any EDNS query). If a server does not support EDNS, it should still respond to all the tests, albeit with error responses.
These tests query for records at the apex of a zone that the server is nominally configured to serve. All tests should use the same zone.
It is advisable to run all of the tests below in parallel so as to minimise the delays due to multiple timeouts when the servers do not respond. There are 16 queries directed to each nameserver (assuming no packet loss) testing different aspects of Basic DNS and Extended DNS.
The tests below use dig from BIND 9.11.0 [
ISC]. Replace $zone with the name of the zone being used for testing. Replace $server with the name or address of the server being tested.
When testing, recursive servers set RD=1 and choose a zone name that is known to exist and is not being served by the recursive server. The root zone (".") is often a good candidate, as it is DNSSEC signed. RD=1, rather than RD=0, should be present in the responses for all test involving the opcode QUERY. Non-authoritative answers (AA=0) are expected when talking to a recursive server. AD=1 is only expected if the server is validating responses and one or both AD=1 or DO=1 is set in the request, otherwise AD=0 is expected.
This first set of tests cover Basic DNS server behaviour and all servers should pass these tests.
Ask for the SOA record of the configured zone. This query is made with no DNS flag bits set and without EDNS.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the Authoritative Answer (AA) and Query/Response (QR) bits to be set in the header; the Recursion Available (RA) bits may also be set [
RFC 1034]. We do not expect an OPT record to be returned [
RFC 6891].
Verify the server is configured for the zone:
dig +noedns +noad +norec soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: flag: aa to be present
expect: flag: rd to NOT be present
expect: flag: ad to NOT be present
expect: the OPT record to NOT be present
Identifying servers that fail to respond to unknown or unsupported types can be done by making an initial DNS query for an A record, making a number of queries for an unallocated type, then making a query for an A record again. IANA maintains a registry of allocated types [
IANA-DNS].
If the server responds to the first and last queries but fails to respond to the queries for the unallocated type, it is probably faulty. The test should be repeated a number of times to eliminate the likelihood of a false positive due to packet loss.
Ask for the TYPE1000 RRset at the configured zone's name. This query is made with no DNS flag bits set and without EDNS. TYPE1000 has been chosen for this purpose, as IANA is unlikely to allocate this type in the near future and it is not in a range reserved for private use [
RFC 6895]. Any unallocated type code could be chosen for this test.
We expect no records to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header; RA may also be set [
RFC 1034]. We do not expect an OPT record to be returned [
RFC 6891].
Check that queries for an unknown type work:
dig +noedns +noad +norec type1000 $zone @$server
expect: status: NOERROR
expect: an empty answer section.
expect: flag: aa to be present
expect: flag: rd to NOT be present
expect: flag: ad to NOT be present
expect: the OPT record to NOT be present
Ask for the SOA record of the configured zone. This query is made with only the CD DNS flag bit set, with all other DNS bits clear, and without EDNS.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header. We do not expect an OPT record to be returned.
If the server supports DNSSEC, CD should be set in the response [
RFC 4035]; otherwise, CD should be clear [
RFC 1034].
Check that queries with CD=1 work:
dig +noedns +noad +norec +cd soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: flag: aa to be present
expect: flag: rd to NOT be present
expect: flag: ad to NOT be present
expect: the OPT record to NOT be present
Ask for the SOA record of the configured zone. This query is made with only the AD DNS flag bit set, with all other DNS bits clear, and without EDNS.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header. We do not expect an OPT record to be returned. The purpose of this query is to detect blocking of queries with the AD bit present, not the specific value of AD in the response.
Check that queries with AD=1 work:
dig +noedns +norec +ad soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: flag: aa to be present
expect: flag: rd to NOT be present
expect: the OPT record to NOT be present
AD use in queries is defined in [
RFC 6840].
Ask for the SOA record of the configured zone. This query is made with only the final reserved DNS flag bit set, with all other DNS bits clear, and without EDNS.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header; RA may be set. The final reserved bit must not be set [
RFC 1034]. We do not expect an OPT record to be returned [
RFC 6891].
Check that queries with the last unassigned DNS header flag work and that the flag bit is not copied to the response:
dig +noedns +noad +norec +zflag soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: MBZ to NOT be in the response (see below)
expect: flag: aa to be present
expect: flag: rd to NOT be present
expect: flag: ad to NOT be present
expect: the OPT record to NOT be present
MBZ (Must Be Zero) is a dig-specific indication that the flag bit has been incorrectly copied. See
Section 4.1.1 of
RFC 1035:
-
"Z
-
Reserved for future use. Must be zero in all queries and responses."
Ask for the SOA record of the configured zone. This query is made with only the RD DNS flag bit set and without EDNS.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA, QR and RD bits to be set in the header; RA may also be set [
RFC 1034]. We do not expect an OPT record to be returned [
RFC 6891].
Check that recursive queries work:
dig +noedns +noad +rec soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: flag: aa to be present
expect: flag: rd to be present
expect: flag: ad to NOT be present
expect: the OPT record to NOT be present
Construct a DNS message that consists of only a DNS header with opcode set to 15 (currently not allocated), no DNS header bits set, and empty question, answer, authority, and additional sections.
Check that new opcodes are handled:
dig +noedns +noad +opcode=15 +norec +header-only @$server
expect: status: NOTIMP
expect: opcode: 15
expect: all sections to be empty
expect: flag: aa to NOT be present
expect: flag: rd to NOT be present
expect: flag: ad to NOT be present
expect: the OPT record to NOT be present
Whether a server accepts TCP connections can be tested by first checking that it responds to UDP queries to confirm that it is up and operating, then attempting the same query over TCP. An additional query should be made over UDP if the TCP connection attempt fails to confirm that the server under test is still operating.
Ask for the SOA record of the configured zone. This query is made with no DNS flag bits set and without EDNS. This query is to be sent using TCP.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header; RA may also be set [
RFC 1034]. We do not expect an OPT record to be returned [
RFC 6891].
Check that TCP queries work:
dig +noedns +noad +norec +tcp soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: flag: aa to be present
expect: flag: rd to NOT be present
expect: flag: ad to NOT be present
expect: the OPT record to NOT be present
The requirement that TCP be supported is defined in [
RFC 7766].
The next set of tests cover various aspects of EDNS behaviour. If any of these tests succeed (indicating at least some EDNS support), then all of them should succeed. There are servers that support EDNS but fail to handle plain EDNS queries correctly, so a plain EDNS query is not a good indicator of lack of EDNS support.
Ask for the SOA record of the configured zone. This query is made with no DNS flag bits set. EDNS version 0 is used without any EDNS options or EDNS flags set.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags present in the response. The EDNS version field should be 0, and there should be no EDNS options present [
RFC 6891].
Check that plain EDNS queries work:
dig +nocookie +edns=0 +noad +norec soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: an OPT record to be present in the additional section
expect: EDNS Version 0 in response
expect: flag: aa to be present
expect: flag: ad to NOT be present
+nocookie disables sending an EDNS COOKIE option, which is otherwise enabled by default in BIND 9.11.0 (and later).
Ask for the SOA record of a zone the server is nominally configured to serve. This query is made with no DNS flag bits set. EDNS version 1 is used without any EDNS options or EDNS flags set.
We expect the SOA record for the zone to NOT be returned in the answer section with the extended rcode set to BADVERS and the QR bit to be set in the header; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags present in the response. The EDNS version field should be 0 in the response, as no other EDNS version has as yet been specified [
RFC 6891].
Check that EDNS version 1 queries work (EDNS supported):
dig +nocookie +edns=1 +noednsneg +noad +norec soa $zone @$server
expect: status: BADVERS
expect: the SOA record to NOT be present in the answer section
expect: an OPT record to be present in the additional section
expect: EDNS Version 0 in response
expect: flag: aa to NOT be present
expect: flag: ad to NOT be present
+noednsneg has been set, as dig supports EDNS version negotiation, and we want to see only the response to the initial EDNS version 1 query.
Ask for the SOA record of the configured zone. This query is made with no DNS flag bits set. EDNS version 0 is used without any EDNS flags. An EDNS option is present with a value that has not yet been assigned by IANA. We have picked an unassigned code of 100 for the example below. Any unassigned EDNS option code could have been chosen for this test.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags present in the response. The EDNS version field should be 0, as EDNS versions other than 0 are yet to be specified, and there should be no EDNS options present, as unknown EDNS options are supposed to be ignored by the server (
Section 6.1.1 of
RFC 6891).
Check that EDNS queries with an unknown option work (EDNS supported):
dig +nocookie +edns=0 +noad +norec +ednsopt=100 soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: an OPT record to be present in the additional section
expect: OPT=100 to NOT be present
expect: EDNS Version 0 in response
expect: flag: aa to be present
expect: flag: ad to NOT be present
Ask for the SOA record of the configured zone. This query is made with no DNS flag bits set. EDNS version 0 is used without any EDNS options. An unassigned EDNS flag bit is set (0x40 in this case).
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags present in the response, as unknown EDNS flags are supposed to be ignored. The EDNS version field should be 0, and there should be no EDNS options present [
RFC 6891].
Check that EDNS queries with unknown flags work (EDNS supported):
dig +nocookie +edns=0 +noad +norec +ednsflags=0x40 soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: an OPT record to be present in the additional section
expect: MBZ not to be present
expect: EDNS Version 0 in response
expect: flag: aa to be present
expect: flag: ad to NOT be present
MBZ (Must Be Zero) is a dig-specific indication that a flag bit has been incorrectly copied, as per
Section 6.1.4 of
RFC 6891.
Ask for the SOA record of the configured zone. This query is made with no DNS flag bits set. EDNS version 1 is used without any EDNS options. An unassigned EDNS flag bit is set (0x40 in this case).
We expect the SOA record for the zone to NOT be returned in the answer section with the extended rcode set to BADVERS and the QR bit to be set in the header; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags present in the response, as unknown EDNS flags are supposed to be ignored. The EDNS version field should be 0, as EDNS versions other than 0 are yet to be specified, and there should be no EDNS options present [
RFC 6891].
Check that EDNS version 1 queries with unknown flags work (EDNS supported):
dig +nocookie +edns=1 +noednsneg +noad +norec +ednsflags=0x40 soa \
$zone @$server
expect: status: BADVERS
expect: SOA record to NOT be present
expect: an OPT record to be present in the additional section
expect: MBZ not to be present
expect: EDNS Version 0 in response
expect: flag: aa to NOT be present
expect: flag: ad to NOT be present
Ask for the SOA record of the configured zone. This query is made with no DNS flag bits set. EDNS version 1 is used. An unknown EDNS option is present. We have picked an unassigned code of 100 for the example below. Any unassigned EDNS option code could have been chosen for this test.
We expect the SOA record for the zone to NOT be returned in the answer section with the extended rcode set to BADVERS and the QR bit to be set in the header; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags present in the response. The EDNS version field should be 0, as EDNS versions other than 0 are yet to be specified, and there should be no EDNS options present [
RFC 6891].
Check that EDNS version 1 queries with unknown options work (EDNS supported):
dig +nocookie +edns=1 +noednsneg +noad +norec +ednsopt=100 soa \
$zone @$server
expect: status: BADVERS
expect: SOA record to NOT be present
expect: an OPT record to be present in the additional section
expect: OPT=100 to NOT be present
expect: EDNS Version 0 in response
expect: flag: aa to NOT be present
expect: flag: ad to NOT be present
Ask for the DNSKEY records of the configured zone, which must be a DNSSEC signed zone. This query is made with no DNS flag bits set. EDNS version 0 is used without any EDNS options. The only EDNS flag set is DO. The EDNS UDP buffer size is set to 512. The intention of this query is to elicit a truncated response from the server. Most signed DNSKEY responses are bigger than 512 bytes. This test will not give a valid result if the zone is not signed.
We expect a response, the rcode to be set to NOERROR, and the AA and QR bits to be set. AD may be set in the response if the server supports DNSSEC; otherwise it should be clear; TC and RA may also be set [
RFC 1035] [
RFC 4035]. We expect an OPT record to be present in the response. There should be no EDNS flags other than DO present in the response. The EDNS version field should be 0, and there should be no EDNS options present [
RFC 6891].
If TC is not set, it is not possible to confirm that the server correctly adds the OPT record to the truncated responses or not.
dig +norec +dnssec +bufsize=512 +ignore dnskey $zone @$server
expect: NOERROR
expect: OPT record with version set to 0
Ask for the SOA record of the configured zone, which does not need to be DNSSEC signed. This query is made with no DNS flag bits set. EDNS version 0 is used without any EDNS options. The only EDNS flag set is DO.
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the response. AD may be set in the response if the server supports DNSSEC, otherwise it should be clear; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags other than DO present in the response, which should be present if the server supports DNSSEC. The EDNS version field should be 0, and there should be no EDNS options present [
RFC 6891].
Check that DO=1 queries work (EDNS supported):
dig +nocookie +edns=0 +noad +norec +dnssec soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: an OPT record to be present in the additional section
expect: DO=1 to be present if an RRSIG is in the response
expect: EDNS Version 0 in response
expect: flag: aa to be present
Ask for the SOA record of the configured zone, which does not need to be DNSSEC signed. This query is made with no DNS flag bits set. EDNS version 1 is used without any EDNS options. The only EDNS flag set is DO.
We expect the SOA record for the zone NOT to be returned in the answer section, the extended rcode to be set to BADVERS, and the QR bit to be set in the header; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags other than DO present in the response, which should be there if the server supports DNSSEC. The EDNS version field should be 0, and there should be no EDNS options present [
RFC 6891].
Check that EDNS version 1, DO=1 queries work (EDNS supported):
dig +nocookie +edns=1 +noednsneg +noad +norec +dnssec soa \
$zone @$server
expect: status: BADVERS
expect: SOA record to NOT be present
expect: an OPT record to be present in the additional section
expect: DO=1 to be present if the EDNS version 0 DNSSEC query test
returned DO=1
expect: EDNS Version 0 in response
expect: flag: aa to NOT be present
Ask for the SOA record of the configured zone. This query is made with no DNS flag bits set. EDNS version 0 is used. A number of defined EDNS options are present (NSID [
RFC 5001], DNS COOKIE [
RFC 7873], EDNS Client Subnet [
RFC 7871], and EDNS Expire [
RFC 7314]).
We expect the SOA record for the zone to be returned in the answer section, the rcode to be set to NOERROR, and the AA and QR bits to be set in the header; RA may also be set [
RFC 1034]. We expect an OPT record to be returned. There should be no EDNS flags present in the response. The EDNS version field should be 0. Any of the requested EDNS options supported by the server and permitted server configuration may be returned [
RFC 6891].
Check that EDNS queries with multiple defined EDNS options work:
dig +edns=0 +noad +norec +cookie +nsid +expire +subnet=0.0.0.0/0 \
soa $zone @$server
expect: status: NOERROR
expect: the SOA record to be present in the answer section
expect: an OPT record to be present in the additional section
expect: EDNS Version 0 in response
expect: flag: aa to be present
expect: flag: ad to NOT be present
If EDNS is not supported by the nameserver, we expect a response to each of the above queries. That response may be a FORMERR error response, or the OPT record may just be ignored.
Some nameservers only return an EDNS response when a particular EDNS option or flag (e.g., DO=1) is present in the request. This behaviour is not compliant behaviour and may hide other incorrect behaviour from the above tests. Retesting with the triggering option/flag present will expose this misbehaviour.