搭建一个简单的dns缓存服务器
环境:linux
directory "/var/named";
type hint;
file "named.ca";
type master;
file "named.localhost";
type master;
file "named.loopback";
type master;
file "named.huwentao";
type master;
file "named.192.168.192.in-addr.arpa";
201703312006
1D
2H
2D
1D)
$TTL 600
201703312101
1D
1H
2D
2H)
IN
NS
ns1.huwentao.com.
软件:bind97,bind97-utils, bind97-libs
ip:192.168.192.130;192.168.192.131
----------------------------------------------------------------------------------------------------------------
用命令判断以上软件是否安装成功
yum list all | grep "bind.*install"
当上面的软件全部安装成功之后,我们开始进行linux-dns缓存服务器的搭建
mv /etc/named.conf
/etc/named.conf.back--------->备份dns的原配置文件
----------------------------------------------------------------------------------------------------------------
默认的几个目录
/etc/named.conf(定义域以及对应的资源记录路径)
/var/named(资源类型记录)
/named.ca(根域rrt)
/named.localhost(本机rrt)
/named.loopback(本机反向rrt)
---------------------------------------------------------------------------------------------------------------
DNS(domain name system域名解析系统)
作用:
正向: IP----------->域名
反向: 域名----------->IP
资源记录类型
1、SOA(起始授权服务)
2、NS(名称服务器)
3、MX(邮件服务)
4、CNAME(别名)
5、A (正向映射)
6、PTR(反向映射)
--------------------------------------------------------------------------------------------------------------
1.编辑配置文件
--------------------------------------------------------------------------------------------------
vim /etc/named.conf
定义默认的目录:
options {
};
定义根区域
zone "." IN {
};
定义本地区域
zone "localhost" IN {
};
定义本地反区域
zone "0.0.127.in-addr.arpa" IN {
};
定义自己的区域
zone "huwentao.com" IN {
};
定义自己的反区域
zone "192.168.192.in-addr.arpa." IN {
};
---------------------------------------------------------------------------------------------------------------
2.编辑自己的区域文件
------------------------------------------------------------------------------------------------------------
vim /var/named/named.huwentao
$TTL 600
huwentao.com.
IN
SOA
ns1.huwentao.com.
admin.huwentao.com
(
huwentao.com.
IN
NS
ns1.huwentao.com.
huwentao.com.
IN
MX
10
admin.huwentao.com.
ns1.huwentao.com.
IN
A
192.168.192.1
admin.huwentao.com. IN
A
192.168.192.2
www.huwentao.com.
IN
A
192.168.192.3
www.huwentao.com.
IN
A
192.168.192.4
ftp.huwentao.com.
IN
CNAME www.huwentao.com
------------------------------------------------------------------------------------------------------------
3.编辑反区域配置文件
------------------------------------------------------------------------------------------------------------
vim
/var/named/named.192.168.192.in-addr-arpa
@
IN
SOA
ns1.huwentao.com.
admin.huwentao.com (
1
IN
PTR
ns1.huwentao.com.
3
IN
PTR
www.huwentao.com.
4
IN
PTR
www.huwentao.com.
---------------------------------------------------------------------------------------------------------------
以上文件配置成功之后
启动服务
service named start
dig -t ns
huwentao.com
搭建小型的内网dns服务器成功。