How to setup and configure DNS from Command line in Windows

Xavier Mustin

Administrator
Staff member
#1
How to setup and configure DNS from Command line in Windows Server 2008 & Core

With the coming of Windows Server 2008 Core, its time to go back to the good old days of command line. We can add the DNS Server role and add manage DNS Server including setting up Forward and Reverse Lookup zones from the command line.

The following procedure should help you to setup and Configure a DNS server in Windows Server 2008 & Windows Server 2008 Core installation:


  • Add DNS Server Role
    C:\Users\Administrator> start /w ocsetup DNS-Server-Role
  • In Windows Server 2008 Core it is as follows
    C:\Users\Administrator> start /w ocsetup DNS-Server-Core-Role

    That installs the DNS Server role. We can now configure the DNS Server using the “dnscmd” utility.
    Here we’ll see the basic configurations. For more detailed instructions of DNSCMD, click here
  • Add a Forward Lookup zone
    For the primary domain, add a forward lookup zone as follows:
    C:\Users\Administrator> dnscmd PRIMARY /zoneadd hq.wr.COM /primary /file hq.wr.COM.dns
  • Add a Reverse Lookup Zone
    C:\Users\Administrator> dnscmd PRIMARY /zoneadd 0.168.192.in-addr.arpa
  • Add an “A” record for the domain
    C:\Users\Administrator> dnscmd PRIMARY /recordadd hq.wr.COM @ A 192.168.0.5
  • Add Records
    C:\Users\Administrator> dnscmd PRIMARY /recordadd hq.wr.COM dc1 CNAME hq.wr.COM

That should get you up and running on the DNS Servers. Refer to the above mentioned DNSCMD manual page for more advanced setup and configuration information.
 
Haut