Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

13.12. dnscmd Cheat Sheet

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.

Functiondnscmd OptionExampleComments
Do any dnscmd command on a remote systemdnscmd remoteservername commanddnscmd /zoneprint 
Create a primary zonednscmd /zoneadd zonename /primarydnscmd /zoneadd 
Create a secondary zonednscmd /zoneadd zonename /secondary master IP addressdnscmd /zoneadd /secondary 
Host a zone on a server based on an existing (perhaps restored) zone filednscmd /zoneaddzonename /primary /filefilename /loaddnscmd /zoneadd /primary /file /load 
Delete a zone from a serverdnscmd /zonedeletezonename [/f]dnscmd /zonedelete /f(Without the /f, dnscmd asks you if you really want to delete the zone.)
Show all of the zones on a DNS serverdnscmd /enumzonesdnscmd /enumzones 
Dump (almost) all of the records in a zonednscmd /zoneprint zonenamednscmd /zoneprint bigfirm.comDoesn't show glue records.
Add an A record to a zonednscmd /recordadd zonename hostname A ipaddressdnscmd /recordadd mypc A 
Add an NS record to a zonednscmd /recordadd zonename @NS servernamednscmd /recordadd @ A 
Delegate a new child domain, naming its first DNS serverdnscmd /recordadd zonename childname NSdnsservernamednscmd /recordadd test NS main.bigfirm.comThis would create the DNS child domain under the DNS domain.
Add an MX record to a zonednscmd /recordadd zonename @MXpriority servernamednscmd /recordadd @MX10 
Add a PTR record to a reverse lookup zonednscmd /recordadd zonename lowIP PTR FQDNdnscmd /recordadd .arpa 3 A pc1.bigfirm.comThis is the PTR record for a system with IP address
Modify a zone's SOA recorddnscmd /recordadd zonename @SOA primaryDNSservername responsible-emailipaddress serialnumber refreshinterval retryinterval expireinterval defaultTTLdnscmd /recordadd @SOA 41 1800 60 2592000 7200Ignores the serial number if it's not greater than the current serial number.
Delete a resource recorddnscmd /recorddelete zonename recordinfo [/f]dnscmd /recorddelete @ NS /fAgain, /f means "don't annoy me with a confirmation request, just do it."
Create a resource record and incorporate a nonstandard TTLdnscmd /recordadd zonename leftmostpartofrecord TTL restofrecorddnscmd /recordadd pc34 3200A192.168.1.4 
Reload a zone from its zone file in \windows\sustem32\dnsdnscmd /zonereload zonenamednscmd /zonereload bigfirm.comReally only useful on primary DNS servers.
Force DNS server to flush DNS data to zone filednscmd /zonewritebackzonenamednscmd /zonewriteback 
Tell a primary whom to allow zone transfers todnscmd /zoneresetsecondaries zonename /nonsecure|securensdnscmd /zoneresetsecondaries /nonsecureThat example says to allow anyone who asks to get a zone transfer.
Enable/ disable DNS NOTIFYdnscmd /zoneresetsecondaries zonename /notify|/nonotifydnscmd /zoneresetsecondaries /nonotifyExample disables DNS notification, which is contrary to the default settings.
Tell a secondary DNS server to request any updates from the primarydnscmd /zonerefreshzonenamednscmd /zonerefresh 
Enable or disable dynamic DNS on a zonednscmd /configzonename /allowupdate 1|01 enables, 0 disables, 0 is default 
Stop the DNS serviceEither net stop dns or sc stop dns (No dnscmd command for this.)
Start the DNS serviceEither net start dns or sc start dns (No dnscmd command for this.)
Install the DNS service on a 2008 full install systemservermanage rcmd -install dns  
Install the DNS service on a 2008 Server Core systemocsetup DNS-Server-Core-Role Case matters — ocsetup dns-server-core-role would fail.
Uninstall the DNS service on a 2008 Server full install systemservermanagercmd -remove dns  
Uninstall the DNS service on a 2008 Server Core systemocsetup /uninstall DNS-Server-Core-Role  
Configure a client's preferred DNS servernetsh int ip set dnsconnectionname staticipaddressnetsh int ip set dns "local area connection" static 
Configure a client's alternate DNS servernetsh int ip add dnsipaddress index=ordinalnetsh int ip add dns "local area connection" index=2You may include as many extra DNS servers as you like; just change the index value.


You are currently reading a PREVIEW of this book.


Get instant access to over $1 million worth of books and videos.


Start a Free 10-Day Trial

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint