As a web developer, I’m always having to work with DNS. Anyone who has dealt with DNS will tell you that caching is simultaneously a great thing and a horrible thing.
Today, I made a mistake with the IP address of a new host, and I needed to flush my DNS cache so that my machine would go and grab the new IP address. I hadn’t done this in Ubuntu before, so I had to figure it out. Fortunately, it’s really easy.
- Load Terminal (Applications > Accessories > Terminal)
- Type in the following:
sudo service networking restart
- Press the Enter key
- Put in your password
Done. Enjoy your newly flushed DNS cache.
Did I help you?
Hey this is a great way of flushing the dns cache, I’ve been using alternate ways of doing it which seemed to work fine but it’s handy to know there’s more ways of doing it. I have a bunch of commands for various other OS’s if anybody is looking for tips with how to do it.
What other ways have you used?
you could use this way:
sudo /etc/init.d/networking restart
Yes, that is essentially the same thing. This may be helpful for those with a messed up service script.