Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Which command can be used to flush DNS cache in Ubuntu?

share|improve this question
up vote 4 down vote accepted

By default in Ubuntu is no caching DNS query.

If you use remote DNS server, then you have no chance to update their cache.

If you install local server. BIND:

rndc flush


service nscd reload


/etc/init.d/dnsmasq restart
share|improve this answer
Just wonder why not caching DNS query for performance boost? – Ryan Mar 4 '11 at 16:57
I demand mentioning all the rest DNS resolvers ever written!!!111 – poige May 6 '12 at 8:56

In my ubuntu 11.04 , I ran this:/etc/init.d/dns-clean to clean dns it's content is as follow:

#! /bin/sh

# $Id: dns-clean,v 2004/05/07 03:12:59 john Exp $

# dns-clean by John Hasler 1999-2003
# Any possessor of a copy of this program may treat it as if it
# were in the public domain.  I waive all rights.

# This script should be run at bootup to clean up any mess left by 0dns-up.
# It should be run before ppp is started.
# It should never be run while ppp is up.

# Provides:          dns-clean
# Required-Start:    $local_fs $remote_fs gdm
# Required-Stop:     $local_fs
# Default-Start:     1 2 3 4 5
# Default-Stop:
# Short-Description: Cleans up any mess left by 0dns-up
# Description: 0dns-up often leaves behind some cruft. This Script is meant
#              to clean up any such mess.


test -f /usr/sbin/pppconfig || exit 0
# We might have a tmpfs /var/run.
mkdir /var/run/pppconfig >/dev/null 2>&1 || true
test -f /etc/ppp/ip-down.d/0dns-down || exit 0

. /lib/lsb/init-functions
. /etc/default/rcS

case "$1" in
    [ "$VERBOSE" != no ] && log_begin_msg "Restoring resolver state..."
    /etc/ppp/ip-down.d/0dns-down "0dns-clean"
    [ "$VERBOSE" != no ] && log_end_msg $?

exit 0
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.