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.

转载于:https://www.cnblogs.com/mtnlydd/p/11519749.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值