基于Centos7.2的DNS服务器搭建

基于Centos7.2的DNS服务器搭建

 sg_trans.gif(2018-05-21 23:17:19)
sg_trans.gif转载
标签: 

it

分类: Linux

1.关闭防火墙以及SeLinux.

防火墙相关设置:

systemctl stop firewalld  //临时关闭防火墙

systemctl disable firewalld  //禁止开机启动防火墙

selinux相关设置:

SeLinux配置文件,/etc/selinux/config

设置 SELINUX=disabled

 

2.安装相应的软件包

yum -y install bind

yum -y install bind-utils  //bind-utils提供DNS查询工具,如dig、host、nslookup

安装完后,检测有没有安装

[root@localhost ~]# rpm -qa | grep bind

rpcbind-0.2.0-42.el7.x86_64

bind-libs-9.9.4-61.el7.x86_64

bind-libs-lite-9.9.4-61.el7.x86_64

bind-license-9.9.4-61.el7.noarch

bind-9.9.4-61.el7.x86_64

 

bind-utils-9.9.4-61.el7.x86_64    //确保以上操作都没有错误进行下一步

3.修改配置文件

配置文件路径: /etc/named.conf       

示例配置文件:

//

// named.conf

//

// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS

// server as a caching only nameserver (as a localhost DNS resolver only).

//

// See /usr/share/doc/bind*/sample/ for example named configuration files.

//

// See the BIND Administrator's Reference Manual (ARM) for details about the

// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html

options {

directory "/var/named";

dump-file "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

};

 

zone "com" {

type master;

file "com";

};

 

zone "111.168.192.in-addr.arpa" {

type master;

file "111.168.192";

};

 

拷贝示例配置文件到tmp文件夹下

cp /usr/share/doc/bind-9.9.4/sample/etc/named.conf  /tmp         //红色的版本信息跟自己的相对应

 

4.重启服务

systemctl restart named

systemctl enable named   //开机启动DNS服务

客户端:

切换到NAT模式下:

yum -y install bind-utils

切换到OnlyHost模式下:

配置文件 :/etc/resolv.conf

添加如下:

 

nameserver 192.168.111.130(DNS IP地址)

5.正向解析文件配置实例:路径:/var/named/com

$TTL 86400

com. IN SOA dns.com. root.com (

20180511 ; serial

1H ; refresh

15M ; retry

1W ; expire

1D ) ; minimum

com. IN NS dns.com.

dns         IN A 192.168.111.130

linttle IN A 192.168.111.131

hello IN A 192.168.111.132

 

haha IN A 192.168.111.133

6.反向解析文实例:  路径:/var/named/111.168.192

$TTL 86400

@ IN SOA 111.168.192.in-addr.arpa. root.com (

20180511 ; serial

1H ; refresh

15M ; retry

1W ; expire

1D ) ; minimum

@ IN NS dns.com.

130 IN PTR dns.com.

131 IN PTR linttle.com.

132 IN PTR hello.com.

 

133 IN PTR haha.com.

7.测试
基于Centos7.2的DNS服务器搭建
分别能够正向和反向解析成功代表DNS服务器搭建成功。

转载于:https://my.oschina.net/u/3367404/blog/3007528

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值