【linux】使用bind进行DNS配置

1, 设备及操作系统
a) DNS 服务器,虚拟机 centos 6.5 x64, 安装bind工具(使用yum install bind* 安装bind所需要的工具集包)IP:192.168.0.190
b) Win 7系统,用于检查。192.168.0.103
2, DNS 配置
a) vi /etc/named.conf

options {
listen-on port 53 { any; };
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; };
recursion yes;

dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;

/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";

managed-keys-directory "/var/named/dynamic";
};

logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};

zone "." IN {
type hint;
file "named.ca";
};

include "/etc/named.rfc1912.zones";
//配置文件信息
include "/etc/named.root.key";
注意红色部分。
b) 继续编辑zone文件
vi /etc/named.rfc1912.zones
//定义正向区域,规则文件kkk.com.zone
zone "kkk.com" IN{
type master;
notify yes;
file "kkk.com.zone";
allow-update{none;};
};

//定义反向区域,规则文件0.168.192.zone
zone "0.168.192.in-addr.arpa" IN{
type master;
notify yes;
file "0.168.192.zone";
allow-update {none;};
};
c) 编辑规则文件
vi /var/named/ kkk.com.zone
$TTL 86402
$ORIGIN kkk.com.
@ IN SOA ns1.kkk.com. root.kkk.com. (
42 ;serial
6H ;refresh
15M ;retry
1w ;expire
1D ) ;minimum
NS ns1.kkk.com.
A 192.168.0.190
ns1 A 192.168.0.190
Vi /var/name/ 0.168.192.zone
$TTL 86400
@ IN SOA ns1.kkk.com. root.kkk.com. (
192 ;serial
6H ;refresh
15M ;retry
1w ;expire
1D ) ;minimum
NS ns1.kkk.com.
190 PTR ns1.kkk.com.

以上全部完成后,使用named-checkconf /etc/named.conf和named-checkzone test.com /var/named/test.com.zone及named-checkzone 1.168.192.in-addr.arpa /var/namd/1.168.192.zone进行配置文件检查。
如无问题则使用“service named start”进行启动。
测试:
将win7系统DNS服务器填写为:192.168.0.190.
使用nslookup ns1.kkk.com进行访问测试:
C:\Users\xiaoleng>nslookup ns1.kkk.com
DNS request timed out.
timeout was 2 seconds.
服务器: UnKnown
Address: 192.168.0.190

DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** 请求 UnKnown 超时


继续部分:
在/var/named/ kkk.com.zone最后加入
www A 192.168.0.190
使用
C:\Users\xiaoleng>nslookup www.kkk.com
DNS request timed out.
timeout was 2 seconds.
服务器: UnKnown
Address: 192.168.0.190

DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** 请求 UnKnown 超时

至此一个简单的bind环境搭配完成,如果在大型局域网内。可以完成自定义网络及IP规划。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值