Debian Codegraph @

dnszonehowto.html

raw
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <HEAD>
3 <TITLE>How to use dnsZone with the BIND 9 sdb back-end</TITLE>
4 </HEAD>
5 <BODY>
6 <H1>How to use dnsZone with the BIND 9 sdb back-end</H1>
7 <H2>Record types</H2>
8 The dnsZone class does not contain attributes for all known record types. The
9 following types are missing: MF, MB, MG, MR, NULL, WKS, RP, AFSDB, X25, ISDN,
10 RT, NSAP, NSAP-PTR, PX and GPOS. Anything defined after this document was
11 written is obviously missing. If you want to add some record types that are
12 defined by <A href="http://www.iana.org/assignments/dns-parameters">IANA</A>,
13 please define it similar to what I've done for the existing ones. The name
14 should be <em>{TYPE}Record</em>, and OID should be
15 <em>1.3.6.1.4.1.2428.20.1.value</em>. For instance the RR type <em>LOC</em> has
16 value <em>29</em>, so attribute name should be <em>LocRecord</em> (casing
17 shouldn't matter), and the OID is <em>1.3.6.1.4.1.2428.20.1.29</em>. If you
18 follow this, you know that it will be compatible with what I and others
19 use, and I guarantee that the OIDs are unique.
20 <p>
21 The dnsZone class has attributes for some
22 basic record types like A, SOA, etc. which are defined in the cosine schema
23 and not in this schema. This means that your LDAP server must use both the
24 cosine schema and this one. If you're not you should get an error from your
25 LDAP server.
26 <H2>Example 1</H2>
27 Let's look at the following simple zone file.
28 <pre>
29 @ 3600 IN SOA ns.my-domain.com. hostmaster.my-domain.com. (
30 2001030201 3600 1800 604800 86400 )
31 NS ns.my-domain.com.
32 NS ns.other-domain.com.
33 MX 10 mail.my-domain.com.
34 MX 20 mail.other-domain.com.
35
36 my-hosta A 10.10.10.10
37 MX 10 mail.my-domain.com.
38 MX 20 mail.other-domain.com.
39 www 1800 CNAME my-hosta.my-domain.com.
40 my-hostb 3600 A 10.10.10.11
41 MX 10 mail.my-domain.com.
42 MX 20 mail.other-domain.com.
43 </pre>
44 This can be represented by the following LDIF file:
45 <pre>
46 dn: relativeDomainName=@, dc=my-domain, dc=com
47 objectClass: dNSZone
48 relativeDomainName: @
49 zoneName: my-domain.com
50 dNSTTL: 3600
51 dNSClass: IN
52 sOARecord: ns.my-domain.com. hostmaster.my-domain.com. 2001030201 3600 1800 604800 86400
53 nSRecord: ns.my-domain.com.
54 nSRecord: ns.other-domain.com.
55 mXRecord: 10 mail.my-domain.com.
56 mXRecord: 20 mail.other-domain.com.
57
58 dn: relativeDomainName=my-hosta, dc=my-domain, dc=com
59 objectClass: dNSZone
60 relativeDomainName: my-hosta
61 zoneName: my-domain.com
62 dNSTTL: 86400
63 dNSClass: IN
64 aRecord: 10.10.10.10
65 mXRecord: 10 mail.my-domain.com.
66 mXRecord: 20 mail.other-domain.com.
67
68 dn: relativeDomainName=www, dc=my-domain, dc=com
69 objectClass: dNSZone
70 relativeDomainName: www
71 zoneName: my-domain.com
72 dNSTTL: 1800
73 dNSClass: IN
74 cNAMERecord: my-hosta.my-domain.com.
75
76 dn: relativeDomainName=my-hostb, dc=my-domain, dc=com
77 objectClass: dNSZone
78 relativeDomainName: my-hostb
79 zoneName: my-domain.com
80 dNSTTL: 3600
81 dNSClass: IN
82 aRecord: 10.10.10.11
83
84 dn: relativeDomainName=my-hostb + dNSTTL=86400, dc=my-domain, dc=com
85 objectClass: dNSZone
86 relativeDomainName: my-hostb
87 zoneName: my-domain.com
88 dNSTTL: 86400
89 dNSClass: IN
90 mXRecord: 10 mail.my-domain.com.
91 mXRecord: 20 mail.other-domain.com.
92 </pre>
93 <p>
94 zoneName is the name of the zone, i.e. the name of the node in the zone
95 that is highest up in the DNS tree. relativeDomainName is the name of
96 the nodes relative to this, just like relative names in zone files
97 dNSClass is not used by the sdb back-end, so you can leave it out if you
98 like. The dNSTTL can also be left out, it will then default to the TTL
99 specified in named.conf.
100 <p>
101 If you want RRs with the same name to have different TTLs (like
102 my-hostb in the example), you will have to store it as multiple entries
103 all including <em>relativeDomainName=my-hostb</em>. You will need at least as
104 many entries as there are different TTLs. The main difficulty is to make
105 sure that they all have unique DNs. The way I've chosen is to have a
106 multi-valued RDN including dNSTTL, and put all RRs with the same TTL together.
107 This is a bit ugly, but I think this is better than having one entry per RR.
108 Let me know if you have other ideas.
109 <p>
110 When storing multiple zones you must make sure of course that the dn's are
111 unique. This can easily be done by including the zoneName attribute in the
112 DN. This can be done in several ways, one example would be
113 <em>relativeDomainName=www, zoneName=my-zone, dc=my-domain, dc=com</em>.
114
115 <H2>Example 2</H2>
116 The schema is quite flexible as I'll try to show in the next two examples.
117 If you have say the same MX records for the three hosts hosta, hostb and
118 hostc, you might have one entry for each host and have the same mXRecord
119 values in all the entries, or you can have one common entry with the
120 mXRecords like this:
121 <pre>
122 dn: relativeDomainName=hosta, dc=my-domain, dc=com
123 objectClass: dNSZone
124 relativeDomainName: hosta
125 relativeDomainName: hostb
126 relativeDomainName: hostc
127 zoneName: my-domain.com
128 mXRecord: 10 mail.my-domain.com.
129 mXRecord: 20 mail.other-domain.com.
130 </pre>
131
132 <H2>Example 3</H2>
133 Assume that we have one web server with one IP address that is a virtual
134 web server for hundreds of domains. Rather than having hundreds of similar
135 entries, one for each zone, you might do as follows:
136 <pre>
137 dn: relativeDomainName=www, dc=my-domain, dc=com
138 objectClass: dNSZone
139 relativeDomainName: www
140 zoneName: customerdomain1.com
141 zoneName: customerdomain2.com
142 ...
143 zoneName: customerdomain999.com
144 aRecord: 10.10.10.10
145 mXRecord: 10 mail.my-domain.com.
146 mXRecord: 20 mail.other-domain.com.
147 </pre>
148 If you have a bunch of zones that are identical, except for the zone name,
149 you might combine all their entries like above. Sort of like using the same
150 zone file for multiple zones.
151
152 <H2>Example 4</H2>
153 Let's have a look at PTR records for reverse lookups for IPv4 addresses.
154 Say you want to have a reverse for the address <em>1.2.3.4</em>. You then
155 need a PTR record for <em>4.3.2.1.in-addr.arpa</em>. Using normal zone
156 files you would typically have a file for the zone <em>3.2.1.in-addr.arpa</em>
157 and inside that put say
158 <pre>4 PTR my-hostc.my-domain.com.
159 </pre>
160 Using this back-end, you change <em>named.conf</em> like above, and use an
161 LDAP entry like this:
162 <pre>
163 dn: relativeDomainName=4, zoneName=3.2.1.in-addr.arpa, dc=my-domain, dc=com
164 objectClass: dNSZone
165 relativeDomainName: 4
166 zoneName: 3.2.1.in-addr.arpa
167 pTRRecord: my-hostc.my-domain.com.
168 </pre>
169 Note that the DN can be whatever you like. If you use a DN like the above,
170 you can use <em>zoneName=3.2.1.in-addr.arpa, dc=my-domain, dc=com</em> as
171 the search base in the URL in <em>named.conf</em>.
172
173 <H2>Example 5</H2>
174 As a final example, you might try to search below
175 <A href="ldap://ldap.venaas.no/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no">
176 ldap://ldap.venaas.no/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no</A>. There
177 you will find the zone data for venaas.com.
178 You can also browse my directory data using
179 <a href="http://sites.inka.de/ms/cgi-bin/web2ldap.fcgi/ldapurl?ldap://garibaldi.venaas.no/dc=venaas,dc=com,o=DNS,dc=venaas,dc=no??sub?(objectclass=*)">web2ldap</a>.
180 The master server for
181 venaas.com uses this server. The slave uses normal zone transfers.
182
183 <H2>Summary</H2>
184 As should be evident from the examples, you have great flexibility when
185 using this schema with the BIND9 back-end. The tree structure, the dn's,
186 doesn't matter at all, the back-end simply does a sub-tree search using
187 the base specified in named.conf for all entries in the wanted zone with
188 the wanted name. For example when someone tries to look up the node
189 <em>my-hosta.my-domain.com</em> it simply does a sub-tree search at the base
190 given in <em>named.conf</em> with the filter
191 <em>(&(zoneName=my-domain.com)(relativeDomainName=my-hosta))</em>. If someone
192 looks up <em>my-domain.com</em> it uses the filter
193 <em>(&(zoneName=my-domain.com)(relativeDomainName=@))</em>, and finally if
194 someone wants to get the entire zone, for example a secondary using AXFR,
195 it uses the filter <em>(zoneName=my-domain.com)</em>. Wildcards are not
196 supported.
197 <hr>
198 <address>
199 <a href="mailto:[email protected]">[email protected]</a>
200 </address>
201 Last modified: 2002-02-03
202 </BODY>