The Domain Name System (DNS)


What is it?


What is it?


How it works


Name server data

;
; db.linux.org.au - Example DNS data file for linux.org.au. domain
;

linux.org.au. IN SOA torvalds.linux.org.au. mike.cox.linux.org.au. (
        1995070201      ; Serial
        10800           ; Refresh = 3 hours
        3600            ; Retry = 1 hour
        604800          ; Expire = 1 week
        86400 )         ; Minumum TTL = 1 day

; Name servers
linux.org.au.                   IN NS           cox.linux.org.au.
linux.org.au.                   IN NS           torvalds.linux.org.au.

; Host addresses
becker.linux.org.au.            IN A            192.168.0.1
card.linux.org.au.              IN A            192.168.0.2
cox.linux.org.au.               IN A            192.168.0.3
eckhard.linux.org.au.           IN A            192.168.0.4
lord.linux.org.au.              IN A            192.168.0.5
torvalds.linux.org.au.          IN A            192.168.0.6
youngdale.linux.org.au.         IN A            192.168.0.7

; Host aliases
god.linux.org.au.               IN CNAME        torvalds.linux.org.au.


Reverse Lookups

;
; db.192.168.0 - Example DNS data for 192.168.0 subnet
;

0.168.192.in-addr.arpa. IN SOA torvalds.linux.org.au mike.cox.linux.org.au (
        1995070201      ; Serial
        10800           ; Refresh = 3 hours
        3600            ; Retry = 1 hour
        604800          ; Expire = 1 week
        86400 )         ; Minumum TTL = 1 day

; Name servers
0.168.192.in-addr.arpa.         IN NS           cox.linux.org.au.
0.168.192.in-addr.arpa.         IN NS           torvalds.linux.org.au.

; Host reverse entries
1.0.168.192.in-addr.arpa.       IN PTR          becker.linux.org.au.
2.0.168.192.in-addr.arpa.       IN PTR          card.linux.org.au.
3.0.168.192.in-addr.arpa.       IN PTR          cox.linux.org.au.
4.0.168.192.in-addr.arpa.       IN PTR          eckhardt.linux.org.au.
5.0.168.192.in-addr.arpa.       IN PTR          lord.linux.org.au.
6.0.168.192.in-addr.arpa.       IN PTR          torvalds.linux.org.au.
7.0.168.192.in-addr.arpa.       IN PTR          youngdale.linux.org.au.
;
; db.127.0.0 - Example dns file for 127.0.0 domain
;

0.0.127.in-addr.arpa.  IN SOA torvalds.linux.org.au. mike.cox.linux.org.au. (
        1995070201      ; Serial
        10800           ; Refresh = 3 hours
        3600            ; Retry = 1 hour
        604800          ; Expire = 1 week
        86400 )         ; Minumum TTL = 1 day

; Name servers
0.0.127.in-addr.arpa.           IN NS           cox.linux.org.au.
0.0.127.in-addr.arpa.           IN NS           torvalds.linux.org.au.

; Localhost
1.0.0.127.in-addr.arpa.         IN PTR          localhost.linux.org.au.


Other resource records

;
; Example DNS data file for linux.org.au. domain
;

; @ - shorthand for this domain
@       IN SOA torvalds.linux.org.au. mike.cox.linux.org.au. (
        1995070201      ; Serial
        10800           ; Refresh = 3 hours
        3600            ; Retry = 1 hour
        604800          ; Expire = 1 week
        86400 )         ; Minumum TTL = 1 day

; Name servers - lines starting with whitespace use the previous name
                        IN NS           cox.linux.org.au.
                        IN NS           torvalds.linux.org.au.

; Host addresses - relative to this domain
localhost               IN A            127.0.0.1

becker                  IN A            192.168.0.1
                        IN HINFO        IBM-PC/AT Linux
                        IN MX   10      becker.linux.org.au.

card                    IN A            192.168.0.2
                        IN HINFO        IBM-PC/AT Linux
                        IN MX   10      card.linux.org.au.

cox                     IN A            192.168.0.3
                        IN HINFO        IBM-PC/AT Linux
                        IN MX   10      card.linux.org.au.
                        IN MX   20      lord.linux.org.au.

eckhardt                IN A            192.168.0.4
                        IN HINFO        IBM-PC/AT Linux
                        IN MX   10      eckhardt.linux.org.au.

lord                    IN A            192.168.0.5
                        IN HINFO        IBM-PC/AT Linux
                        IN MX   10      lord.linux.org.au.

torvalds                IN A            192.168.0.6
                        IN HINFO        IBM-PC/AT Linux
                        IN MX   10      torvalds.linux.org.au.

youngdale               IN A            192.168.0.7
                        IN HINFO        IBM-PC/AT Linux
                        IN MX   10      youngdale.linux.org.au.

; Host aliases
god                     IN CNAME        torvalds.linux.org.au.


BIND - the Berkeley Internet Name Daemon

;
; named.boot - Example boot file for name server
;

; Where the DNS data files are kept
directory /var/named

; Primary domains
primary         linux.org.au            db.linux.org.au
primary         0.168.192.in-addr.arpa. db.192.168.0
primary         0.0.127.in-addr.arpa.   db.127.0.0

; The root server hints file
cache           .                       db.cache
;
; Example db.cache file
;

.                       99999999        IN NS           ns.nic.ddn.mil.
.                       99999999        IN NS           kava.nisc.sri.com.
.                       99999999        IN NS           aos.brl.mil.
.                       99999999        IN NS           c.nyser.net.
.                       99999999        IN NS           terp.umd.edu.
.                       99999999        IN NS           ns.nasa.gov.
.                       99999999        IN NS           nic.nordu.net.
ns.nic.ddn.mil.         99999999        IN A            192.112.36.4
kava.nisc.sri.com.      99999999        IN A            192.33.33.24
aos.brl.mil.            99999999        IN A            128.63.4.82
aos.brl.mil.            99999999        IN A            26.3.0.29
c.nyser.net.            99999999        IN A            192.5.25.82
terp.umd.edu.           99999999        IN A            128.8.10.90
ns.nasa.gov.            99999999        IN A            195.52.195.10
ns.nasa.gov.            99999999        IN A            128.102.16.10
nic.nordu.net.          99999999        IN A            192.36.148.17


Secondary nameservers

;
; Example named.boot - boot file for secondary name server
;

; Where the DNS data files are kept
directory /var/named

; Primary domains
primary         0.0.127.in-addr.arpa.   db.127.0.0

; Seondary domains
secondary       linux.org.au            192.168.0.3 192.168.0.6 db.linux.org.au
secondary       0.168.192.in-addr.arpa. 192.168.0.3 192.168.0.7 db.192.168.0

; The root server hints file
cache           .                       db.cache
linux.org.au. IN SOA torvalds.linux.org.au. mike.cox.linux.org.au. (
        1995070201      ; Serial
        10800           ; Refresh = 3 hours
        3600            ; Retry = 1 hour
        604800          ; Expire = 1 week
        86400 )         ; Minumum TTL = 1 day


The resolver library

#
# Example resolv.conf file
#

# The domain we are in
domain linux.org.au

# Which name servers to query - up to 3 of them
nameserver 192.168.0.3
nameserver 192.168.0.6

# Domains to search for unqualified hosts in
search linux.org.au
#
# Example host.conf file - resolv+ specific configuration
#

# Use these methods to do host lookups - can be hosts,bind,nis
order hosts,bind

# Return multiple addresses for hosts in which appear more
#  than once in /etc/hosts, instead of just the first.
multi on

# Attempt to prevent hostname spoofing.
nospoof on

# Log spoofing errors via syslog
alert on

# Order returned IP addresses so those on local networks appear first
#reorder on


nslookup

% nslookup
Default Server:  becker.linux.org.au
Address:  192.168.0.1

> cox.linux.org.au
Server:  becker.linux.org.au
Address:  192.168.0.1

Name:    cox.linux.org.au
Address:  192.168.0.3

> 192.168.0.5
Server:  becker.linux.org.au
Address:  192.168.0.1

Name:    lord.linux.org.au
Address:  192.168.0.5

> set querytype=ptr
> 5.0.168.192.in-addr.arpa.
Server:  becker.linux.org.au
Address:  192.168.0.1

5.0.168.192.in-addr.arpa        name = lord.linux.org.au
0.168.192.in-addr.arpa  nameserver = cox.linux.org.au
0.168.192.in-addr.arpa  nameserver = torvalds.linux.org.au
cox.linux.org.au        internet address = 192.168.0.3
torvalds.linux.org.au   internet address = 192.168.0.6
> set querytype=ns
> linux.org.au.
Server:  becker.linux.org.au
Address:  192.168.0.1

linux.org.au    nameserver = torvalds.linux.org.au
linux.org.au    nameserver = cox.linux.org.au
linux.org.au    nameserver = torvalds.linux.org.au
linux.org.au    nameserver = cox.linux.org.au
torvalds.linux.org.au   internet address = 192.168.0.6
cox.linux.org.au        internet address = 192.168.0.3

> set querytype=any
> linux.org.au.
Server:  becker.linux.org.au
Address:  192.168.0.1

linux.org.au
        origin = torvalds.linux.org.au
        mail addr = mike.cox.linux.org.au
        serial = 1995070201
        refresh = 10800 (3 hours)
        retry   = 3600 (1 hour)
        expire  = 604800 (7 days)
        minimum ttl = 86400 (1 day)
linux.org.au    nameserver = torvalds.linux.org.au
linux.org.au    nameserver = cox.linux.org.au
linux.org.au    nameserver = torvalds.linux.org.au
linux.org.au    nameserver = cox.linux.org.au
torvalds.linux.org.au   internet address = 192.168.0.6
cox.linux.org.au        internet address = 192.168.0.3
> ls -t ns linux.org.au.
[becker.linux.org.au]
 linux.org.au.                  server = torvalds.linux.org.au         
 linux.org.au.                  server = cox.linux.org.au              
> ls -t a linux.org.au.
[becker.linux.org.au]
 linux.org.au.                  server = torvalds.linux.org.au         
 linux.org.au.                  server = cox.linux.org.au              
 torvalds                       192.168.0.6
 youngdale                      192.168.0.7
 lord                           192.168.0.5
 localhost                      127.0.0.1
 becker                         192.168.0.1
 cox                            192.168.0.3
 eckhardt                       192.168.0.4
 card                           192.168.0.2
> ls -t any linux.org.au.
[becker.linux.org.au]
 linux.org.au.                  SOA   torvalds.linux.org.au mike.cox.linux.org.au. (1995070201 10800 3600 604800 86400)
 linux.org.au.                  NS    torvalds.linux.org.au         
 linux.org.au.                  NS    cox.linux.org.au              
 god                            CNAME torvalds.linux.org.au
 torvalds                       A     192.168.0.6
 torvalds                       HINFO IBM-PC/AT   Linux
 torvalds                       MX    10   torvalds.linux.org.au
 youngdale                      A     192.168.0.7
 youngdale                      HINFO IBM-PC/AT   Linux
 youngdale                      MX    10   youngdale.linux.org.au
 lord                           A     192.168.0.5
 lord                           HINFO IBM-PC/AT   Linux
 lord                           MX    10   lord.linux.org.au
 localhost                      A     127.0.0.1
 becker                         HINFO IBM-PC/AT   Linux
 becker                         MX    10   becker.linux.org.au
 becker                         A     192.168.0.1
 cox                            HINFO IBM-PC/AT   Linux
 cox                            MX    10   cox.linux.org.au
 cox                            A     192.168.0.3
 eckhardt                       A     192.168.0.4
 eckhardt                       HINFO IBM-PC/AT   Linux
 eckhardt                       MX    10   eckhardt.linux.org.au
 card                           A     192.168.0.2
 card                           HINFO IBM-PC/AT   Linux
 card                           MX    10   card.linux.org.au
 linux.org.au.                  SOA   torvalds.linux.org.au mike.cox.linux.org.au. (1995070201 10800 3600 604800 86400)
> exit
% nslookup
Default Server:  becker.linux.org.au
Address:  192.168.0.1

> set type=ns
> .
Server:  becker.linux.org.au
Address:  192.168.0.1

(root)  nameserver = NS.ISC.ORG
(root)  nameserver = NS.NIC.DDN.MIL
(root)  nameserver = NS.INTERNIC.NET
(root)  nameserver = AOS.ARL.ARMY.MIL
(root)  nameserver = NS1.ISI.EDU
(root)  nameserver = C.PSI.NET
(root)  nameserver = TERP.UMD.EDU
(root)  nameserver = NS.NASA.GOV
(root)  nameserver = NIC.NORDU.NET
NS.ISC.ORG      internet address = 192.5.5.241
NS.NIC.DDN.MIL  internet address = 192.112.36.4
NS.INTERNIC.NET internet address = 198.41.0.4
AOS.ARL.ARMY.MIL        internet address = 26.3.0.29
AOS.ARL.ARMY.MIL        internet address = 192.5.25.82
AOS.ARL.ARMY.MIL        internet address = 128.63.4.82
NS1.ISI.EDU     internet address = 128.9.0.107
C.PSI.NET       internet address = 192.33.4.12
TERP.UMD.EDU    internet address = 128.8.10.90
NIC.NORDU.NET   internet address = 192.36.148.17


Do I need to run a name server?

;
; named.boot - boot file for cache only name server
;

; Where the DNS data files are kept
directory /var/named

; Primary domains
primary         0.0.127.in-addr.arpa.   db.127.0.0

; The root server hints file
cache           .                       db.cache


Miscellaneous

Getting BIND

Further information