Each entry in the file should be on one line. The IP address should be in the first column, and the corresponding hostname in the next column. At least one space should separate the two columns. You can add comments to the file by preceding the line with a #, in which case the entire line will be ignored by the file, or by putting a # after the hostname, in which case only the comment after will be ignored. You might want to comment on individual entriesfor example:130.94.155.164 gralla.com #still in beta
When you're finished editing the file, save it to its existing location.
|
5.2.2. Adjust XP's 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, using a Registry hack. 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. Run the Registry Editor [Hack #83] and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters. Create a new DWORD value with the name NegativeCacheTime and give it a value of 0. (The value might already exist. If it does, edit its 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 the DWORD a value of 1. After you're done editing, exit the Registry. To make the change take effect, restart your computer, or flush your cache by issuing the command ipconfig /flushdns at a command prompt.
|
That command will flush your DNS cacheall the entries, both positive and negative, will be flushed, and it will be empty until you start visiting web sites. Negative entries, however, will not be added to the cache if you've given the DWORD a value of 0. You can also use the Registry to control the amount of time 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. 5.2.3. Fix DNS Problems Sometimes, when you can't connect to a web site, the cause is a DNS problem. There are things you can do to solve these problems, though. If you're having trouble connecting to a site, to find out if DNS is a potential culprit first ping [Hack #51] the site to which you can't connect by issuing the ping command at the command prompt or in the 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
- Check your DNS settings
- Flush your DNS cache
- Find out if your ISP is having DNS problems
No comments:
Post a Comment