Setting up Bind
We will make a movie dns.
Contents |
db.DOMAIN
File that maps hostnames to addresses is called db.domian. We will call ours db.movie.edu.
db.ADDR
The files mapping addresses to hostnames are called db.ADDR, where ADDR is the network number without training zeros. In our example these files will be db.192.249.249 and db.192.253.253
The db.domain and db.addr are called zone datafiles. The format of these files is called master file format.
db.cache
db.127.0.0
The db.cache and db.127.0.0 files are called overhead.
To tie all these files together you need a named.conf file.
Zone DataFiles
- TTL
- SOA record (start of authority for this zone)
- NS record (lists a nameserver for this zone)
- Other records (data about hosts in this zone)
- A (name-to-address mapping)
- PTR (name-to-address mapping)
- CNAME (canonical name of aliases)
comments start with a semicolon.
Setting the zone default TTL
We add the following resource record to db.movie.edu file.
$TTL 3h
SOA Records
We add the following resource record to db.movie.edu file.
movie.edu. IN SOA toystory.movie.edu. al.movie.edu. ( 1 ; Serial 3h ; Refresh after 3 hours 1h ; Retry after 1 hour 1w ; Expire after 1 week 1h ) ; Negative caching TTL of 1 hour
NS Records
Here is the information about our two name servers. We add the following resource record to db.movie.edu file.
; NS Record movie.edu. IN NS toystory.movie.edu. movie.edu. IN NS wormhole.movie.edu.
Address and Alias Records
Next, we create name-to-address mappings. We add the following resource record to db.movie.edu file.
; ; Host addresses ; localhost.movie.edu. IN A 127.0.0.1 shrek.movie.edu. IN A 192.249.249.2 toystory.movie.edu. IN A 192.249.249.3 monsters-inc.movie.edu. IN A 192.249.249.4 misery.movie.edu. IN A 192.253.253.2 ; ; Multi-homes hosts ; wormhole.movie.edu. IN A 192.249.249.1 wormhole.movie.edu. IN A 192.253.253.1 ; ; Aliases ; toys.movie.edu. IN CNAME toystory.movie.edu. mi.movie.edu. IN CNAME monsters-inc.movie.edu. wh.movie.edu. IN CNAME wormhole.movie.edu. wh249.movie.edu. IN A 192.249.249.1 wh253.movie.edu. IN A 192.253.253.1
The A stands for addresses. wormhole.movie.edu is a multihomed host. It has two addresses associated with it. CNAME is canonical name resource record. The last two entries solve a problem to check individual interface for the multihomed host.
PTR Records
Next we create address-to-name mappings. This will go in the file 192.249.249
1.249.249.192.in-addr.arpa. IN PTR wormhole.movie.edu. 2.249.249.192.in-addr.arpa. IN PTR shrek.movie.edu. 3.249.249.192.in-addr.arpa. IN PTR toystory.movie.edu. 4.249.249.192.in-addr.arpa. IN PTR monsters-inc.movie.edu.
Same data is inserted for file db.192.253.253
1.249.249.192.in-addr.arpa. IN PTR wormhole.movie.edu. 2.249.249.192.in-addr.arpa. IN PTR shrek.movie.edu. 3.249.249.192.in-addr.arpa. IN PTR toystory.movie.edu. 4.249.249.192.in-addr.arpa. IN PTR monsters-inc.movie.edu.
Complete Zone Datafiles
Here is the complete db.movie.edu:
$TTL 3h movie.edu. IN SOA toystory.movie.edu. al.movie.edu. ( 1 ; Serial 3h ; Refresh after 3 hours 1h ; Retry after 1 hour 1w ; Expire after 1 week 1h ) ; Negative caching TTL of 1 hour ; NS Record movie.edu. IN NS toystory.movie.edu. movie.edu. IN NS wormhole.movie.edu. ; ; Host addresses ; localhost.movie.edu. IN A 127.0.0.1 shrek.movie.edu. IN A 192.249.249.2 toystory.movie.edu. IN A 192.249.249.3 monsters-inc.movie.edu. IN A 192.249.249.4 misery.movie.edu. IN A 192.253.253.2 ; ; Multi-homes hosts ; wormhole.movie.edu. IN A 192.249.249.1 wormhole.movie.edu. IN A 192.253.253.1 ; ; Aliases ; toys.movie.edu. IN CNAME toystory.movie.edu. mi.movie.edu. IN CNAME monsters-inc.movie.edu. wh.movie.edu. IN CNAME wormhole.movie.edu. ; Interface specific names wh249.movie.edu. IN A 192.249.249.1 wh253.movie.edu. IN A 192.253.253.1
Complete PTR files
db.192.249.249
$TTL 3h 249.249.192.in-addr.arpa. IN SOA toystory.movie.edu. al.movie.edu. ( 1 ; Serial 3h ; Refresh after 3 hours 1h ; Retry after 1 hour 1w ; Expire after 1 week 1h ) ; Negative caching TTL of 1 hour
db.192.253.253
$TTL 3h 253.253.192.in-addr.arpa. IN SOA toystory.movie.edu. al.movie.edu. ( 1 ; Serial 3h ; Refresh after 3 hours 1h ; Retry after 1 hour 1w ; Expire after 1 week 1h ) ; Negative caching TTL of 1 hour