Admin Tip #142: Manage the DNS resolver cache with IPCONFIG

Hits: Failed to execute CGI : Win32 Error Code = 3



W2K and XP's workstation DNS client resolves host names to support web browsers, mail clients, and other apps where you used a host name rather than IP addresses. The Windows DNS resolver caches the results of DNS queries including queries that fail to resolve). Each DNS record has a time-to-live value that determines when the record should be refreshed with another query. Until the TTL expires, Windows will respond with the cached query rather than perform a new query.

What this means is the when you're troubleshooting connection and DNS problems, it's important to flush the DNS cache and force Windows to generate a new query. ipconfig can be used to view and/or clear the resolver cache, among other things. The following command displays the contents of the resolver cache :

E:\Documents and Settings\Wayne>ipconfig /displaydns

Windows IP Configuration


         Record Name . . . . . : udns1.ultradns.net
         Record Type . . . . . : 1
         Time To Live  . . . . : 37577
         Data Length . . . . . : 4
         Section . . . . . . . : Additional
         A (Host) Record . . . : 204.69.234.1


         Record Name . . . . . : udns2.ultradns.net
         Record Type . . . . . : 1
         Time To Live  . . . . : 37577
         Data Length . . . . . : 4
         Section . . . . . . . : Additional
         A (Host) Record . . . : 204.74.101.1


         dns.sprintip.com
         ----------------------------------------
         Record Name . . . . . : dns.sprintip.com
         Record Type . . . . . : 1
         Time To Live  . . . . : 230
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 208.25.104.7


         dnsla.carsdirect.com
         ----------------------------------------
         Record Name . . . . . : dnsla.carsdirect.com
         Record Type . . . . . : 1
         Time To Live  . . . . : 1719
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 12.129.202.53


         ns2.cts-bv.com
         ----------------------------------------
         Record Name . . . . . : ns2.cts-bv.com
         Record Type . . . . . : 1
         Time To Live  . . . . : 1194
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 


         1.0.0.127.in-addr.arpa
         ----------------------------------------
         Record Name . . . . . : 1.0.0.127.in-addr.arpa.
         Record Type . . . . . : 12
         Time To Live  . . . . : 83255
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         PTR Record  . . . . . : localhost


         www.eastminsterdallas.org
         ----------------------------------------
         Record Name . . . . . : www.eastminsterdallas.org
         Record Type . . . . . : 1
         Time To Live  . . . . : 2083
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 207.70.181.116


 
         stats.cts-bv.nl
         ----------------------------------------
         Record Name . . . . . : stats.cts-bv.nl
         Record Type . . . . . : 1
         Time To Live  . . . . : 1194
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 


         www.lynchwiles.com
         ----------------------------------------
         Record Name . . . . . : www.lynchwiles.com
         Record Type . . . . . : 1
         Time To Live  . . . . : 420
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 203.15.67.163

 
         auth00.ns.uu.net
         ----------------------------------------
         Record Name . . . . . : auth00.ns.uu.net
         Record Type . . . . . : 1
         Time To Live  . . . . : 1961
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 198.6.1.65


         ns-3.amazon.com
         ----------------------------------------
         Record Name . . . . . : ns-3.amazon.com
         Record Type . . . . . : 1
         Time To Live  . . . . : 1961
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 


         ns1.wdc.pnap.net
         ----------------------------------------
         Record Name . . . . . : NS1.WDC.PNAP.NET
         Record Type . . . . . : 1
         Time To Live  . . . . : 859
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 216.52.126.1


         is-it-true.org
         ----------------------------------------
         Record Name . . . . . : is-it-true.org
         Record Type . . . . . : 1
         Time To Live  . . . . : 27814
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 66.34.10.74


         Section . . . . . . . : Additional
         A (Host) Record . . . : 216.221.160.10

Use this command to flush the resolver cache:

ipconfig /flushdns

To check out all the options:


E:\Documents and Settings\Wayne>ipconfig /?

USAGE:
    ipconfig [/? | /all | /renew [adapter] | /release [adapter] |
              /flushdns | /displaydns | /registerdns |
              /showclassid adapter |
              /setclassid adapter [classid] ]

where
    adapter         Connection name
                   (wildcard characters * and ? allowed, see examples)

    Options:
       /?           Display this help message
       /all         Display full configuration information.
       /release     Release the IP address for the specified adapter.
       /renew       Renew the IP address for the specified adapter.
       /flushdns    Purges the DNS Resolver cache.
       /registerdns Refreshes all DHCP leases and re-registers DNS names
       /displaydns  Display the contents of the DNS Resolver Cache.
       /showclassid Displays all the dhcp class IDs allowed for adapter.
       /setclassid  Modifies the dhcp class id.

The default is to display only the IP address, subnet mask and
default gateway for each adapter bound to TCP/IP.

For Release and Renew, if no adapter name is specified, then the IP address
leases for all adapters bound to TCP/IP will be released or renewed.

For Setclassid, if no ClassId is specified, then the ClassId is removed.

Examples:
    > ipconfig                   ... Show information.
    > ipconfig /all              ... Show detailed information
    > ipconfig /renew            ... renew all adapters
    > ipconfig /renew EL*        ... renew any connection that has its
                                     name starting with EL
    > ipconfig /release *Con*    ... release all matching connections,
                                     eg. "Local Area Connection 1" or
                                         "Local Area Connection 2"