本文共 1620 字,大约阅读时间需要 5 分钟。
1.设置网络参数:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
1 2 3 4 5 6 7 8 9 10 | 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
1 2 | NETWORKING= yes HOSTNAME=ns.linunxyy.cn |
:wq
vi /etc/selinux/config
1 | SELINUX=disabled |
:wq
chkconfig NetworkManager off
chkconfig iptables off
chkconfig network on
vi /etc/hosts
1 | 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 ##修改如下,可以复制粘贴
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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 "." IN { type hint; file "named.ca" ; }; |
:wq
/etc/init.d/named restart
chkconfig named on
netstat -utpln |grep 53
4.测试:
windows/linux:
nslookup
server 192.168.10.95
www.baidu.com
www.sina.com
exit
查看查询日志:
less /var/named/chroot/var/named/data/named.run
本文转自信自己belive51CTO博客,原文链接:http://blog.51cto.com/11638205/2043893 ,如需转载请自行联系原作者