过程
1. 安装bind
yum install -y bind
2. 修改配置文件
1. /etc/name.conf
将配置文件改成下图的样子,主要是箭头指向的地方.
2. /etc/name.rfc1912.zones
zone "test.com" IN {
type master;
file "test.com.zone";
allow-update { none; };
};
zone "171.168.192.in-addr.arpa" IN {
type master;
file "192.168.171.zone";
allow-update { none; };
};
3. 添加对应域的正反向解析文件
cp -p /var/named/named.localhost /var/named/test.com.zone #正向 cp -p /var/named/named.empty /var/named/192.168.171.zone #反向
4. 修改解析文件的内容
vim /var/named/test.com.zone:
$TTL 1D
@ IN SOA test.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.test.com
MX 3 mail.test.com
dns IN A 192.168.171.23
www IN A 192.168.171.24
mail IN A 192.168.171.25
* A 192.168.171.77
vim /var/named/192.168.171.zone
$TTL 3H
@ IN SOA test.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.test.com
MX 3 mail.test.com
23 PTR dns.test.com
24 PTR www.test.com
25 PTR mail.test.com
* PTR xxx.test.com
结果检验
echo name server 192.168.171.141 > /etc/resolv.conf nslookup www.test.com
|