Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This has been a long chapter, I know, and thank you for staying with me to its end. I cannot stress enough that knowing DNS is one of the most essential arts for any successful network administrator, and if you review and learn what we've covered here then you'll be well on the way to DNS proficiency. Before I go, however, I want to leave you with a small gift — my dnscmd cheat sheet. You've already heard me preach about the power and value of the command line, so I won't do that again, but I will agree that the CLI requires a bit more remembering than GUIs do, so I hope this table makes that remembering a bit easier. (And don't forget that there's still more to learn about DNS's AD-specific aspects — but we'll take those up in Essential Technologies!) This is by no means a complete explanation of everything that dnscmd does — just the stuff that I use regularly.
| Function | dnscmd Option | Example | Comments |
|---|---|---|---|
| Do any dnscmd command on a remote system | dnscmd remoteservername command | dnscmd main.bigfirm.com /zoneprint bigfirm.com | |
| Create a primary zone | dnscmd /zoneadd zonename /primary | dnscmd /zoneadd bigfirm.com/primary | |
| Create a secondary zone | dnscmd /zoneadd zonename /secondary master IP address | dnscmd /zoneadd bigfirm.com /secondary 192.168.1.1 | |
| Host a zone on a server based on an existing (perhaps restored) zone file | dnscmd /zoneaddzonename /primary /filefilename /load | dnscmd /zoneadd bigfirm.com /primary /file bigfirm.com.dns /load | |
| Delete a zone from a server | dnscmd /zonedeletezonename [/f] | dnscmd /zonedelete bigfirm.com /f | (Without the /f, dnscmd asks you if you really want to delete the zone.) |
| Show all of the zones on a DNS server | dnscmd /enumzones | dnscmd /enumzones | |
| Dump (almost) all of the records in a zone | dnscmd /zoneprint zonename | dnscmd /zoneprint bigfirm.com | Doesn't show glue records. |
| Add an A record to a zone | dnscmd /recordadd zonename hostname A ipaddress | dnscmd /recordadd bigfirm.com mypc A 192.168.1.33 | |
| Add an NS record to a zone | dnscmd /recordadd zonename @NS servername | dnscmd /recordadd bigfirm.com @ A dns3.bigfirm.com | |
| Delegate a new child domain, naming its first DNS server | dnscmd /recordadd zonename childname NSdnsservername | dnscmd /recordadd bigfirm.com test NS main.bigfirm.com | This would create the test.bigfirm.com DNS child domain under the bigfirm.com DNS domain. |
| Add an MX record to a zone | dnscmd /recordadd zonename @MXpriority servername | dnscmd /recordadd bigfirm.com @MX10 mail.bigfirm.com | |
| Add a PTR record to a reverse lookup zone | dnscmd /recordadd zonename lowIP PTR FQDN | dnscmd /recordadd 1.168.192.in-addr .arpa 3 A pc1.bigfirm.com | This is the PTR record for a system with IP address 192.168.1.3. |
| Modify a zone's SOA record | dnscmd /recordadd zonename @SOA primaryDNSservername responsible-emailipaddress serialnumber refreshinterval retryinterval expireinterval defaultTTL | dnscmd /recordadd bigfirm.com @SOA winserver.bigfirm.com mark.bigfirm.com 41 1800 60 2592000 7200 | Ignores the serial number if it's not greater than the current serial number. |
| Delete a resource record | dnscmd /recorddelete zonename recordinfo [/f] | dnscmd /recorddelete bigfirm.com @ NS main.bigfirm.com /f | Again, /f means "don't annoy me with a confirmation request, just do it." |
| Create a resource record and incorporate a nonstandard TTL | dnscmd /recordadd zonename leftmostpartofrecord TTL restofrecord | dnscmd /recordadd bigfirm.com pc34 3200A192.168.1.4 | |
| Reload a zone from its zone file in \windows\sustem32\dns | dnscmd /zonereload zonename | dnscmd /zonereload bigfirm.com | Really only useful on primary DNS servers. |
| Force DNS server to flush DNS data to zone file | dnscmd /zonewritebackzonename | dnscmd /zonewriteback bigfirm.com | |
| Tell a primary whom to allow zone transfers to | dnscmd /zoneresetsecondaries zonename /nonsecure|securens | dnscmd /zoneresetsecondaries bigfirm.com /nonsecure | That example says to allow anyone who asks to get a zone transfer. |
| Enable/ disable DNS NOTIFY | dnscmd /zoneresetsecondaries zonename /notify|/nonotify | dnscmd /zoneresetsecondaries bigfirm.com /nonotify | Example disables DNS notification, which is contrary to the default settings. |
| Tell a secondary DNS server to request any updates from the primary | dnscmd /zonerefreshzonename | dnscmd /zonerefresh bigfirm.com | |
| Enable or disable dynamic DNS on a zone | dnscmd /configzonename /allowupdate 1|0 | 1 enables, 0 disables, 0 is default | |
| Stop the DNS service | Either net stop dns or sc stop dns | (No dnscmd command for this.) | |
| Start the DNS service | Either net start dns or sc start dns | (No dnscmd command for this.) | |
| Install the DNS service on a 2008 full install system | servermanage rcmd -install dns | ||
| Install the DNS service on a 2008 Server Core system | ocsetup DNS-Server-Core-Role | Case matters — ocsetup dns-server-core-role would fail. | |
| Uninstall the DNS service on a 2008 Server full install system | servermanagercmd -remove dns | ||
| Uninstall the DNS service on a 2008 Server Core system | ocsetup /uninstall DNS-Server-Core-Role | ||
| Configure a client's preferred DNS server | netsh int ip set dnsconnectionname staticipaddress | netsh int ip set dns "local area connection" static 192.168.1.7 | |
| Configure a client's alternate DNS server | netsh int ip add dnsipaddress index=ordinal | netsh int ip add dns "local area connection" 192.168.1.200 index=2 | You may include as many extra DNS servers as you like; just change the index value. |