Configuring a DNS Server
To begin configuring the DNS server, check out these key config files for a BIND server:
配置文件 | 描述 |
---|---|
/etc/named.conf | Main config file |
/etc/rndc.key | Key file |
/etc/rndc.conf | Key config file |
/usr/share/doc/bind-9*/sample | Directory that holds sample files |
Before you do anything, you should make a backup of the /etc/named.conf file:
# cp /etc/named.conf /etc/named.conf.orig
You should also remove this file for now because you will be making a new one in the coming sections:
# rm /etc/named.conf
The first step for configuration is to make sure that your system has a static IP address and that the /etc/resolv.conf file is pointing to localhost as the nameserver:
Step 1. Verify that the localhost is used for DNS queries on RHEL01:
# cat /etc/resolv.conf
search example.com
nameserver 127.0.0.1
nameserver 192.168.1.1
The secondary server listed here is actually my personal router, which can provide DNS as well. Before going any further, you should also understand the different types of resource records used with DNS and why each one is important.
options | description |
---|---|
A | Maps the hostname to an IP address |
NS | Contains the IP address or CNAME of the nameserver |
MX | Defines where mail for a particular domain goes |
PTR | Maps the IP address to a hostname |
SOA | Contains general administrative control for the domain |
CNAME | Used as an alias |