Entry
Why do I get multiple identical IP addresses returned for some hosts?
Jun 17th, 2001 01:45
Brian Coogan,
Tinydns will return an IP address for each line defining an A record
and what is happening is that you are defining A records multiple times
accidentally. This happens because tinydns data lines generate several
record types depending on the fields given in each line. If you take a
look at the FAQ entry for "What records do the various tinydns data
lines generate?" you'll see that data lines of the following types all
generate A records if an IP address is present: MX ('@'), Child ('&'),
SOA ('.'), A ('=') and alias ('+'). The problem will be that you have
multiple definitions for the A record by having more than one line
containing both a name and an IP address for the host in question.
For instance, this incorrect data:
.eg.com:1.2.3.4:host.eg.com (SOA, NS, A)
=host.eg.com:1.2.3.4 (PTR, A)
@eg.com:1.2.3.4:host.eg.com:10 (MX, A)
actually generates three IP to name mappings for host.example.com and
thus three A records; tinydns will helpfully return all 3 when asked.
[Tinydns does this to allow multiple different IP addresses to be
defined for a host - there are some situations when you might want some
of the set of IP addresses returned to be the same.]
To correct this situation you need to ensure the IP address ('ip'
in '.fqdn:ip:x:ttl:timestamp:lo') is only defined in one place. The
example above modified to define only a single A record is:
.eg.com::host.eg.com (SOA, NS)
=host.eg.com:1.2.3.4 (PTR, A)
@eg.com::host.eg.com:10 (MX)
If a name -> address mapping is defined in one place, it is used in the
whole file, even in references before the actual definition, so once is
sufficient. [thanks Peter]
To read more about the meaning of the different tinydns data fields
look at the tinydns-data documentation:
http://cr.yp.to/djbdns/tinydns-data.html