1*d83a80eeSchristosNSD for BIND users 2*d83a80eeSchristos------------------ 3*d83a80eeSchristosContents 4*d83a80eeSchristos1. Zone compiler. 5*d83a80eeSchristos2. Authoritative only. 6*d83a80eeSchristos3. Config file format. 7*d83a80eeSchristos4. Keys not per IP address. 8*d83a80eeSchristos5. NOTIFY of NS-entries. 9*d83a80eeSchristos6. Less options. 10*d83a80eeSchristos7. Master-Slave meshes. 11*d83a80eeSchristos8. AXFR behaviour. 12*d83a80eeSchristos9. Ports. 13*d83a80eeSchristos10. nsd-control setup 14*d83a80eeSchristos 15*d83a80eeSchristosPlease see the README for general information. This document 16*d83a80eeSchristosassumes the reader is familiar with BIND tools and explains 17*d83a80eeSchristosthe differences between BIND and NSD. 18*d83a80eeSchristos 19*d83a80eeSchristos1. Zone compiler. 20*d83a80eeSchristos 21*d83a80eeSchristosIn its memory NSD maintains fragments of data that are ready to put 22*d83a80eeSchristos'on the wire' without a lot of additional work by the server. Those 23*d83a80eeSchristosfragments of data need to be compiled from the zone file. Therefore 24*d83a80eeSchristosNSD has a zone compiler that translates the text format zone files 25*d83a80eeSchristosinto a binary format database file that the server reads. 26*d83a80eeSchristos 27*d83a80eeSchristos2. Authoritative only. 28*d83a80eeSchristos 29*d83a80eeSchristosNSD only serves authoritatively. So, NSD does not provide caching, and 30*d83a80eeSchristosdoes not provide recursion, or resolver functionality. NSD can, in other 31*d83a80eeSchristoswords, function as master or slave server. 32*d83a80eeSchristos 33*d83a80eeSchristosThis also means no root zone '.' type hint is used; leave out the root 34*d83a80eeSchristoszone entirely from your configuration. NSD does not cache the root. 35*d83a80eeSchristosNSD will not provide an upward referral in case an authoritative answer 36*d83a80eeSchristoscannot be found. Because of this design choice (see Appendix B.1 of the 37*d83a80eeSchristosREQUIREMENTS file) NSD does not need to maintain knowledge of the 38*d83a80eeSchristosroot-server set and there is no need for a root.hints file. 39*d83a80eeSchristosAlso leave out localhost zones from NSD config. 40*d83a80eeSchristos 41*d83a80eeSchristos3. Config file format. 42*d83a80eeSchristos 43*d83a80eeSchristosThe config file for NSD nsd.conf(5) is different from BIND named.conf(5). 44*d83a80eeSchristosSee the manual pages for differences in syntax. The zone files with 45*d83a80eeSchristosresource records have the same format however. 46*d83a80eeSchristos 47*d83a80eeSchristosA short configuration file for BIND can look like this: 48*d83a80eeSchristos 49*d83a80eeSchristos// Name server configuration named.conf 50*d83a80eeSchristosoptions { 51*d83a80eeSchristos directory "/etc/dns"; 52*d83a80eeSchristos pid-file "/etc/dns/pid-file"; 53*d83a80eeSchristos dnssec-enable yes; 54*d83a80eeSchristos listen-on-v6 { any; }; 55*d83a80eeSchristos recursion no; 56*d83a80eeSchristos}; 57*d83a80eeSchristos 58*d83a80eeSchristos// logging options for the DNS Server 59*d83a80eeSchristoslogging { 60*d83a80eeSchristos channel mainlog { 61*d83a80eeSchristos file "/var/log/dns.log" size 10m; 62*d83a80eeSchristos severity info; 63*d83a80eeSchristos }; 64*d83a80eeSchristos category default { 65*d83a80eeSchristos mainlog; 66*d83a80eeSchristos }; 67*d83a80eeSchristos}; 68*d83a80eeSchristos 69*d83a80eeSchristos// root hints 70*d83a80eeSchristoszone "." IN { 71*d83a80eeSchristos type hint; 72*d83a80eeSchristos file "root.servers"; 73*d83a80eeSchristos}; 74*d83a80eeSchristos 75*d83a80eeSchristoszone "localhost" IN { 76*d83a80eeSchristos type master; 77*d83a80eeSchristos file "localhost.zone"; 78*d83a80eeSchristos allow-update { none; }; 79*d83a80eeSchristos}; 80*d83a80eeSchristos 81*d83a80eeSchristoszone "0.0.127.in-addr.arpa" IN { 82*d83a80eeSchristos type master; 83*d83a80eeSchristos file "localhost.rev"; 84*d83a80eeSchristos allow-update { none; }; 85*d83a80eeSchristos}; 86*d83a80eeSchristos 87*d83a80eeSchristos// authoritative server for example.com 88*d83a80eeSchristoszone "example.com" IN { 89*d83a80eeSchristos type master; 90*d83a80eeSchristos file "example.com.signed"; 91*d83a80eeSchristos}; 92*d83a80eeSchristos 93*d83a80eeSchristosThe equivalent configuration file for NSD is shown below. Note no 94*d83a80eeSchristos;s at the end of statements. No braces {}, and comment is with #. 95*d83a80eeSchristos 96*d83a80eeSchristos# Name server config for NSD, nsd.conf 97*d83a80eeSchristosserver: 98*d83a80eeSchristos zonesdir: "/etc/dns" 99*d83a80eeSchristos pidfile: "/etc/dns/pid-file" 100*d83a80eeSchristos # dnssec is automatically enabled in NSD for signed zones. 101*d83a80eeSchristos # ip6 is also enabled for NSD. (ip4-only: yes to turn off). 102*d83a80eeSchristos # NSD does not do recursion. 103*d83a80eeSchristos database: "/etc/dns/nsd.db" 104*d83a80eeSchristos # logging clause comes here, no size or severity options. 105*d83a80eeSchristos logfile: "/var/log/dns.log" 106*d83a80eeSchristos 107*d83a80eeSchristos# NOTE: no root hints. 108*d83a80eeSchristos# no localhost, and no 0.0.127.in-addr.arpa zone. 109*d83a80eeSchristos 110*d83a80eeSchristos# authoritative server for example.com 111*d83a80eeSchristoszone: 112*d83a80eeSchristos name: "example.com" 113*d83a80eeSchristos zonefile: "example.com.signed" 114*d83a80eeSchristos 115*d83a80eeSchristos4. Keys not per IP address. 116*d83a80eeSchristos 117*d83a80eeSchristosBIND associates TSIG keys with an IP address. When communicating from/to 118*d83a80eeSchristosthat address BIND will TSIG sign. NSD associates TSIG keys with the 119*d83a80eeSchristosacl entries, when performing these functions NSD will sign with TSIG. 120*d83a80eeSchristosIt is thus possible to configure NSD to use a different key for 121*d83a80eeSchristosnotifications then for zone transfers, and a different key in one 122*d83a80eeSchristosdirection from the other. 123*d83a80eeSchristosAdditionally, NSD will reply TSIG signed queries with TSIG signed responses. 124*d83a80eeSchristos 125*d83a80eeSchristosIn BIND you might have a master that uses tsig for zone updates. 126*d83a80eeSchristos 127*d83a80eeSchristos// ... rest of named.conf config file 128*d83a80eeSchristos 129*d83a80eeSchristos// the TSIG key shared secret with the slave server 130*d83a80eeSchristoskey key23.example.com. { 131*d83a80eeSchristos algorithm hmac-md5; 132*d83a80eeSchristos secret "6KM6qiKfwfEpamEq72HQdA=="; 133*d83a80eeSchristos}; 134*d83a80eeSchristos 135*d83a80eeSchristos// when BIND communicates with this server, use the key 136*d83a80eeSchristosserver 168.192.0.15 { 137*d83a80eeSchristos keys { key23.example.com.; }; 138*d83a80eeSchristos}; 139*d83a80eeSchristos 140*d83a80eeSchristoszone "example.com" IN { 141*d83a80eeSchristos type master; 142*d83a80eeSchristos file "example.com.signed"; 143*d83a80eeSchristos allow-transfer { key key23.example.com.; }; 144*d83a80eeSchristos}; 145*d83a80eeSchristos 146*d83a80eeSchristosFor NSD the master configuration would look a little different. 147*d83a80eeSchristos 148*d83a80eeSchristos# ... rest of nsd.conf config file. 149*d83a80eeSchristos 150*d83a80eeSchristos# The TSIG key shared secret with the slave server 151*d83a80eeSchristoskey: 152*d83a80eeSchristos name: "key23.example.com." 153*d83a80eeSchristos algorithm: hmac-md5 154*d83a80eeSchristos secret: "6KM6qiKfwfEpamEq72HQdA==" 155*d83a80eeSchristos 156*d83a80eeSchristos# no need to list the server <addr> { keys { keyname; }; }; statement 157*d83a80eeSchristos 158*d83a80eeSchristoszone: 159*d83a80eeSchristos name: "example.com" 160*d83a80eeSchristos zonefile: "key23.example.com." 161*d83a80eeSchristos # the allow-transfer and server statements from BIND rolled into one. 162*d83a80eeSchristos provide-xfr: 168.192.0.15 key23.example.com. 163*d83a80eeSchristos # 164*d83a80eeSchristos # since NSD does not send notifies to the servers listed in the NS rrs, 165*d83a80eeSchristos # the above server must be explicitly named to get notify messages. 166*d83a80eeSchristos # see item 5, below. Note, the keyname is repeated here. 167*d83a80eeSchristos notify: 168.192.0.15 key23.example.com. 168*d83a80eeSchristos 169*d83a80eeSchristos5. NOTIFY of NS-entries. 170*d83a80eeSchristos 171*d83a80eeSchristosBIND sends notification messages automatically to the servers named 172*d83a80eeSchristosin the SOA and NS entries of a zone. NSD does not. It sends only to 173*d83a80eeSchristosthe 'notify:' entries in the config file. If you want NSD to send 174*d83a80eeSchristosnotifications to these servers, include notify: statements in the config 175*d83a80eeSchristosfile for them. 176*d83a80eeSchristos 177*d83a80eeSchristos6. Less options. 178*d83a80eeSchristos 179*d83a80eeSchristosNSD has less options than bind has. It is designed to be small. 180*d83a80eeSchristos 181*d83a80eeSchristosSome options that are *not* available in NSD are: 182*d83a80eeSchristos provide-ixfr 183*d83a80eeSchristos trusted-keys {} 184*d83a80eeSchristos controls {} 185*d83a80eeSchristos logging options 186*d83a80eeSchristos lwres {} 187*d83a80eeSchristos rrset-order 188*d83a80eeSchristos recursion yes; 189*d83a80eeSchristos cache options 190*d83a80eeSchristos zone types: hint, forward, stub 191*d83a80eeSchristos view clauses 192*d83a80eeSchristos 193*d83a80eeSchristos7. Master-Slave meshes. 194*d83a80eeSchristos 195*d83a80eeSchristosNSD can be configure as both a slave of a (hidden) master and as 196*d83a80eeSchristosa master to further slaves as well. This way meshes of name servers 197*d83a80eeSchristoscan be created, like with BIND. 198*d83a80eeSchristos 199*d83a80eeSchristos8. AXFR behaviour. 200*d83a80eeSchristos 201*d83a80eeSchristosTo do a manual AXFR, nsd-xfer will perform like the BIND tools. But, 202*d83a80eeSchristosthe initial query for the SOA is done by TCP, where the BIND tools 203*d83a80eeSchristosuse UDP for that SOA query. According to RFC (1034, 1035) specs, both 204*d83a80eeSchristosUDP and TCP for the initial SOA probe are OK. 205*d83a80eeSchristos 206*d83a80eeSchristosAn AXFR initiated by the built-in transfer process will not start with a 207*d83a80eeSchristosSOA query at all. The first packet of the AXFR transfer will be used 208*d83a80eeSchristosto determine the SOA version number in that case. This is a conscious 209*d83a80eeSchristosbreach of RFC spec to ease implementation and efficiency. 210*d83a80eeSchristos 211*d83a80eeSchristosNote that usually the built-in transfer process will request an IXFR, 212*d83a80eeSchristosand preceed the IXFR with a UDP IXFR request like the RFC says. 213*d83a80eeSchristos 214*d83a80eeSchristos9. Ports. 215*d83a80eeSchristos 216*d83a80eeSchristosNsd can be configured to run on another port than port 53. See the 217*d83a80eeSchristos'port:' statement in the nsd.conf file. Access control list elements 218*d83a80eeSchristoscan be appended with @port_number to refer to a specific port only, 219*d83a80eeSchristossuch as 10.11.12.100@8853. NSD will not set its source port for 220*d83a80eeSchristosoutgoing connections to be equal to the configured port, ephemeral 221*d83a80eeSchristosports are used for notify, ixfr and axfr requests to other servers. 222*d83a80eeSchristos 223*d83a80eeSchristos10. nsd-control setup 224*d83a80eeSchristos 225*d83a80eeSchristosThe rndc tool for BIND named needs a secret to communicate securely with 226*d83a80eeSchristosthe server. The NSD tool nsd-control can setup its secrets with the 227*d83a80eeSchristosnsd-control-setup command. It uses public keys, and SSL connections. 228*d83a80eeSchristos 229