1.更换清华源镜像
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
yum makecache
2.yum安装bind9
yum install bind*
3.修改配置文件
/etc/named.conf
//在options内修改如下
listen-on port 53 { 192.168.x.x; }; //修改ip为本机ip 非环回地址
// listen-on-v6 port 53 { ::1; }; 注释掉ipv6
//添加转发dns优先
forward first;
forwarders {61.139.2.69;119.6.6.6;};
//在logging添加日志如下
logging {
channel default_debug {
file "data/named.run" versions 2000 size 50M; //2000个文件 每个50M
severity info;
print-category yes;
print-time yes;
buffered yes;
};
category queries { //将查询信息计入日志
default_debug;
};
};
4.设置开机启动
systemctl start named
systemctl enable named
标签:centos,CentOS,basearch,infra,mirrorlist,releasever,DNS,bind9 From: https://www.cnblogs.com/dxdxh/p/17197429.html