安装dns
yum install bind -y
修改配置文件
vi /etc/named.conf 下的
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
.
vi /etc/named.rfc1912.zones:Shift+g跳到最后一行 o 进行插入
zone "hello.com" IN { //正向解析
type master;
file "hello.zone";
};zone "80.168.192.in-addr.arpa" IN { //反向解析
type master;
file "hello.local";
};wq保存退出
.
cd /var/named
cp -p named.localhost hello.zone //正向解析模板
vi hello.zone
cp -p named.localhost hello.local //反向解析模板
.
检查主配置文件语法是否有错误:
named-checkconf
systemctl start named 启动
测试DNS服务
yum install bind-utils -y //安装测试nslookup命令
vi /etc/sysconfig/network-scripts/ifcfg-ens32
本机
保存退出
重启网卡
systemctl restart network
使用nslookup查看正反向解析