Linux: Start / Stop / Restart BIND DNS Server

by on April 26, 2012 · 1 comment· LAST UPDATED April 26, 2013

in ,

How do I start / stop / restart the Berkeley Internet Name Daemon (BIND) dns server under Linux operating systems?

BIND is by far the most widely used DNS software on the Internet. Use the following commands as per your Linux distro:

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
Requirementsservice command
Estimated completion timeN/A
[a] service service-name command.

[b] /etc/init.d/service-name script command.

[c] rndc command - Name server control utility.

CentOS / RHEL / Fedora Linux

Type the following command to start BIND server:
# service named start
Type the following command to stop BIND server:
# service named stop
Type the following command to restart BIND server:
# service named restart
Type the following command to reload BIND server to reload zone file or config file changes:
# service named reload
Type the following command to see the current status of BIND server:
# service named status
You can also use the following syntax too:

 
/etc/init.d/named start
/etc/init.d/named stop
/etc/init.d/named restart
 

Debian / Ubuntu Linux

Type the following command to start BIND server:
# service bind9 start
Type the following command to stop BIND server:
# service bind9 stop
Type the following command to restart BIND server:
# service bind9 restart
Type the following command to reload BIND server to reload zone file or config file changes:
# service bind9 reload
Type the following command to see the current status of BIND server:
# service bind9 status
Sample outputs:

Fig.01: BIND 9 Service In Action

Fig.01: BIND 9 Service In Action


You can also use the following syntax too:

 
/etc/init.d/bind9 start
/etc/init.d/bind9 stop
/etc/init.d/bind9 restart
/etc/init.d/bind9 status
 

A note about rncd command

This is an optional command and you are recommended to use the above commands only. From the rndc man page:

rndc controls the operation of a name server. It supersedes the ndc utility that was provided in old BIND releases. If rndc is invoked with no command line options or arguments, it prints a short summary of the supported commands and the available options and their arguments. rndc communicates with the name server over a TCP connection, sending commands authenticated with digital signatures. In the current versions of rndc and named, the only supported authentication algorithm is HMAC-MD5, which uses a shared secret on each end of the connection. This provides TSIG-style authentication for the command request and the name server's response. All commands sent over the channel must be signed by a key_id known to the server. rndc reads a configuration file to determine how to contact the name server and decide what algorithm and key it should use.

Please note that rndc does not yet support all the commands of the BIND 8 ndc utility:

  1. status - Display status of the server.
  2. stop - Save pending updates to master files and stop the server.
  3. restart - Restart the server.
  4. reload - Reload configuration file and zones.

To see status, enter:
# rndc status
Sample outputs:

version: 9.7.3
CPUs found: 8
worker threads: 8
number of zones: 18
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running

To reload the server, enter:
# rndc reload
To see all options just type rncd:
# rndc
Sample outputs:

 
Usage: rndc [-b address] [-c config] [-s server] [-p port]
	[-k key-file ] [-y key] [-V] command
 
command is one of the following:
 
  reload	Reload configuration file and zones.
  reload zone [class [view]]
		Reload a single zone.
  refresh zone [class [view]]
		Schedule immediate maintenance for a zone.
  retransfer zone [class [view]]
		Retransfer a single zone without checking serial number.
  freeze	Suspend updates to all dynamic zones.
  freeze zone [class [view]]
		Suspend updates to a dynamic zone.
  thaw		Enable updates to all dynamic zones and reload them.
  thaw zone [class [view]]
		Enable updates to a frozen dynamic zone and reload it.
  notify zone [class [view]]
		Resend NOTIFY messages for the zone.
  reconfig	Reload configuration file and new zones only.
  sign zone [class [view]]
		Update zone keys, and sign as needed.
  loadkeys zone [class [view]]
		Update keys without signing immediately.
  stats		Write server statistics to the statistics file.
  querylog	Toggle query logging.
  dumpdb [-all|-cache|-zones] [view ...]
		Dump cache(s) to the dump file (named_dump.db).
  secroots [view ...]
		Write security roots to the secroots file.
  stop		Save pending updates to master files and stop the server.
  stop -p	Save pending updates to master files and stop the server
		reporting process id.
  halt		Stop the server without saving pending updates.
  halt -p	Stop the server without saving pending updates reporting
		process id.
  trace		Increment debugging level by one.
  trace level	Change the debugging level.
  notrace	Set debugging level to 0.
  flush 	Flushes all of the server's caches.
  flush [view]	Flushes the server's cache for a view.
  flushname name [view]
		Flush the given name from the server's cache(s)
  status	Display status of the server.
  recursing	Dump the queries that are currently recursing (named.recursing)
  validation newstate [view]
		Enable / disable DNSSEC validation.
  *restart	Restart the server.
  addzone ["file"] zone [class [view]] { zone-options }
		Add zone to given view. Requires new-zone-file option.
  delzone ["file"] zone [class [view]]
		Removes zone from given view. Requires new-zone-file option.
 
* == not yet implemented
Version: 9.7.3
 
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 Bind9User April 18, 2014 at 5:49 am

Found problem with bind. It runs for weeks without problems, then slowly over a period of a few hours, it takes longer and longer to resolve, and at certain stage it just stops giving back answers. If one restart bind, problem immediately goes away and all is well for another few weeks. Looking at /var/log/syslog gives no clue why bind is doing this. Server has plenty of diskspace and memory free. I noticed on the net a few other people reported the same problem. Does anybody have a clue why this is happening?

Reply

Leave a Comment

Tagged as: , , , ,

Previous Faq:

Next Faq: