1、 安装需要的软件
[root@ly ~]# yum -y install bind*
# 开机启动
[root@ly ~]# systemctl enable named
2.配置bind
[root@ly ~]# vim /etc/named.conf
options {
listen-on port 53 { any; };//将大括号内的内容改成any
//listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };//将大括号内的内容改成any
3.添加正、反向解析域
3.1指向生效的配置文件
[root@ly ~]# vim /etc/named.rfc1912.zones
//正向
zone "cljhfy.com" IN {
type master;
file "cljhfy.com.zone";
allow-update { none; };
};
//反向
zone "163.168.192.in-addr.arpa" IN {
type master;
file "163.168.192.zone";
allow-update { none; };
};
3.2生成配置文件lyjhfy.com.zone和163.168.192.zone
[root@ly ~]# cd /var/named/
[root@ly named]# vim lyjhfy.com.zone
$TTL 1D
@ IN SOA lyjhfy.com. admin.lyjhfy.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS www.lyjhfy.com.
NS ftp.lyjhfy.com.
A 127.0.0.1
AAAA ::1
MX 10 mx.lyjhfy.com.
ttl IN A 192.168.163.156
www IN A 192.168.163.156
bbs IN CNAME www
mx IN A 192.168.163.156
ftp IN A 192.168.163.156
[root@ly named]# vim 163.168.192.zone
$TTL 1D
@ IN SOA cljhfy.com. admin.lyjhfy.com. (
0
2H
10M
7D
1D )
NS ttl.lyjhfy.com.
A 127.0.0.1
AAAA ::1
128 IN PTR lyjhfy.com.
128 IN PTR www.lyjhfy.com.
128 IN PTR ftp.lyjhfy.com.
128 IN PTR mx.cljhfy.com.
~
//注意:一点要给权限
[root@ly named]# chown named.named lyjhfy.com.zone
[root@ly named]# chown named.named 163.168.192.zone
[root@ly named]# chmod 755 lyjhfy.com.zone
[root@cl named]# chmod 755 163.168.192.zone
//启动服务
[root@ly named]# systemctl start named-chroot