分类: LINUX
2015-10-22 13:27:14
服务端配置
一、 DNS主服务器端配置
操作系统:CentOS 6.5
IP地址:master:192.168.2.58 slave:192.168.2.49
DNS软件:Bind 9.8
测试域名:db.echat
作用:主要提供解析realhostip.com域名的服务
关闭防火墙
#service iptables stop
关闭selinux
#setenforce 0
#vi /etc/selinux/config
将#SELINUX=enforcing改为#SELINUX=disabled
1. 安装bind
# yum install bind
2. 修改/etc/named.conf配置文件
# vi /etc/named.conf
options {
listen-on port 53 { any; }; /*允许所有IP*/
listen-on-v6 port 53 { ::1; };
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 { 0.0.0.0/0; }; /*允许所有IP*/
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";
3. 修改/etc/named.rfc1912.zones文件,添加db.echat的正向区域
# vi /etc/ named.rfc1912.zones
//echattest.com 正向
zone "db.echat" IN{
type master;
file "db.echat.zone";
allow-update { none;};
allow-transfer {192.168.2.49;}; ##这一行表示允许10.167.27.91复制 notify yes;###开启通告,有更新就会通告给从服务器
also-notify{192.168.2.49;};
};
4. 创建正向区域资源文件
# cd /var/named
$TTL 30
@ IN SOA db.echat. root.db.echat. (
20151021 ; serial
60 ; refresh
10 ; retry
360000 ; expire
8400 ) ; minimum
@ IN NS db.echat.
@ IN A 192.168.2.44
二、Slave DNS的配置
1. 修改/etc/named.conf配置文件
# vi /etc/named.conf
内容同主DNS named.conf文件
2.修改/etc/named.rfc1912.zones
#vim /etc/named.rfc1912.zones 添加如下内容:
zone "db.echat" IN {
type slave;
file "slaves/db.echat.zone";
masters {192.168.2.58;}; #指定主服务器的地址
};
3. 启动主服务端named服务
#service named start
至此,DNS服务器端的配置已完成
注意:每更改一次配置文件就要更改serial的值,才能同步!
客户端配置
1.linux系统
修改/etc/resolv.conf,添加如下内容
nameserver 192.168.2.58
nameserver 192.168.2.49
2、windows环境
需要在本地连接属性里面修改