Search This Blog

Monday, February 12, 2018

[SOLVED] - Flush/DNS Cache in Ubuntu 14.04, 15.04 & Others


I tried various solutions and fixes available to clean my system's DNS cache but nothing worked for me, due to which I was unable to access a particular website. But at the same time, when I turned on my VPN and tired to access that website, I was able to do so. This clearly meant that there was a problem with my DNS cache. Eventually I tried this simple fix and then was able to access that website. So here's the solution:

1. First you need to find the IP address of your website. To do that open your terminal by pressing CTRL+ALT+T and enter the following command:

 ping example.com  

You should be getting the following result, as shown in the image below:


Make note of the value that I have underlined and circled using the color red; that's your website's IP address. In my case I pinged google.com and got the IP as 172.217.160.14.

2. Now enter the following command in your terminal.

 sudo gedit /etc/hosts  

This will open your system's host file. In this file, look for an entry with the IP as  127.0.0.1 or 127.0.1.1 or something similar to that, but make sure the IP is starting with 127. Now, just below this entry, enter the IP address you got after pinging your website. In my case since I'd pinged google.com I will enter the value in my host file as:

 172.217.160.14  google.com  

Finally save the file and close it. And now you should be able to access your website. Finally after a period of 12 or 24 hours do not forget to remove the above entry from your host file, as it will no longer be required.

No comments:

Post a Comment

Thank you for your Feedback!
www.evagabond.me

Top Magento Hosting:

Top 5 Posts (Weekly)