What Is DNS Cache?

A DNS cache (sometimes referred to as a DNS resolver cache) is temporary info, maintained by a computer's OS, that contains records of all the recent visits and tried visits to websites and different internet domains.

In different words, a DNS cache is simply a memory of recent DNS lookups that your pc will quickly ask when it's attempting to work out a way to load a web site.

Most people only hear the phrase "DNS cache" once it refers to flushing/clearing the DNS cache so as to assist fix an internet connectivity issue. there is a lot of on that at the bottom of this page.

The Purpose of a DNS Cache

The internet depends on the domain name system (DNS) to maintain an index of all public websites and their corresponding IP addresses. you'll think of it as a phone book.

With a phone book, we do not need to memorize everyone's telephone number, that is the solely way phones can communicate: with a number. within the same way, DNS is used so we are able to avoid having to memorize each website's IP address, that is the solely way network equipment will communicate with websites.

This is what happens behind the curtain when you ask your browser to load a web site.

You type in a uniform resource locator like seocop.xyz and your browser asks your router for the IP address. The router contains a DNS server address stored, so it asks the DNS server for the IP address of that hostname. The DNS server finds the IP address that belongs to seocop.xyz and so is able to know what web site you are requesting, after that your browser will then load the suitable page.

This happens for each web site you wish to go to. whenever a user visits a web site by its hostname, the web browser initiates a request out to the web, however, this request can not be completed till the site's name is "converted" into an IP address.

The problem is that despite the fact that there are a lot of public DNS servers your network will use to try to speed up the conversion/resolution method, it's still faster to own a local copy of the "phone book," that is wherever DNS caches come into play.

The DNS cache tries to speed up the method even more by handling the name resolution of recently visited addresses before the request is distributed out to the web.

How a DNS Cache Works

Before a browser issues its requests to the outside network, the pc intercepts each and looks up the domain name within the DNS cache info. The info contains a list of all recently accessed domain names and also the addresses that DNS calculated for them the first time a request was made.

The contents of a local DNS cache will be viewed on Windows using the command ipconfig /displaydns, with results kind of like this:

In DNS, the "A" record is that the portion of the DNS entry that contains the ip address for the given hostname. The DNS cache stores this address, the requested web site name, and several|and several other} other parameters from the host DNS entry.

What Is DNS Cache Poisoning?

A DNS cache becomes poisoned or polluted when unauthorized domain names or IP addresses are inserted into it.

Occasionally a cache might become corrupted because of technical glitches or administrative accidents, however, DNS cache poisoning is usually related to pc viruses or different network attacks that insert invalid DNS entries into the cache.

Poisoning causes client requests to be redirected to the incorrect destinations, sometimes malicious websites or pages jam-packed with advertisements.

For example, if the docs.google.com record from above had a different "A" record, then once you entered docs.google.com in your browser, you would be taken elsewhere.

This poses a huge drawback for fashionable websites. If Associate in Nursing offender redirects your request for Gmail.com, as an example, to an internet site that appears like Gmail however is not, you may find yourself littered with a phishing attack like whaling.

DNS Flushing: What It does and how to try and do It

When troubleshooting cache poisoning or different internet connectivity problems, a pc administrator may need to flush (i.e. clear, reset, or erase) a DNS cache.

Since clearing the DNS cache removes all the entries, it deletes any invalid records too and forces your pc to repopulate those addresses the next time you are trying accessing those websites. These new addresses are taken from the DNS server your network is ready up to use.

So, to use the example above, if the Gmail.com record was poisoned and redirecting you to a weird web site, flushing the DNS may be a smart start to obtaining the regular Gmail.com back again.

In Microsoft Windows, you'll be able to flush the local DNS cache using the ipconfig /flushdns command in a command prompt. you know it works when you see the Windows ip configuration successfully flushed the DNS Resolver Cache or successfully flushed the DNS Resolver Cache message.

Through a command terminal, macOS users ought to use dscacheutil -flushcache, however, know that there's not a "successful" message when it runs, therefore you are not told if it worked. UNIX system users should enter the /etc/rc.d/init.d/nscd restart command.

A router will have a DNS cache similarly, that is why rebooting a router is usually a troubleshooting step. For a similar reason you may flush the DNS cache on your pc, you'll reboot your router to clear the DNS entries stored in its temporary memory.