yum安装dns软件:
1
|
[root@leslie ~]
# yum -y instal bind bind-chroot
|
配置:
1:主配置文件:(文件内声明正向解析与反向解析和区域文件)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@leslie ~]
# cd /var/named/chroot/etc/
[root@leslie etc]
# vim named.conf
[root@leslie etc]
# cat named.conf
options {
directory
"/var/named"
;
};
zone
"lesliecheung.com."
IN {
type
master;
file
"lesliecheung.com.zone"
;
};
zone
"100.168.192.in-addr.arpa"
IN {
type
master;
file
"192.168.100.arpa"
;
};
|
2:区域文件:
[root@leslie ~]# cd /var/named/chroot/var/named/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
[root@leslie named]
# vim leslie.com.zone
##添加正向解析
[root@leslie named]
# cat leslie.com.zone
$TTL 86400
@ IN SOA lesliecheung.com. root.lesliecheung.com. (
20150630
1H
2M
3W
1D
)
@ IN NS ns.lesliecheung.com.
mail IN MX 10 mail.lesliecheung.com.
@ IN A 192.168.100.100
mail IN A 192.168.100.100
ns IN A 192.168.100.100
ftp
IN A 192.168.100.100
ntp IN CNAME ns
www IN A 192.168.100.150
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
##添加反向解析:
[root@leslie named]
# cat 192.168.100.arpa
$TTL 86400
@INSOAlesliecheung.com.root.lesliecheung.com. (
20150630
1H
2M
3W
1D
)
@INNSns.lesliecheung.com.
mailINMX 10mail.lesliecheung.com.
100INPTRns.lesliecheung.com.
100INPTRntp.lesliecheung.com.
100INPTRftp.lesliecheung.com.
150INPTRwww.lesliecheung.com.
|
修改dns软件named的所属:
1
2
3
4
5
6
7
|
[root@leslie ~]
#
[root@leslie ~]
# cd /var/named/chroot/
[root@leslie chroot]
# chown named.named etc/named.conf var/named/leslie.com.zone var/named/192.168.100.arpa
[root@leslie chroot]
# ll etc/named.conf var/named/leslie.com.zone var/named/192.168.100.arpa
-rw-r--r-- 1 named named 196 10月 10 19:48 etc
/named
.conf
-rw-r--r-- 1 named named 293 10月 10 19:54 var
/named/192
.168.100.arpa
-rw-r--r-- 1 named named 287 10月 10 19:52 var
/named/leslie
.com.zone
|
启动dns:
1
2
|
[root@leslie ~]
# /etc/init.d/named start
启动 named: [确定]
|
测试:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
[root@leslie ~]
# nslookup
> server 192.168.100.100
Default server: 192.168.100.100
Address: 192.168.100.100
#53
> www.lesliecheung.com
Server:192.168.100.100
Address:192.168.100.100
#53
Name:www.lesliecheung.com
Address: 192.168.100.150
> 192.168.100.150
Server:192.168.100.100
Address:192.168.100.100
#53
150.100.168.192.
in
-addr.arpaname = www.lesliecheung.com.
> 192.168.100.100
Server:192.168.100.100
Address:192.168.100.100
#53
100.100.168.192.
in
-addr.arpaname =
ftp
.lesliecheung.com.
100.100.168.192.
in
-addr.arpaname = ns.lesliecheung.com.
100.100.168.192.
in
-addr.arpaname = ntp.lesliecheung.com.
|
本文转自偏执与柔情51CTO博客,原文链接:http://blog.51cto.com/lesliecheung/1971137 ,如需转载请自行联系原作者