<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
     "dtd/xml/4.1.2/docbookx.dtd">
<!-- $Id: quality-checking.db,v 1.3 2004-01-27 12:33:38 bortzmeyer Exp $ -->
<article>
  <articleinfo>
    <title>Checking your domaine: why and how</title>
    <author>
      <surname>Bortzmeyer</surname>
      <firstname>Stephane</firstname>
    </author>
    <pubdate>$Date: 2004-01-27 12:33:38 $</pubdate>
  </articleinfo>
  <section>
    <title>Why?</title>
    <para>My domain works. Why should I test it? Because the
    appearence of working is not enough. Your domain may work only
    from some places in the Internet (for instance because not all
    your nameservers are synchronized). Or your domain may be terribly
    slow because of a configuration error<footnote><para>Resolvers,
    the DNS clients, may have to try several nameservers to find a
    good one, thus slowing the application.</para>
      </footnote>. Or your domain may work
    only with some DNS resolvers but not all. This is why you should
    really implement some form of quality assessment, in other words,
    testing.</para>
    <para>All the studies show that most domains, even the TLD, have
    configuration problems. For instance, <ulink
    url="http://www.generic-nic.net/dyn/mon/">Generic NIC monitoring tool</ulink>
    monitors the ccTLD and find many of them in various states of
    breakage. A <ulink
    url="http://www.itu.int/itudoc/itu-t/workshop/cctld/cctld046.pdf">paper
    by Jim Reid</ulink> also emphasizes the bad consequences of the
    lack of quality control in most ccTLD. A <ulink url="http://www.credentia.cc/research/cctlds/report-2003-Oct.html">study by Mark Foster</ulink> says
    the same thing.</para>
    <para>When your TLD is fine, you can start chasing defects in your
    subzones. For instance, you may decide, like it is done in
    Germany, Brazil or France, or by RIPE-NCC for in-addr.arpa
    domains, to require a proper setup of subzones before or during
    delegation. Just be sure that this requirment is written in the
    contract you have with your registrants so that people are warned
    in advance. You can either test once before the delegation (and
    suspend the delegation as long as the domain does not really work)
    or do the test periodically and, if there is a failure, freeze or
    delete the domaine after, say, three consecutive failures.</para>
  </section>
  <section>
    <title>How?</title>
    <para>You can test your domain with any DNS debugging tool such as
    <application>dig</application>. However, when you have to conduct
    several tests on all your name servers, manually running dig has
    its limitations. You can either wrap it into a script or use an
    already made tool. We will study
    <application>check_soa</application> and
    <application>ZoneCheck</application>.</para>
    <section>
      <title>check_soa</title>
      <para><application>check_soa</application> was written by Liu
      and Albitz and is described in their <ulink
      url="http://www.oreilly.com/catalog/dns3/">DNS book</ulink>. You
      can retrieve the <ulink
      url="http://examples.oreilly.com/dns3/">source code</ulink> for
      all their examples, including check_soa.</para>
<para>check_soa asks all the name servers of the given domain and
      simply checks that they reply and are authoritative for the
      domain. It is a very simple tool, but which catches most of the
      configuration failures.</para>
      <para>You run it from the Unix command line:
	<programlisting>
<prompt>% </prompt><command>check_soa ml</command>
There was no response from dogon.sotelma.ml
There was no response from ns.ucad.sn
There is no name server running on ciwara1.sotelma.ml
ciwara.sotelma.ml has serial number 2002052400
There is no name server running on neene.afriq.net
	</programlisting>
	We can see here that only one out of five name servers for
	this ccTLD are actually responding properly. Three seem dead
	(use ping to check) and one has no name server running (BIND
	stopped and was never restarted?).
	</para>
      <para>On another domain:
<programlisting>
<prompt>% </prompt><command>check_soa bd</command>
DNS.bd is not authoritative for bd
There was no response from DNS1.bd
	</programlisting>
One of the servers is in "lame delegation" which means that it is
	listed as authoritative but is not. In that case, it is the
	primary and there was a syntax error in the configuration file
	of BIND, preventing it from starting properly. Very often, a
	lame delegation is due to a server which was listed for
	secondary service, without bothering to ask its administrators
	to set it up.</para>
      <para>You can see that check_soa catches a lot of problems. If
	you want more thorough tests, we will use a more powerful tool.</para>
    </section>
    <section>
      <title>ZoneCheck</title>
<para><ulink url="http://www.zonecheck.fr/">ZoneCheck</ulink> is written and maintained by Stephane d'Alu at <ulink
	  url="http://www.nic.fr/">AFNIC</ulink>.</para>
<para>You can use ZoneCheck <ulink
	  url="http://www.zonecheck.fr/demo/">from the Web</ulink> or you can
	  <ulink url="http://www.zonecheck.fr/download">download
	    it</ulink> and install it locally, for instance as a tool
	  to check your subzones. In the examples here, we will use it
	  locally.</para>
<para>Let's test other ccTLD with more subtle errors:
	<programlisting>
<prompt>% </prompt><command>zonecheck dj</command>
[Warnings not displayed]
       _____________
     ,-------------.|
~~~~ |    Fatal    || ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     `-------------'

[TEST SOA record present]: Answer refused from serveur
=> ns.ripe.net./193.0.0.193

==> FAILED (and 4 warning(s))
	</programlisting>
We added various verboseness options to see what's going on. Here,
	ns.ripe.net is listed as a nameserver for '.dj' but it refused
	to answer (probably another form of lame delegation). Fatal
	errors from ZoneCheck should be taken seriously.</para>
      <para>This domain has another fatal error:
	<programlisting>
<prompt>% </prompt><command>zonecheck us</command>
     _____________
     ,-------------.|
~~~~ |    Fatal    || ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     `-------------'

Server doesn't listen/answer on port 53 for TCP protocol
 | Ref: IETF RFC1035 (p.32 4.2. Transport)
 |  The DNS assumes that messages will be transmitted as datagrams or in a
 |  byte stream carried by a virtual circuit.  While virtual circuits can be
 |  used for any DNS activity, datagrams are preferred for queries due to
 |  their lower overhead and better performance.
 `----- -- -- - -  -
=> c.gtld.biz./209.173.60.65

==> FAILED (and 7 warning(s))
	</programlisting>
Do note that ZoneCheck displays the specific section of the RFC which
	mandates the correct behavior (here, a DNS server must be
	reachable with TCP, not only UDP).
      </para>
      <para>Another domain has no fatal errors but exhibit some
	warnings:
	<programlisting>
<prompt>% </prompt><command>zonecheck be</command>
      _______________
     ,---------------.|
~~~~ |    Warning    || ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     `---------------'
[...]
Can't find reverse for the nameserver IP address
=> schaarbeek.ns.dns.be./213.181.36.60

==> SUCCEED (but 22 warning(s))
</programlisting>
Here, a nameserver has no PTR record. 
</para>
    <para>ZoneCheck is quite configurable: by default it uses the
      configuration file choosen by its author but you can change it
      to suit your local policy.</para>
    </section>
  </section>
</article>





