Cuddletech's BIND Cheat Sheet ---------------------------- Source can be found at: http://www.isc.org/products/BIND/ Files of interest: -/etc/named.conf BINDs central configuration file -/var/named Directory containing maps -db.cache Root Server Referance -db. Host Listings, Aliases, etc. -db.XX.XX.XX Reverse Maps -db.127.0.0 Local Domain Reverse Map ********************************************************************************* DB Files: --------- You'll have several DB files. The first is the name-to-address mapping. Typically this file is named "db.". The second DB file you'll have is the address-to-name mapping, typically contained in a file named "db.xx.xx.xx" (eg: db.10.1.0). These maps are also commonly called "reverse maps". While there is generally only one name-to-address map, there should be one reverse map per network. The last map will be the loopback map, named "db.127.0.0", which obviously is also a reverse map. Note that the headers are: zone, class, type, nameserver, admin mail. This is important. The address here "ns.cuddletech.com." is the name of the primary master for "this data". The second is the email address for the DNS admin, with a "." in place of an "@". The mail address is not used by the daemon and is only for human consumption. DB File Record Types: SOA Indicates authority for this zone data NS List a name server for this zone MX Mail Exchanger A Name-to-Address mapping PTR Address-to-Name mapping CNAME Canonical name (aliases) IN INternet Class (optional) RP Responsable Person TXT Text Field Example of name-to-address map (File: db.cuddletech) ----------------------------------------------------------------- cuddletech.com. IN SOA ns.cuddletech.com. root.ns.cuddletech.com. ( 4 ; Serial 10800 ; Refresh 3600 ; Retry 604800 ; Expire 86400 ) ; Minimum TTL ; Name Servers cuddletech.com. IN NS ns.cuddletech.com. ; Host Addresses localhost.cuddletech.com. IN A 127.0.0.1 ns.cuddletech.com. IN A 10.0.0.1 pris.cuddletech.com. IN A 10.0.0.2 deckard.cuddletech.com. IN A 10.0.0.3 ; Aliases.... nexus.cuddletech.com. IN CNAME ns.cuddletech.com. nexus6.cuddletech.com. IN CNAME ns.cuddletech.com. intraweb.cuddletech.com. IN CNAME deckard.cuddletech.com. ----------------------------------------------------------------- Example of address-to-name (reverse) map (File: db.10.0.0) ----------------------------------------------------------------- 0.0.10.in-addr.arpa. IN SOA ns.cuddletech.com. root.ns.cuddletech.com. ( 4 ; Serial 10800 ; Refresh 3600 ; Retry 604800 ; Expire 86400 ) ; Minimum TTL ; Name Servers 0.0.10.in-addr.arpa. IN NS ns.cuddletech.com. ; Canonical Names 1.0.0.10.in-addr.arpa. IN PTR ns.cuddletch.com. 2.0.0.10.in-addr.arpa. IN PTR pris.cuddletech.com. 3.0.0.10.in-addr.arpa. IN PTR deckard.cuddletech.com. ----------------------------------------------------------------- Example of loopback map (File: db.127.0.0) ----------------------------------------------------------------- 0.0.127.in-addr.arpa. IN SOA ns.cuddletch.com. root.ns.cuddletech.com. ( 4 ; Serial 10800 ; Refresh 3600 ; Retry 604800 ; Expire 86400 ) ; Minimum TTL 0.0.127.in-addr.arpa. IN NS ns.cuddletech.com. 1.0.0.127.in-addr.arpa. IN PTR localhost. ----------------------------------------------------------------- NOTE: Here are some tricks... - You can add a "@" before your SOA entry and shorten things a bit, excluding the zone name, and modifing entries like this: The record: ns.cuddletech.com. IN A 10.0.0.1 Becomes: ns IN A 10.0.0.1 Or this: 0.0.10.in-addr.arpa. IN NS ns.cuddletech.com. Becomes: IN NS ns.cuddletech.com. Or this: 2.0.0.10.in-addr.arpa. IN PTR pris.cuddletch.com. Becomes: 2 IN PRT pris.cuddletch.com. And this: intraweb.cuddletech.com. IN CNAME deckard.cuddletech.com. Becomes: intraweb IN CNAME deckard - You can omit the class in all records, the "IN". INternet Class is assumed. - Leaving the record name blank implies the last record name, repeated. In our previous examples, @ was being interpreted as the zone name, and in our example we listed the NS entry as having no entry name. That's because @ would be expanded to "0.0.10.in-addr.arpa.", and the first record is our NS entries, who's records would be named "0.0.10.in-addr.arpa."... a repeat. This is why they can be omitted. This same principle is avalible throughout the db files. - The MX type, is for mail routing. Use this to point to your MTA. Syntax is: (domain) (priority) (MTA) cuddletech.com. IN MX 1 mailhub.cuddletech.com. - The RP and TXT types work together. Their syntax is: (host) (email addr) (record) ns IN RP root.cuddletech.com. system.cuddletech.com. system IN TXT "This is an administrative system" ********************************************************************************* The Root Cache DB File: The special map thats the same everywhere (almost) is the root cache db (typically named: db.cache). This file is obtained from interNIC's ftp server, and contains the data needed to access/reference the root servers. The map can be obtained at: ftp://FTP.RS.INTERNIC.NET/domain/named.root ********************************************************************************* The BIND Configuration File: The BIND configuration file is named /etc/named.conf. If it's named /etc/named.boot your on a system loaded with BIND 4.x. Some systems will an "in" between the zone and "{", this denotes class, INternet class. The "in" (in all cases) is assumed and can be removed. Note that the MINIMUM number of zones anyone will have is FOUR. Example of BIND's config file (file: /etc/named.conf) ----------------------------------------------------------------- options { directory "/var/named"; }; zone "." { type hint; file "db.cache"; }; zone "0.0.127.in-addr.arpa" { type master; file "db.127.0.0"; }; zone "0.0.10.in-addr.arpa" { type master; file "db.10.0.0"; }; zone "cuddletech.com" { type master; file "db.cuddletech"; }; ----------------------------------------------------------------- ********************************************************************************* Setting up a SLAVE Server: Slave servers are even easier. If BIND is already installed on the server, here are the steps: 1) Copy "named.conf" from the master server to the slave. 2) Create a directory for the databases, according the the config files "directory" directive. 3) Copy the local-reverse map (db.127.0.0) and the root cache (db.cache) files into the slaves database directory. 4) Edit "named.conf", changing the map names from "type master;", to "type slave;", for all zones with the exceptions of the root cache and the local-reverse map. 5) Still editing "named.conf", add a "masters" directive to all the slave zones, in the form: "masters { XX.XX.XX.XX; };" 6) Start the server like normal. Example of a Slave BIND config file (file: /etc/named.conf) ----------------------------------------------------------------- options { directory "/var/named"; }; zone "." { type hint; file "db.cache"; }; zone "0.0.127.in-addr.arpa" { type master; file "db.127.0.0"; }; zone "0.0.10.in-addr.arpa" { type slave; file "db.10.0.0"; masters { 10.0.0.1; }; }; zone "cuddletech.com" { type slave; file "db.cuddletech"; masters { 10.0.0.1; }; }; ----------------------------------------------------------------- ********************************************************************************* BIND Signal Handling: (process: named) Signal Action ------ ------------------------------------------------------------- HUP Reload the name server. Master reloads. Slaves pull new maps. INT Dump the internal database to /named_dump.db ILL Append name server stats to named.stats in name servers cwd USR1 Append debuging info to named.run in name servers cwd USR2 Turn off debugging. WINCH Toggle logging all queries to syslog TERM Exit and save dynamic zones to files. ********************************************************************************* Building BIND from Source This is a simple process. Grab the source from ftp.isc.org/isc/bind/src/cur/bind-8/ Then unpack, change into that directory and: 1) make stdlinks 2) make clean 3) make depend 4) make 5) make install ********************************************************************************* The complete, and thorough Resource Record (RR) syntax reference: - A address (owner) (class) (ttl) A (address) Example: localhost.cuddletech.com. IN A 127.0.0.1 Where: address is a 32bit address - CNAME canonical name (owner) (class) (ttl) CNAME (canonical-dname) Example: yummy IN CNAME icecream.cuddletech.com. Where: owner is the alias, and cname is the real name - HINFO host information (owner) (class) (ttl) HINFO (cpu) (os) Example: system.cuddletech.com. IN HINFO Sun4500 Solaris Where: cpu is a string specifing the cpu and os is a string specifying the os. - MB mailbox domain name - experimental (owner) (class) (ttl) MB (mbox-dname) Example: root.cuddletech.com. IN MB ns.cuddletech.com. Where: mbox is a domain-name which specifies a host with the specified mailbox. - MD mail destination - obsolete Replaced with MX - MF mail forwarder - obsolete Replaced with MX - MG mail group member - experimental (owner) (class) (ttl) MG (mgroup-dname) Example: admin.cuddletech.com. IN MG root.cuddletech.com IN MG oracle.cuddletech.com Where: owner is the address, and mgroup is the "subscribers" - MX mail exchanger (owner) (class) (ttl) MX (preference) (exchange-dname) Example: cuddletech.com. IN MX 0 mts.cuddletech.com. Where: owner is the domain, preference is the order in which mx records should be used, and exchange is the name of the mail server. - NS name server (owner) (class) (ttl) NS (name-server-dname) Example: cuddletech.com. IN NS ns.cuddletech.com. Where: dname is the dns server, and owner is the domain - PTR pointer (owner) (class) (ttl) PTR (dname) Example: 1.100.164.192.in-addr.arpa. IN PTR system.cuddletech.com. Where: dname is the dns name, and owner is the reversed address - SOA start of authority (owner) (class) (ttl) SOA (source-dname) (mbox) "(" serial refresh retry expire minimum ")" Example: cuddletech.com. IN SOA ns.cuddletech.com. root.ns.cuddletech.com ( 1; 10800; 3600; 604800; 86400 ) Where: owner is the name of the zone, source-dname is the name of the primary name server, and where mbox is the mailbox responsible for this domain - TXT text (owner) (class) (ttl) TXT (text-string) Example: newsys.cuddletech.com. IN TXT "Location: Under the Desk" Where: owner is the owner is the system and txt-string is the description - WKS well-known service (owner) (class) (ttl) WKS (address) (protocol) (service-list) Example: server.cuddletech.com. IN WKS 10.0.0.5 TCP ( telnet ssh ftp domain ) Where: owner is the machine name, address is a 32bit address, protical is the protical name, and service list is the services to direct. -------------------- Useful Links: The DNS Resource Directory: http://www.dns.net/dnsrd/ DNS Boss Config App: http://www.dnsboss.com/ DNS Documentation: http://www.isc.org/products/BIND/bind8.html Interesting Tools: http://www.domtools.com/ ########################DAS ENDE#################################################### ########Created for & by: benr@cuddletech.com####################################### ###################################################################\(^_^)/##########