[root@localhost ~]# cd /var/named/
[root@localhost named]# vim 192.168.153.arpa.zone
$TTL 1D
@ IN SOA 153.168.192.in-addr.arpa. linuxidc.com. (
2010110901
28800
14400
3600000
86400
)
@ IN NS master.linuxidc.com.
130 IN PTR master.linuxidc.com 192.168.153.130 -> master
129 IN PTR ; 192.168.153.129 -> www
129 IN PTR nginx.linuxidc.com. ; 192.168.153.129 -> nginx
129 IN PTR img.linuxidc.com. ; 192.168.153.129 -> img
3.语法检查:
[root@localhost ~]# /usr/sbin/named-checkconf -z
4.重启服务:
[root@localhost ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
5.反向解析验证:
[root@localhost ~]# nslookup
> 192.168.153.129
Server: 192.168.153.130
Address: 192.168.153.130#53
129.153.168.192.in-addr.arpa name =
129.153.168.192.in-addr.arpa name = nginx.linuxidc.com.
129.153.168.192.in-addr.arpa name = img.linuxidc.com.
>
> 192.168.153.130
Server: 192.168.153.130
Address: 192.168.153.130#53
130.153.168.192.in-addr.arpa name = master.linuxidc.com.153.168.192.in-addr.arpa.
>
DNS CNAME记录
CNAME记录,即别名记录,我们通过设置别名记录,可以将多个名称指向同一台主机,CNAME记录的前提是必须要有一条A记录,A记录是创建CNAME记录的前提.
这样可以在ip变动的情况下,我们不用一个一个的去更改主机名到主机的A记录映射,只需要改动别名到主机的一条A记录就可以全部搞定,达到事倍功半的效果.
未使用别名(CNAME)的正向解析区域配置文件:
[root@localhost named]# vim linuxidc.com.zone
$TTL 1D
@ IN SOA master.linuxidc.com. email.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS master
master IN A 192.168.153.130
www IN A 192.168.153.129
nginx IN A 192.168.153.129
bbs IN A 192.168.153.129
img IN A 192.168.153.129
使用别名后的区域配置文件.
[root@localhost named]# vim linuxidc.com.zone
$TTL 1D
@ IN SOA master.linuxidc.com. email.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS master
master IN A 192.168.153.130
proxy IN A 192.168.153.129
www IN CNAME proxy
nginx IN CNAME proxy
bbs IN CNAME proxy
img IN CNAME proxy
检查并重启服务,nslookup测试验证: