How to flush DNS on Ubuntu 16.04

Profile picture for user devraj

There is possibility you get command not found if you execute below command. In that case you have to install nscd on your system.

To install nscd use below command:

sudo apt-get install nscd

Use the below commands as per your need to flush dns:

# To flush DNS cache run this command
sudo /etc/init.d/dns-clean restart
or
sudo /etc/init.d/networking force-reload

# To Flush nscd dns cache execute below command
sudo /etc/init.d/nscd restart

# If you wan to refresh your settings you can disable and then execute below command
sudo service network-manager restart