DNS
Setting up BIND
The first resource record in any Domain Name System (DNS) Zone file should be a Start of Authority (SOA) resource record. The SOA resource record indicates that this DNS name server is the best source of information for the data within this DNS domain.
The SOA resource record contains the following information:
Source host - The host where the file was created.
Contact e-mail - The e-mail address of the person responsible for administering the domain's zone file. Note that a "." is used instead of an "@" in the e-mail name.
Serial number - The revision number of this zone file. Increment this number each time the zone file is changed. It is important to increment this value each time a change is made, so that the changes will be distributed to any secondary DNS servers.
Refresh Time - The time, in seconds, a secondary DNS server waits before querying the primary DNS server's SOA record to check for changes. When the refresh time expires, the secondary DNS server requests a copy of the current SOA record from the primary. The primary DNS server complies with this request. The secondary DNS server compares the serial number of the primary DNS server's current SOA record and the serial number in it's own SOA record. If they are different, the secondary DNS server will request a zone transfer from the primary DNS server. The default value is 3,600.
Retry time - The time, in seconds, a secondary server waits before retrying a failed zone transfer. Normally, the retry time is less than the refresh time. The default value is 600.
Expire time - The time, in seconds, that a secondary server will keep trying to complete a zone transfer. If this time expires prior to a successful zone transfer, the secondary server will expire its zone file. This means the secondary will stop answering queries, as it considers its data too old to be reliable. The default value is 86,400.
Minimum TTL - The minimum time-to-live value applies to all resource records in the zone file. This value is supplied in query responses to inform other servers how long they should keep the data in cache. The default value is 3,600.
The following is an example of a DNS server SOA resource record:
@ IN SOA nameserver.place.dom. postmaster.place.dom. (
1 ; serial number
3600 ; refresh [1h]
600 ; retry [10m]
86400 ; expire [1d]
3600 ) ; min TTL [1h]
Configuring Bind in Ubuntu/Debian
Install Bind
# apt-get install bind9
Ubuntu provides a pre-configured Bind, so we can edit /etc/bind/named.conf.local file instead of /etc/bind/named.conf
# cat /etc/bind/named.conf.local
zone "gene.com" {
type master;
file "/etc/bind/zones/sys-admin.net.db";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.192.168.0";
};
Create the zone file for sys-admin.net
@ IN SOA ubuntu.sys-admin.net. root.ubuntu.sys-admin.net. (
2007030701
28800
3600
604800
38400
)
IN NS ubuntu.sys-admin.net.
IN MX 10 ubuntu.sys-admin.net.
ubuntu IN A 192.168.0.2
dt IN A 192.168.0.3
lt IN A 192.168.0.1
Now, create the reverse lookup file
@ IN SOA ubuntu.sys-admin.net. root.ubuntu.sys-admin.net. (
2007030701
28800
3600
604800
38400
)
IN NS ubuntu.sys-admin.net.
IN NS ns1.sys-admin.net.
108 IN PTR ubuntu.sys-admin.net
77 IN PTR dt.sys-admin.net
66 IN PTR lt.sys-admin.net
rndc - name server control utility
reload Reload configuration file and zones. reload zone [class [view]] Reload a single zone. retransfer zone [class [view]] Retransfer a single zone without checking serial number. reconfig Reload configuration file and new zones only. sign zone [class [view]] Update zone keys, and sign as needed. loadkeys zone [class [view]] Update keys without signing immediately. stats Write server statistics to the statistics file. querylog Toggle query logging. dumpdb [-all|-cache|-zones] [view ...] Dump cache(s) to the dump file (named_dump.db). secroots [view ...] Write security roots to the secroots file. stop Save pending updates to master files and stop the server. halt Stop the server without saving pending updates. flush Flushes all of the server's caches. flush [view] Flushes the server's cache for a view. flushname name [view] Flush the given name from the server's cache(s) status Display status of the server.
To list all the address entries in the local DNS server
ls -t A abc.com > /tmp/nslookup.out
http://www.debian-administration.org/articles/343
http://www.debianhelp.co.uk/bindweb.htm
http://ubuntuforums.org/showthread.php?t=236093