The Domain Name System (DNS) translates domain names into IP addresses, directing your browser to the correct website. If you recently changed any of your DNS settings, you’ll need to flush your DNS cache so that your computer can access the new configuration. Flushing the DNS cache doesn’t always require complicated commands, especially if you’re using Linux, where three simple terminal commands will do the trick.
1) Command Line
If you’re troubleshooting a web site issue or trying to access a site that may have changed IP addresses, you may need to flush your DNS cache. Here are three easy ways to do it on Linux.
1) Open up Terminal and type the following command:
sudo kill -HUP `ps -A grep ‘dnsmasq’ awk ‘{print $2}’`
2) Open up System Preferences from the Apple menu and select Network from the list. Click Advanced then click DNS. In the box for Dodelete these caches when DHCP lease is expired click checkbox then click OK. Restart your computer by pressing Command+Option+Escape and selecting Restart.
3) Go to Terminal and enter this command:
sudo service network-manager restart . You can also open System Preferences and go to Network. Select Advanced in the left pane, then scroll down until you see DNS, and delete those caches when DHCP leases expire. When you’re done, press OK and close out of System Preferences. In Terminal, enter the following command:
sudo service network-manager restart will restart networking services, which will help with connectivity issues.
2) Via Windows
Flushing your DNS cache on Windows is a simple process. Just open the Command Prompt and type in ipconfig /flushdns. That’s it! Your DNS cache will be flushed and you can continue using the internet as usual. If you’re looking for more ways to flush the DNS cache, check out this post from Gadget Hacks. Via Mac: To flush your DNS cache on Mac, open Terminal and enter sudo killall -HUP mDNSResponder. You’ll need to provide an administrator password for confirmation.
Your DNS cache should now be flushed and you can use the internet like normal again. You can also reset the TCP/IP stack by entering resetadapter with your administrative credentials, but that should only be used if nothing else works. Via Ubuntu Flushing your DNS cache on Ubuntu is also quite easy. Open up terminal and enter sudo service network-manager restart.
The network manager will restart and clear any cached information regarding IP addresses of networks near you. After that, just disconnect then reconnect to the wifi or ethernet cable for the changes to take effect . If all goes well, your cache should now be empty and you’ll start receiving the latest information about connected networks.
However, there are a few things to keep in mind before proceeding. Firstly, flushing your DNS cache will have no effect if you’re not actually connected to any wireless networks at the time of doing so. Secondly, do not blindly follow these instructions without understanding what they do first! Flushing your DNS caches isn’t always necessary and may cause problems with how different websites function. If everything is working properly for you right now, I would recommend leaving well enough alone and not bothering with this step unless absolutely necessary.
3) Chrome Extension
The Chrome extension provides a one-click solution for flushing your DNS cache. Simply click the button and your DNS cache will be flushed. The extension also provides a handy badge that displays the current status of your DNS cache. If the badge is green, your DNS cache is flushed and you’re good to go. If the badge is red, there’s still work to be done. The extension doesn’t yet have a way to monitor whether or not your system has an IPv6 address, so if you don’t know whether or not IPv6 is enabled on your system then use Method
2: Command Line or Method
3: Terminal below. For Mac OS X/Linux Users: Open up a terminal window and enter this command, ipconfig grep IPv4 Address awk ‘{ print $2 }’ . A list of IP addresses should appear – the first in this list is your IPv4 address. For Windows Users: Click Start > Control Panel > Network and Internet > Network Connections > Details (on left) > Double-click Local Area Connection > Double-blink Internet Protocol Version 4 (TCP/IPv4)
It should say Obtain an IP address automatically. Right below it will say Obtain DNS server address automatically.
If these two fields are different, uncheck the box next to Obtain DNS server address automatically, and instead enter 8.8.8.8 as the Preferred DNS server under Manual settings. Then uncheck Obtain DNS server address automatically again, and press OK.