DNS Tools

NSLookup

NSLOOKUP is a command-line tool used to query DNS (Domain Name System) servers to obtain information about domain names, IP addresses, and other DNS records. It is available on most operating systems, including Windows, macOS, and Linux. Here is an explanation of the syntax and some examples of how to use NSLOOKUP:

Syntax:

nslookup [-options] [host]

Options:

  • a: Specifies that the query should return all records of the specified type for the domain name.
  • mx: Specifies that the query should return the MX (Mail Exchange) records for the domain name.
  • cname: Specifies that the query should return the CNAME (Canonical Name) record for the domain name.
  • ns: Specifies that the query should return the NS (Name Server) records for the domain name.
  • ptr: Specifies that the query should perform a reverse lookup and return the PTR (Pointer) record for the specified IP address.
  • port: Specifies the port number to use for the DNS query.
  • timeout: Specifies the time (in seconds) to wait for a response from the DNS server.

Examples:

  1. Query the A record for a domain name:




nslookup example.com

This command will return the IP address associated with the domain name “example.com”.

  1. Query the MX record for a domain name:




nslookup -mx example.com

This command will return the MX (Mail Exchange) records for the domain name “example.com”, which specify the mail servers responsible for handling email sent to that domain.

  1. Query the CNAME record for a domain name:




nslookup -cname www.example.com

This command will return the CNAME (Canonical Name) record for the domain name “www.example.com“, which specifies the canonical name for the domain.

  1. Query the NS record for a domain name:




nslookup -ns example.com

This command will return the NS (Name Server) records for the domain name “example.com”, which specify the authoritative name servers for the domain.

  1. Perform a reverse lookup for an IP address:




nslookup 8.8.8.8

This command will return the domain name associated with the IP address “8.8.8.8”, which in this case is “dns.google”.

DNSLint

DNSLint is a command-line tool used to diagnose DNS (Domain Name System) configuration issues by verifying the integrity of DNS records and identifying potential errors. It is available for Windows operating systems and can be downloaded from the Microsoft website. Here is an explanation of the syntax and some examples of how to use DNSLint:

Syntax:

dnslint [options] domain_name

Options:

  • ad: Performs an Active Directory domain test.
  • aa: Tests all authoritative name servers for the domain.
  • n: Specifies the number of iterations to run.
  • r: Specifies the maximum number of retries.
  • t: Specifies the timeout (in seconds) for each query.
  • v: Displays verbose output.

Examples:

  1. Verify the DNS configuration for a domain:




dnslint example.com

This command will verify the DNS configuration for the domain “example.com” and report any errors or warnings that are found.

  1. Perform an Active Directory domain test:




dnslint -ad example.com

This command will perform an Active Directory domain test for the domain “example.com” and report any errors or warnings that are found.

  1. Test all authoritative name servers for a domain:




dnslint -aa example.com

This command will test all authoritative name servers for the domain “example.com” and report any errors or warnings that are found.

  1. Specify the number of iterations to run:




dnslint -n 5 example.com

This command will verify the DNS configuration for the domain “example.com” five times and report any errors or warnings that are found.

  1. Specify the timeout for each query:




dnslint -t 10 example.com

This command will verify the DNS configuration for the domain “example.com” and set the timeout for each query to 10 seconds. If a response is not received within 10 seconds, the query will be retried according to the specified retry and iteration values.

  1. Display verbose output:




dnslint -v example.com

This command will verify the DNS configuration for the domain “example.com” and display verbose output, including detailed information about each query and any errors or warnings that are found.

DNSCMD

DNSCMD is a command-line tool used to manage and configure DNS (Domain Name System) servers. It is available on Windows operating systems and can be used to create, delete, and modify DNS records, zones, and other DNS server settings. Here is an explanation of the syntax and some examples of how to use DNSCMD:

Syntax:

dnscmd <ServerName> [<Command> [<CommandParameters>…]]

ServerName: Specifies the name of the DNS server to manage. Command: Specifies the DNSCMD command to run. CommandParameters: Specifies the parameters for the DNSCMD command.

Examples:

  1. Create a new primary zone:




dnscmd mydnsserver /ZoneAdd example.com /Primary

This command will create a new primary zone for the domain “example.com” on the DNS server named “mydnsserver”.

  1. Create a new secondary zone:




dnscmd mydnsserver /ZoneAdd example.com /Secondary 10.0.0.2

This command will create a new secondary zone for the domain “example.com” on the DNS server named “mydnsserver” and configure it to replicate from the primary server at IP address “10.0.0.2”.

  1. Delete a zone:




dnscmd mydnsserver /ZoneDelete example.com /DsDel

This command will delete the zone for the domain “example.com” from the DNS server named “mydnsserver” and delete the corresponding Active Directory-integrated zone data.

  1. Create a new A record:




dnscmd mydnsserver /RecordAdd example.com myhost A 192.168.1.100

This command will create a new A record for the hostname “myhost.example.com” with the IP address “192.168.1.100” on the DNS server named “mydnsserver”.

  1. Create a new CNAME record:
objectivec
dnscmd mydnsserver /RecordAdd example.com www CNAME myhost.example.com

This command will create a new CNAME record for the hostname “www.example.com” with the canonical name “myhost.example.com” on the DNS server named “mydnsserver”.

  1. List all DNS zones:




dnscmd mydnsserver /EnumZones

This command will list all DNS zones configured on the DNS server named “mydnsserver”.

  1. Display the DNS server settings:




dnscmd mydnsserver /Info

This command will display information about the DNS server settings, including the server name, IP address, and configured DNS zones.

DNS Powershell cmdlets

PowerShell cmdlets for DNS (Domain Name System) management are a set of PowerShell commands used to manage DNS servers and zones on Windows operating systems. These cmdlets are part of the DNS Server module in PowerShell and can be used to automate DNS-related tasks, such as creating, modifying, and deleting DNS records and zones. Here is an explanation of the syntax and some examples of how to use PowerShell cmdlets for DNS management:

Syntax:





<Command-Name> [-<Parameter-Name> <Parameter-Value>]...

Command-Name: Specifies the name of the PowerShell cmdlet to run. Parameter-Name: Specifies the name of the parameter to set. Parameter-Value: Specifies the value to set for the parameter.

Examples:

  1. Get a list of all DNS zones:




Get-DnsServerZone

This command will list all DNS zones on the local DNS server.

  1. Create a new DNS zone:




Add-DnsServerPrimaryZone -Name "example.com" -ZoneFile "example.com.dns"

This command will create a new primary DNS zone for the domain “example.com” and use the specified zone file.

  1. Modify a DNS zone:




Set-DnsServerPrimaryZone -ZoneName "example.com" -DynamicUpdate Secure

This command will modify the primary DNS zone for the domain “example.com” and set the dynamic update method to “Secure”.

  1. Delete a DNS zone:




Remove-DnsServerZone -Name "example.com" -Force

This command will delete the DNS zone for the domain “example.com” and all its associated DNS records.

  1. Create a new DNS record:




Add-DnsServerResourceRecordA -Name "www" -ZoneName "example.com" -IPv4Address "192.168.1.100"

This command will create a new A record for the hostname “www.example.com” and set the IP address to “192.168.1.100”.

  1. Modify a DNS record:




Set-DnsServerResourceRecordA -Name "www" -ZoneName "example.com" -IPv4Address "192.168.1.200"

This command will modify the A record for the hostname “www.example.com” and set the IP address to “192.168.1.200”.

  1. Delete a DNS record:




Remove-DnsServerResourceRecord -ZoneName "example.com" -Name "www" -RRType A -Force

This command will delete the A record for the hostname “www.example.com” from the DNS zone for the domain “example.com”.

Author: tonyhughes