dnscmd (2/2)
Part 2 of dnscmd: where AD-integrated zones are stored (application directory partitions) and how to tune the DNS server with dnscmd /config, both server-wide and per zone. A BIND 9 lab shows the matching Linux settings because dnscmd runs only on Windows (where dnscmd found nothing on the office PC, so Windows outputs are from Microsoft Learn).
204.1 Why is it used?
- Control which DCs replicate a DNS zone (domain-wide, forest-wide or a chosen set).
- Turn recursion, forwarding, cache size, DNSSEC and logging on or off for the whole server.
- Lock down zone transfers and dynamic updates per zone.
- Settings are saved in the server's registry over an RPC call from the admin PC.
204.2 DNS application directory partitions
- Step 1
1.Zone records live in Active Directory, not in files
- Step 2
2.DomainDnsZones: replicated to all DNS servers (DCs) of the same domain (DC1 -> DC2)
- Step 3
3.ForestDnsZones: replicated across the whole forest, even to DC3 in emea.contoso.com
- Step 4
4.Custom partition (dns.contoso.com): only enlisted DCs keep a replica
- Step 5
5.DC2 enlisted -> gets the zone; DC3 not enlisted -> does not
dnscmd [<servername>] /enumdirectorypartitions [/custom]dnscmd [<servername>] /directorypartitioninfo <partitionFQDN> [/detail]dnscmd [<servername>] /createdirectorypartition <partitionFQDN>dnscmd [<servername>] /enlistdirectorypartition <partitionFQDN>dnscmd [<servername>] /createbuiltindirectorypartitions [/forest] [/alldomains]dnscmd [<servername>] /zonechangedirectorypartition <zonename> {[<newpartitionname>] | [<zonetype>]}| Partition | Replicates to | Switch |
|---|---|---|
| DomainDnsZones | All DNS servers of the domain | /domain |
| ForestDnsZones | All DNS servers in the forest | /forest |
| Custom | Only enlisted servers | /createdirectorypartition + /enlistdirectorypartition |
| Legacy (domain partition) | All DCs of the domain, incl. pre-AD-partition DCs | /legacy |
- /deletedirectorypartition and /unenlistdirectorypartition remove a partition or a replica.
- /zonechangedirectorypartition moves a zone to another partition.
204.3 How /config works (server level)
- Step 1
1.Admin PC sends dnscmd /config over RPC; dnssvr1 updates its registry
- Step 2
2.Client (192.168.1.20) asks for a partner.com name not in dnssvr1's zones
- Step 3
3.Recursion on: dnssvr1 forwards to 192.168.1.53 and returns the answer
- Step 4
4.Admin sets /norecursion 1
- Step 5
5.Same query now gets REFUSED (own zones still answered)
Linux equivalent: every named.conf line notes the matching dnscmd parameter; the server forwards only to the lab partner DNS.
options { recursion yes; // /norecursion 0 allow-recursion { 192.168.224.0/24; }; forwarders { 192.168.224.20; }; forward only; // /isslave 1 querylog no; // /loglevel 0x0 max-cache-size 32m; // /maxcachesize max-cache-ttl 86400; // /maxcachettl max-ncache-ttl 900; // negative TTL dnssec-validation auto; // DNSSEC check};zone "test.contoso.com" { allow-transfer { 192.168.224.30; }; allow-update { 192.168.224.30; };};$ named -vBIND 9.18.49 (Extended Support Version) <id:cd4a53b>$ rndc statusnumber of zones: 2 (0 automatic)query logging is OFFserver is up and running204.4 Recursion and forwarding
/norecursion 0|1 recursion on | off/isslave 0|1 0 resolve itself | 1 fail if forwarders fail/forwardingtimeout 5 forwarder wait (s)/forwarddelegations 0|1 subzone | forwarders/recursionretry 3 seconds before retry/recursiontimeout 15 stop trying remote (s)/sendport 0 source port, 0 = random/serverlevelplugindll <dll> plugin on (empty = off)dnscmd reskit.com /info isslavednscmd reskit.com /info recursiontimeoutC:\> dnscmd reskit.com /info isslaveQuery result:Dword: 0 (00000000)Command completed successfully.C:\> dnscmd reskit.com /info recursiontimeoutDword: 15 (0000000F)# named.conf: recursion no;rndc reconfigdig @192.168.224.10 app.partner.lab Adig @192.168.224.10 web01.test.contoso.com A$ rndc reconfig$ named-checkconf -p | grep recursion recursion no;$ dig @192.168.224.10 app.partner.lab A;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 7284;; WARNING: recursion requested but not available$ dig @192.168.224.10 web01.test.contoso.com A;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15307web01.test.contoso.com. 3600 IN A 192.168.224.50204.5 Cache, EDNS and DNSSEC
/maxcachesize 10240 cache max (KB)/maxcachettl 86400 max TTL (0 = no cache)/maxnegativecachettl 900 negative answer TTL/ednscachetimeout 604800 EDNS info cache (s)/enableednsprobes 0|1 EDNS probes off|on/enablednssec 0|1 DNSSEC off|onrndc validation statusdig @192.168.224.10 app.partner.lab Agrep -iE 'trust|DNSKEY' named.logrndc validation offdig @192.168.224.10 app.partner.lab A$ rndc validation statusDNSSEC validation is enabled (view _default)$ dig @192.168.224.10 app.partner.lab A;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 50945$ grep -iE 'trust|DNSKEY' named.log13:05:11.248 REFUSED unexpected RCODE resolving './DNSKEY/IN': 192.168.224.20#5313:05:11.248 managed-keys-zone: Unable to fetch DNSKEY set '.': failure13:05:18.940 broken trust chain resolving 'app.partner.lab/A/IN': 192.168.224.20#53$ rndc validation offDNSSEC validation is disabled (view _default);; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55519app.partner.lab. 3600 IN A 192.168.224.60- SERVFAIL here: the isolated lab cannot fetch the root DNSKEY, so the trust chain is broken.
- Turning validation off was only for the lab; on a real server keep DNSSEC validation on.
named-checkconf -p | grep max-cacherndc dumpdb -cachegrep -E 'Cache dump|partner' named_dump.db$ named-checkconf -p | grep max-cache max-cache-size 33554432; max-cache-ttl 86400;$ grep -E 'Cache dump|partner' named_dump.db; Cache dump of view '_default' (cache _default)app.partner.lab. 3587 IN A 192.168.224.60204.6 Logging: Event Viewer, Dns.log, /loglevel
/eventloglevel 0|1|2|4 none | errors | +warnings | +info (default 4)/logfilemaxsize 0x400000 Dns.log max 4 MB/logfilepath C:\DNSLogs\dns.log/logipfilterlist 10.0.0.5,10.0.0.6 only these IPs/loglevel 0x6210 queries+answers+receive+UDP/loglevel 0x0 debug log off (default)| /loglevel flag | Logs |
|---|---|
| 0x0 | No debug log (default) |
| 0x10 / 0x20 | Queries + notifications / updates |
| 0x100 / 0x200 | Question transactions / answers |
| 0x1000 / 0x2000 | Sent / received packets |
| 0x4000 / 0x8000 | UDP / TCP packets |
| 0xFFFF | All packets |
| 0x1000000 | Full packets |
Add hex values to combine flags (0x6210). Debug logging is heavy: set /loglevel back to 0 after troubleshooting. BIND equivalent: rndc querylog.
rndc status | grep 'query logging'rndc querylog ondig @192.168.224.10 web01.test.contoso.com A +shortdig @192.168.224.10 app.partner.lab A +shortcat /var/log/named/query.logrndc querylog off$ rndc status | grep 'query logging'query logging is OFF$ rndc querylog onquery logging is ON$ dig @192.168.224.10 web01.test.contoso.com A +short192.168.224.50$ dig @192.168.224.10 app.partner.lab A +short192.168.224.60$ cat /var/log/named/query.log13:05:30.636 client @0x7b7e7db2f230 192.168.224.20#44060 (web01.test.contoso.com): query: web01.test.contoso.com IN A +E(0)K (192.168.224.10)13:05:30.692 client @0x7b7e7db2f230 192.168.224.20#45139 (app.partner.lab): query: app.partner.lab IN A +E(0)K (192.168.224.10)204.7 Security, update options, aging and other server settings
/enableglobalqueryblocklist 0|1 off | on (default)/globalqueryblocklist isatap wpad replace the list/secureresponses 0|1 cache all | same subtree only/rpcprotocol 0x1 | 0x2 | 0x4 TCP/IP | named pipes | LPC/updateoptions 0x30F common standard + secure mix/updateoptions 0x80000000 dynamic update disabled/scavenginginterval 168 clean stale records every 7 days/dstombstoneinterval 1209600 keep deleted AD records 14 days/roundrobin 0|1 rotate A records (default 1)/bootmethod 0|1|2|3 clear | BIND file | registry | AD- The global query block list blocks isatap and wpad by default, because attackers can use them for a fake proxy.
- /secureresponses 1 protects against cache pollution.
- /updateoptions picks which record types (SOA, NS, delegation, server host) dynamic update may not change.
- /strictfileparsing 1 stops loading a zone at a bad record; /notcp is obsolete.
204.8 Zone-level settings
- Step 1
1.Secondary (192.168.1.30) sends AXFR; it is in securesecondaries -> gets the zone copy
- Step 2
2.Unknown PC (192.168.1.99) sends AXFR -> Transfer failed
- Step 3
3.Client sends a dynamic update
- Step 4
4./allowupdate 1 -> update accepted and the record is registered
| Zone option | Meaning |
|---|---|
| /aging 1|0 | Scavenging on/off for this zone |
| /refreshinterval, /norefreshinterval | Aging intervals in hours (168 = 7 days) |
| /allowupdate <value> | Dynamic updates allowed or not |
| /securesecondaries | Who may take an AXFR |
| /forwarderslave, /forwardertimeout | Override server settings for a conditional forwarder zone |
| /allownsrecordsautocreation <IPs> | Override auto-creation of NS records |
dnscmd /config test.contoso.com /aging 1dnscmd /config partner.com /forwardertimeout 5dnscmd reskit.com /zoneinfo test.reskit.com refreshintervaldnscmd reskit.com /zoneinfo test.reskit.com agingC:\> dnscmd reskit.com /zoneinfo test.reskit.com refreshintervalZone query result:Dword: 168 (000000A8)Command completed successfully.C:\> dnscmd reskit.com /zoneinfo test.reskit.com agingDword: 0 (00000000)BIND lab: allow-transfer = /securesecondaries, allow-update = /allowupdate.
dig -b 192.168.224.20 test.contoso.com AXFRdig -b 192.168.224.30 test.contoso.com AXFRgrep -E 'transfer|AXFR' named.log$ dig -b 192.168.224.20 test.contoso.com AXFR; Transfer failed.$ dig -b 192.168.224.30 test.contoso.com AXFRtest.contoso.com. 3600 IN SOA dnssvr1.test.contoso.com. admin.test.contoso.com. 2026110901 3600 600 86400 900test.contoso.com. 3600 IN NS dnssvr1.test.contoso.com.dnssvr1.test.contoso.com. 3600 IN A 192.168.224.10intranet.test.contoso.com. 3600 IN CNAME web01.test.contoso.com.web01.test.contoso.com. 3600 IN A 192.168.224.50$ grep -E 'transfer|AXFR' named.log13:05:52.407 client @0x7b7e7db653b0 192.168.224.20#40767 (test.contoso.com): zone transfer 'test.contoso.com/AXFR/IN' denied13:05:54.484 client @0x7b7e7db653e0 192.168.224.30#34117 (test.contoso.com): transfer of 'test.contoso.com/IN': AXFR started (serial 2026110901)server 192.168.224.10local 192.168.224.20zone test.contoso.comupdate add app01.test.contoso.com 300 A 192.168.224.70send# second try: local 192.168.224.30$ nsupdate (local 192.168.224.20)update failed: REFUSED$ nsupdate (local 192.168.224.30)update sent$ dig @192.168.224.10 app01.test.contoso.com A +noall +answerapp01.test.contoso.com. 300 IN A 192.168.224.70$ grep -E 'update|updating' named.log13:05:42.320 zone 'test.contoso.com' allows unsigned updates from remote hosts, which is insecure13:05:59.047 client @0x7b7e7db42290 192.168.224.20#33939: update 'test.contoso.com/IN' denied204.9 Comparison: server level vs zone level
| Point | Server level | Zone level |
|---|---|---|
| Syntax | dnscmd /config /<parameter> <value> | dnscmd /config <zonename> /<parameter> <value> |
| Scope | Whole DNS server | Only that zone |
| Examples | norecursion, forwarders, cache, loglevel, DNSSEC | aging, allowupdate, securesecondaries |
| Read with | /info <setting> | /zoneinfo <zone> <setting> |
204.10 Common mistakes
- Thinking /norecursion 1 turns DNS off: own zones still get NOERROR, only outside names get REFUSED.
- Leaving /loglevel debug flags on: Dns.log grows fast and costs performance.
- Allowing unsigned dynamic updates by IP (BIND warns it is insecure); use TSIG or Windows secure update.
- Letting any PC pull the zone instead of restricting /securesecondaries.
204.11 Interview tips
- Server level = whole server (recursion, forwarders, cache), saved in the registry; zone level needs the zone name (aging, allowupdate, securesecondaries).
- Authoritative-only servers: recursion off is the best practice.
- Outside PC can download your zone: restrict /securesecondaries (BIND allow-transfer).
- DomainDnsZones vs ForestDnsZones: domain-wide vs forest-wide replication.