1搭建DNS 主 从服务器。
1.1环境要求:
Centos 6.5 x86_64
1.2硬件配置:
名称
IP规划
cpu
内存
硬盘
主服务器
192.168.0.24
4核
8G
80G
从服务器
192.168.0.34
4核
8G
80G
1.3软件包安装:
[root@localhost ~]# yum install -y bind bind-chroot bind-utlis
1.4配置文件:
/etc/named.conf bind 服务主配置文件。
/var/named/ zone 文件。
1.5复制配置文件模板:
[root@localhost ~]# cp -rv /usr/share/doc/bind-9.8.2/sample/etc/* /var/named/chroot/etc/
[root@localhost ~]# cp -rv /usr/share/doc/bind-9.8.2/sample/var/*
1.6修改主配置文件:
[root@localhost ~]# vi /var/named/chroot/etc/named.conf
options
{
// Put files that named is allowed to write in the data/ directory:
directory "/var/named"; // "Working" directory
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
//listen-on port 53 { any; };
listen-on port 53 { any; };
//listen-on-v6 port 53 { any; };
listen-on-v6 port 53 { ::1; };
allow-query { any; };
allow-query-cache { any; };
forwarders { 10.0.0.1;114.114.114.114; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
};
zone "zabbix.73go.cn"{
type master;
file "zabbix.73go.cn.zone";
};
1.7修改zone 文件:
[root@localhost named]# cd /var/named/chroot/var/named
[root@localhost named]# cat zabbix.73go.cn.zone
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
IN A 192.168.0.236
1.8语法检查:
[root@localhost named]# named-checkconf /var/named/chroot/etc/named.conf
[root@localhost named]# named-checkzone linuxcast.net linuxcast.net.zone
1.9重启服务:
[root@localhost named]# service named reload
或
[root@localhost named]# service named restart
2从服务器配置:
2.1软件包安装:
[root@localhost ~]# yum install -y bind bind-chroot bind-utlis
2.2复制配置文件模板:
[root@localhost ~]# cp -rv /usr/share/doc/bind-9.8.2/sample/etc/* /var/named/chroot/etc/
2.3更改服务器从配置文件
[root@localhost etc]# vi /var/named/chroot/etc/named.conf
options
{
// Put files that named is allowed to write in the data/ directory:
directory "/var/named"; // "Working" directory
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
//listen-on port 53 { any; };
listen-on port 53 { any; };
//listen-on-v6 port 53 { any; };
listen-on-v6 port 53 { ::1; };
allow-query { any; };
allow-query-cache { any; };
forwarders { 10.0.0.1;114.114.114.114; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
};
zone "zabbix.73go.cn"{
type slave;
masters{ 192.168.0.24; };
file "slaves/zabbix.73go.cn.zone";
};
2.4重启服务:
[root@localhost named]# service named reload
或
[root@localhost named]# service named restart
2.5保证目录权限:
[root@localhost named]# ll
drwxrwxrwx. 2 named named 4096 7月 5 17:55 slaves
2.6查看同步zone 文件。
[root@localhost slaves]# cat /var/named/chroot/var/named/slaves
2.7验证:
C:\Users\admin>nslookup zabbix.73go.cn
服务器: UnKnown
Address: 192.168.0.24
名称: zabbix.73go.cn
Addresses: ::1
127.0.0.1
192.168.0.236