第一步:
查询:
rpm -qa|grep bind
第二步:
安装:
第一种方式在线安装:yum -y install bind(必须连接互联网)
第二种方式通过光盘安装:
#mount /dev/sr0 /media
#cd /media
#ls
#cd Packages 安装包
#rpm -ivh bind
第三步:
配置:
vi /etc/named.conf
gedit /etc/named.conf
这里主要修改两行内容,①将第二行“listen-on port 53 { 127.0.0.1; };”中的“127.0.0.1”改为“any”,即“listen-on port 53 { any; };”。意思为监听所有的网络回路;②将第八行“allow-query { localhost; };”中的“localhost”改为“any”即“allow-query {any; };”。意思为允许所有的查询。
“named.conf”配置文件修改后内容如下:
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
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;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
第四步:
测试:
#nslookup

server 192.168.2.100(本机IP地址)
http://www.baidu.com/
Server: 172.20.10.1
Address: 172.20.10.1#53

Non-authoritative answer:
http://www.baidu.com/ canonical name = http://www.a.shifen.com/.
Name: http://www.a.shifen.com/
Address: 110.242.68.3
Name: http://www.a.shifen.com/
Address: 110.242.68.4
出现以上内容,测试成功。

Logo

华为云1024程序员节送福利,参与活动赢单人4000元礼包,更有热门技术干货免费学习

更多推荐