linux 搭建 DNS 主从同步
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 port53{any;};
//listen-on-v6 port 53 { any; };
listen-on-v6 port53{::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
$TTL1D
@IN [email protected].(
0;serial
1D;refresh
1H;retry
1W;expire
3H);minimum
NS@
A127.0.0.1
AAAA::1
IN A192.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 port53{any;};
//listen-on-v6 port 53 { any; };
listen-on-v6 port53{::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.cnAddresses:::1
127.0.0.1
192.168.0.236
来源: http://www.bubuko.com/infodetail-2478914.html