Recipe 13.2. Troubleshooting DNS Problems


Problem

You can't connect to web sites because of DNS issues.

Solution

Sometimes when you can't connect to a web site, the cause is a DNS problem. While there is no single way to fix the problem, here are steps you should take.

First, find out whether the issue is with the web site itself, not with DNS. To find out if a web site is live, issue the ping command at the command prompt or Run box, like this:

ping www.zdnet.com

If the site is live, you'll get an answer like this:

Pinging www.zdnet.com [206.16.6.252] with 32 bytes of data:       Reply from 206.16.6.252: bytes=32 time=119ms TTL=242 Reply from 206.16.6.252: bytes=32 time=79ms TTL=242 Reply from 206.16.6.252: bytes=32 time=80ms TTL=242 Reply from 206.16.6.252: bytes=32 time=101ms TTL=242       Ping statistics for 206.16.6.252:     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:     Minimum = 79ms, Maximum = 119ms, Average = 94ms

If it's not, you'll get a response like this:

Ping request could not find host. Please check the name and try again.

If you ping a site and it's live, but you can't connect to it with your browser, a DNS problem might be the reason. If you suspect you're having a DNS problem, take the following actions.

Check your HOSTS file

If your HOSTS file contains an incorrect or outdated listing, you won't be able to connect. Even if you don't recall adding listings to a HOSTS file, it still may contain listings, because some Internet accelerator utilities edit them without telling you. Open your HOSTS file with Notepad and see if the site you can't connect to is listed there. If it is, delete the entry, and you should be able to connect. For more details, see Recipe 13.1, "Using a HOSTS File to Speed Up Web Access."

Check your DNS settings

Make sure your DNS settings are correct for your ISP or network and use them on your system. To do it:

  1. Call the technical support department of your ISP, or ask your network administrator, and find out the proper DNS settings.

  2. Double-click the problem connection in the Network Connections folder.

  3. Choose Support Details, and look at the bottom of the tab to find your DNS servers.

  4. If they don't match what your ISP or network administrator gave to you, right-click the problem connection and choose Properties. Then, highlight Internet Protocol (TCP/IP) and choose Properties.

  5. Change the DNS servers to the proper ones, or choose Obtain DNS server address automatically if your ISP or network administrator tells you to use that setting.

The problem may be related to your DNS cache. Your PC keeps a cache of DNS information about recent sites you've visited. When you type in a URL to visit, your PC first checks this cache before going out to a DNS server, and if it finds the entry in the cache, it uses that entry. So if your DNS cache has outdated information, you won't be able to connect to the web site. The best solution is to flush the DNS cache. Do it by typing ipconfig /flushdns at a command prompt.

If you know the address of DNS servers, ping them. If you can't reach them, the problem may be with your router, or with your DSL or cable modem.

Find out if your ISP is having DNS problems

The problem may be caused by your ISP perhaps its DNS servers are down. Ping each of your ISP's DNS servers and, if any of them don't respond, remove them from your DNS list, as outlined earlier in this recipe.

Adjust XP's DNS cache settings

The problem may be caused by your DNS cache settings. As a way of speeding up DNS, when you visit a site, XP puts the DNS information into a local DNS cache on your PC. So, when you want to go to a site, XP first looks in its local DNS cache, called the resolve cache, to see whether the DNS information is contained there. That way, if it finds the information locally, it doesn't have to query a remote DNS server to find IP information. The cache is made up of recently queried names and entries taken from your HOSTS file.

The cache contains both negative and positive entries. Positive entries are those in which the DNS lookup succeeded, and you were able to connect to the web site. When XP looks in the cache, if it finds a positive entry, it immediately uses that DNS information and sends you to the requested web site.

Negative entries are those in which no match was found, and you end up getting a "Cannot find server or DNS Error" in your browser. Similarly, when XP looks in the cache and finds a negative entry, it gives you the error message without bothering to go out to the site.

Negative entries can lead to problems. When you try to make a connection to a site that has a negative entry in your cache, you'll get an error message, even if the site's problems have been resolved and it's now reachable.

You can solve this problem, though, by changing a Registry setting. By default, XP caches negative entries for five minutes. After five minutes, they're cleared from your cache. But if you'd like, you can force XP not to cache these negative entries, so that you'll never run into this problem. To do it:

  1. Run the Registry Editor and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters.

  2. Create a new DWORD value with the name NegativeCacheTime and give it a value of 0. (The value may already exist. If it does, edit the value to 0.) The DWORD determines how much time, in seconds, to keep negative entries in the DNS cache. If you like, you can have the entries stay alive for one second by giving it a value of 1.

  3. After you're done editing, exit the Registry. To make the change take effect, restart your computer.

  4. After you edit the Registry change, you can also make the change take effect by issuing the command ipconfig /flushdns at a command prompt. This command will flush your DNS cache all the entries, both positive and negative and your cache will remain empty until you start visiting web sites again. Negative entries, however, will not be added to the cache if you've given the DWORD a value of 0.

Discussion

You can also use the Registry to control the amount of time that positive entries are kept in the DNS cache. By default, they are kept for 24 hours. To change the default, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters again and create a DWORD value called MaxCacheEntryTtlLimit. (If it's already present, just edit the value.) For the value, enter the amount of time you want the entry to remain, in seconds, making sure to use decimal as the base.

Also, you can sometimes fix DNS cache problems without having to edit the Registry. First try flushing the DNS cache by issuing the command ipconfig /flushdns at a command prompt. That often solves the problem, and you won't have to resort to Registry editing.

See Also

The http://www.seoconsultants.com/tools/dns.asp site provides a variety of DNS troubleshooting tips. It can also generate a DNS report for a domain and detail any DNS problems it finds.



Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net