CENTOS7安装BIND来解释域名

2022/1/24 22:15:48      点击:
yum -y install bind bind-utils
vi /etc/named.conf
注释小IPV6监听的部分,仅仅监听IPV4地址
##listen-on-v6 port 53 { ::1; };

systemctl restart named.service

腾讯云的resolv.conf是有/usr/sbin/dhclient-script来控制的找到下面的内容,添加红色的部分,首选DNS设置为127.0.0.1
        if [ -n "${new_domain_name_servers}" ]; then
        echo "nameserver 127.0.0.1" >> ${rscf}
            for nameserver in ${new_domain_name_servers} ; do
                echo "nameserver ${nameserver}" >> "${rscf}"
            done
然后重启网卡 service network restart最终效果如下:
; generated by /usr/sbin/dhclient-script
nameserver 127.0.0.1
nameserver 183.60.83.19
nameserver 183.60.82.98