15

I came across a website that instructed me to flush my DNS in order to view what was online. What does this do and why would it help display the website?

2
  • DNS translates hostname to IP and vice versa. Flushing the DNS settings empties & repopulates the DNS settings in the client for situations where the DNS settings are incorrect/out-of-date
    – OMG Ponies
    Jan 20, 2011 at 16:59
  • " flushing the DNS cache " would be clearer. Jan 20, 2011 at 18:34

5 Answers 5

11

DNS is the Domain Name System. DNS servers convert a domain name (such as example.com) into an IP address (in this case 192.0.32.10). The mapping of names to numbers can change from time to time.

Your computer holds a record of DNS entries to save looking them up every time. This is your DNS cache. You can delete those records (flush the cache) any time you like.

If a website has recently moved servers, you might see the old website for a while. Flushing your DNS cache might help.

2
  • If I move my website to different servers, do I HAVE to instruct all users to flush the cache? There's no automatic way of knowing that the old mapping is out of date & that entry should be updated in the cache?
    – user
    Mar 3, 2014 at 6:42
  • 1
    @buffer. DNS entries have a TTL (time to live), after which they expire. Common TTLs are 24 and 48 hours, but I've seen them as low as 5 minutes. I think the maximum value is 3 months. Ideally, you should reduce your TTL before moving servers, then switch, then increase it again. That way, the transfer period (during which different people may be seeing different servers) is short.
    – TRiG
    Mar 3, 2014 at 10:07
4

Whenever you type a URL on the adress bar it fetches the corresponding IP address to communicate with web server (it might be any kind of server). When you repeatedly use a same URL its just a waste of network resource to fetch corresponding IP adress everytime because IP dont change too often.

so your computer stores the combinations of domain name and its IP in local cache to avoid fetching from Domain name Server(DNS) everytime you use same domain name(URL).

It also holds another crucial info called "Timeout" which says about the valid time for the IP and domain name combination, when this time times out your computer re-fetches the combination from DNS and stores in local cache again.

Dns flushing is the mechanism where the user can manually make all the entries in the cache invalid, so your computer re-fetches new combinations by now on whenever it needs and stores in local cache.

2
  • Is is safe? What will happen if I clear my DNS cache? Where is that cache located on my machine?
    – Green
    Jan 21, 2016 at 5:36
  • @Green You can use "ipconfig /displaydns" command on windows to list all DNS mappings. For linux, DNS caching is not enabled at OS level by default. If tools like "nscd is installed , you can try /usr/sbin/nscd -g Jan 21, 2016 at 5:52
1

Your system holds the IP address of named sites... When you do a ipconfig /flushdns, your system clears the cache of name to ip entries and reloads them from the connected DNS server.

1

Unless you're on old versions of Windows, it means that the website operators messed up. They moved the service to a new IP address; before doing that, they should have lowered some timeouts on the name data in DNS, so that they said something like "this mapping is valid for 5 minutes" instead of "this mapping is valid for the next day". This needs to be done some time in advance.

The exception to this is that old Windows releases (through XP? I forget) would ignore timeouts shorter than a day and just remember the old mapping anyway. While it's common for caches to have a "lower bound" on how long the timeout can be, it's usually around "5 minutes", not "24 hours". This means that a website moving IP address has to actually be available on two different IP addresses for that length of time.

The solution for the website operators is to have a forwarding "proxy" run on the old IP address, passing traffic to the new IP address, for a couple of days, to give time to deal with the sad reality of stupidly excessive caching.

Either way, the problem has been punted onto you. But there's a reason that big professional sites don't ask you to do this -- they work around the problem themselves.

0

DNS flush is important when we are migrating our applications from the old servers to the new servers. Servers/applications will be having bindings which are pointing to VIP/Wide IP. We had faced some issues where the changes were made by network team i.e. they changes the Wide IP from their side but did not performed DNS flush. When the application team hit the DNS to validate then the traffic will still be routed to the old servers because same is cached in the local cache. DNS flush can be performed from the new servers and can be checked by using NSLOOKUP command in command prompt with syntax as below- Syntax- NSLOOKUP

This will provide you the IP address to which current DNS is pointing.

1
  • Hi and welcome to SU. Thank you for your answer. However, you're answering a rather old question which has 4 answers already. To give some added value to your answer, I would suggest editing your post and elaborating it with some examples (e.g., on nslookup).
    – Edward
    Oct 12, 2017 at 6:57

You must log in to answer this question.