一、安装bind:
yum -y install bind bind-devel bind-utils bind-libbind-devel caching-nameserver
二、配置bind:
cp /etc/named.rfc1912.zones /etc/named.conf
chown root:named /etc/named.conf
修改主配置文件如下:
zone "." {
type hint;
file "named.local";
};
options{
directory "/var/named";
pid-file "/var/run/named/named.pid";
listen-on {192.16.1.100;};
listen-on {127.0.0.1;};
tcp-clients 3500;
recursion no;
version "None";
allow-transfer { none; };
};
logging {
channel query_log {
file "/var/named/logs/named.log" versions 3 size 20m;
severity info;
print-time yes;
print-category yes;
print-severity yes;
};
category queries {
query_log;
};
};
zone "baidu.net" IN { =========>区域文件
type master;
file "/var/named/zone/baidu.net.zone";
allow-update { none; };
};
cd /var/named/
dig > named.root(需要上网才行)
vim /var/named/zone/baidu.net.zone
$ttl 600
eqifa.net. IN SOA ns.baidu.net. root.baidu.net. (
1077273781
1080
3600
604800
600 )
baidu.net. IN NS ns.baidu.net.
www1 IN A 192.168.1.101
www2 IN A 192.168.1.102
chown root:named -R /var/named
启动服务
service named start
rndc reload 重新加载主配置文件和区域文件