安装DNS步骤:
1.挂载光盘并安装主程序和伪装包
mount /dev/cdrom /mnt
cd /mnt/Packages/
rpm -ivh bind-9.7.0-5.P2.el6.i686.rpm
rpm -ivh bind-chroot-9.7.0-5.P2.el6.i686.rpm
2.复制主配置文件和区域配置文件并改变所有者为named
cp -p /etc/named.conf /var/named/chroot/etc/
cp -p /var/named/named.empty /var/named/chroot/var/named/jiangwenhui.com.zone
cp -p /var/named/named.empty /var/named/chroot/var/named/192.168.100.zone
cp -p /var/named/named.* /var/named/chroot/var/named/
chown named /var/named/chroot/var/named/
3.修改主配置文件
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
forwarders { 8.8.8.8; };
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;
在最后一行前添加如下内容
forwarders { 8.8.8.8; };
zone "jiangwenhui.com" IN {
type master;
file "jiangwenhui.com.zone";
};
zone "100.168.192.in-addr.arpa" IN {
type master;
file "192.168.100.zone";
};
4.修改区域配置文件
cd /var/named/chroot/var/named
vim jiangwenhui.com.zone
$TTL 3H
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.jiangwenhui.com.
ns IN A 192.168.100.254
ftp IN A 192.168.100.254
www IN A 192.168.100.254
mail IN A 192.168.100.254
vim 192.168.100.zone
$TTL 3H
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.jiangwenhui.com.
254 IN PTR ns.jiangwenhui.com.
254 IN PTR ftp.jiangwenhui.com.
254 IN PTR www.jiangwenhui.com.
5.启动服务并关闭selinux和防火墙
service named start
setenforce 0
service iptables stop
二、构建主从DNS
规划好IP 主DNS192.168.1.111 从DNS192.168.1.112
1.修改主DNS配置文件
zone "jiangwenhui.com" IN {
type master;
file "jiangwenhui.com.zone";
allow-transfer { 192.168.100.25; };
};
zone "100.168.192.in-addr.arpa" IN {
type master;
file "192.168.100.zone";
allow-transfer { 192.168.100.25; };
};
2.在从DNS服务器上安装主程序和伪装包
同上安装过程
3.复制主配置文件
cp -p /etc/named.conf /var/named/chroot/etc/
4.修改从DNS的主配置文件
zone "winsnet.com" IN {
type slave;
file "slave/winsnet.com.zone";
masters { 192.168.1.111; };
};
zone "1.168.192.in-addr.arpa" IN {
type slave;
file "slave/192.168.1.zone";
masters { 192.168.1.111; };
};
5.在区域配置文件目录创建slave用于存储从DNS区域配置问价
cd /var/named/chroot/var/named
mkdir slave
cp -p /var/named/named.* /var/named/chroot/var/named
chown -R named /var/named/chroot/var/named
6.重启服务并查看slave目录是否同步成功区域配置文件
注意:在实验过程中要关闭防火墙和selinux