Shammer's Philosophy

My private adversaria

Basic DNS Configuration

What DNS Server should do?

Basic DNS server functions are below.

  • DNS Server configuration files
  • Manage own zone
  • Resolver

DNS Server configuration files are depended on the DNS Server.
I use bind so I will write about bind config files.
The informations required zone management might be equal between multiple DNS Server implementations, like bind, MS DNS and so on.
Managing own zone requires following informations.

  • Start Of Authority(SOA)
  • Records themselves

I will define those informations in the same file, calling this file as DB file in this article.
Then, DB files are at least 2 types, for forward lookup and reverse lookup.
Those files are basic configuration files.

SOA configuration

SOA definition should be like below.

$TTL	86400 
@       IN      SOA     mydns.mysample.com root.mysample.com. ( 
                        2               ; Serial 
                        604800          ; Refresh 
                        86400           ; Retry 
                        2419200        	; Expire 
                        604800 )        ; Negative Cache TTL 
					;

Record configuration

Record informations for forward lookup would be following after SOA.

; 
        IN      NS      dns.mysample.com. 
dns     IN      A       X.X.X.X
www     IN      A       Y.Y.Y.Y 
file    IN      A       Z.Z.Z.Z 
...

Record informations for reverse lookup would be following after SOA.

@       IN      NS      dns.mysample.com. 
X       IN      PTR     dns.mysample.com.
Y       IN      PTR     www.mysample.com.
...

The name of DB files for reverse lookup is important. I can not test and not sure but it should be included network address.
For example, the IP address of www.mysample.com is 192.168.1.1, DB file for reverse lookup should be db.192.168.1, and PTR record should be below.

1       IN      PTR     www.mysample.com.

Then, bind manages above DB files and those files should be defined in /etc/bind/named.conf or the file included by /etc/bind/named.conf.
I configure my /etc/bind/named.conf like below.

include "/etc/bind/named.conf.options"; 
include "/etc/bind/named.logging.conf"; 
include "/etc/bind/named.conf.local"; 
include "/etc/bind/named.conf.default-zones"; 
include "/etc/bind/named.conf.my-zones";  //added this line

/etc/bind/named.conf.my-zones content is the one described as DB file.
Bind has a lot of configurations, I will write about them if there will be a chance.