If your computer has trouble reaching a certain website or server this may be due to a corrupt local DNS cache.
Below are the steps that will show you how to clear your local DNS cache (“flush” it) for Linux Server.
- Open your terminal to use the command line.
- Login as root user using the su command-
user@host:~$ su
Password: (type your root user password here)
root@host: - Restart the name service cache daemon (NSCD)-
root@host: /etc/init.d/nscd restart - One of the most commonly used DNS caching Linux applications is NSCD (Name Service Caching Daemon).
- If you have NSCD installed, you can clear the local DNS cache by running one of the following commands in your favourite terminal/shell application. To clear the local DNS cache for the current user-
nscd -i hosts - To clear the local DNS cache for all users-
nscd -I hosts
[alert] Note: The name service cache daemon (NSCD) might not be installed by default on your Linux. You must be able to install it by using the package manager of your distribution – yum for RedHat-based distributions such as Fedora, CentOS and apt-get for Debian-based distributions such as Ubuntu, Kubuntu.[/alert]