DNS基本实验服务搭建
Posted mtnlydd
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DNS基本实验服务搭建相关的知识,希望对你有一定的参考价值。
Web Server
[root@localhost ~]# yum -y install httpd
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# vim index.html
DNS Server
1.软件安装
[root@localhost ~]# yum -y install bind
2.配置主配置文件
[root@localhost ~]# vim /etc/named.conf
options
listen-on port 53 any; ;
listen-on-v6 port 53 any; ;
allow-query any; ;
;
生产环境一般只监听内网或者只监听外网
3.配置区域文件(先对区域文件进行备份,删除多余的模板,只留下一个正向和一个反向(反向修改时,网络位的反写格式,如192.168.100.2->100.168.192.))
[root@localhost ~]# vim /etc/named.rfc1912.zones
生产环境主要使用正向解析
zone "zhangjie.com" IN
type master;
file "zhangjie.localhost";
allow-update none; ;
;
zone "43.168.192.in-addr.arpa" IN
type master;
file "zhangjie.loopback";
allow-update none; ;
;
4.配置数据文件
A.先复制生成正向解析文件和反向解析文件
[root@localhost ~]# cd /var/named/
[root@localhost named]# cp -a named.localhost zhangjie.localhost
[root@localhost named]# cp -a named.loopback zhangjie.loopback
B.编辑正向解析文件(注意域名结尾的’’.”)
[root@localhost named]# vim zhangjie.localhost
$TTL 1D
@ IN SOA zhangjie.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.zhangjie.com.
dns A 192.168.43.99
www A 192.168.43.98
C.编辑反向解析文件(注意域名结尾的”.”)
[root@localhost named]# vim zhangjie.loopback
$TTL 1D
@ IN SOA zhangjie.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.zhangjie.com.
99 PTR dns.zhangjie.com.
98 PTR www.zhangjie.com.
5.重启DNS服务
[root@localhost named]# service named start
[root@localhost named]# netstat -tlun
6.客户端测试:在网卡配置文件中添加DNS服务器的地址,然后用nslookup测试
Client
[root@localhost ~]# curl 192.168.43.98
[root@localhost ~]# curl www.zhangjie.com
[root@localhost ~]# nslookup www.zhangjie.com
Server: 192.168.43.99
Address: 192.168.43.99#53
Name: www.zhangjie.com
Address: 192.168.43.98
[root@localhost ~]# nslookup 192.168.43.99
Server: 192.168.43.99
Address: 192.168.43.99#53
99.43.168.192.in-addr.arpa name = dns.zhangjie.com.
以上是关于DNS基本实验服务搭建的主要内容,如果未能解决你的问题,请参考以下文章
搭建DNS主从服务器实现反向解析,子域,转发,智能DNS及排错和互联网DNS架构实验