标签:配置bind主域名服务器
1.设置网络参数:vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0" HWADDR="00:0C:29:68:b1:0f" NM_CONTROLLED="no" ONBOOT="yes" BOOTPROTO=static IPADDR=192.168.10.95 NETMASK=255.255.255.0 GATEWAY=192.168.10.1 DNS1=202.106.0.20 DNS2=192.168.10.95
:wq
vi /etc/sysconfig/network
NETWORKING=yes HOSTNAME=ns.linunxyy.cn
:wq
vi /etc/selinux/config
SELINUX=disabled
:wq
chkconfig NetworkManager off
chkconfig iptables off
chkconfig network on
vi /etc/hosts
192.168.10.95 ns ns.linuxyy.cn
:wq
reboot
2.安装bind软件:
vi /etc/yum.repos.d/rhel.repo
[local] name=local baseurl=file:///mnt/ enabled=1 gpgcheck=0
:wq
mount /dev/cdrom /mnt
yum -y install bind-*
rpm -qa |grep bind
rpm -ql bind
rpm -ql bind-utils
3.修改配置文件:
cd /var/named/chroot/etc/
cp /usr/share/doc/bind-9.7.3/sample/etc/named.conf ./
vi named.conf ##修改如下,可以复制粘贴
options { 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 { 192.168.10.95; }; query-source port 53; allow-query { 192.168.10.0/24; }; recursion yes; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "linuxyy.cn." IN { type master; file "linuxyy.cn.zone"; }; zone "10.168.192.in-addr.arpa" IN { type master; file "192.168.10.arpa"; };
:wq
[root@ns etc]# named-checkconf named.conf ##测试主配置文件是否有错误
cd /var/named/chroot/var/named/
vim linuxyy.cn.zone
$TTL 86400 @ IN SOA linuxyy.cn. root.linuxyy.cn. ( 20171111 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum IN NS ns.linuxyy.cn. ns IN A 192.168.10.95 IN A 192.168.10.95 IN MX 10 mail.linuxyy.cn. mail IN A 192.168.10.95 www IN A 192.168.10.96 ftp IN CNAME www
:wq
vim 192.168.10.arpa
$TTL 86400
@ IN SOA linuxfan.cn. root.linuxyy.cn. ( 20171111 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS ns.linuxyy.cn. 95 IN PTR ns.linuxyy.cn. 95 IN PTR mail.linuxyy.cn. 96 IN PTR www.linuxyy.cn. 96 IN PTR ftp.linuxyy.cn.
:wq
[root@ns named]# named-checkzone linuxyy.cn.zone 192.168.10.arpa ##测试区域数据库配置文件
chown named:named linuxyy.cn.zone 192.168.10.arpa ../../etc/named.conf ##设置权限,确保named用户有读取的权限
/etc/init.d/named restart
chkconfig named on
netstat -utpln |grep 53
4.测试:
windows/linux:
nslookup
server 192.168.10.95
mail.linuxyy.cn
www.linuxyy.cn
192.168.10.96
exit
标签:配置bind主域名服务器
原文地址:http://blog.51cto.com/11638205/2043891