在Vmware安装rhel10镜像后,要求输入域名能解析出IP地址,输入IP地址后能解析出域名。
步骤:
一、安装DNS服务
1.将“已连接”前方框打钩
2.依次输入命令
-
mkdir /mnt/iso
-
mount /dev/cdrom /mnt/iso
-
touch /etc/yum.repos.d/dvd.repo
-
vim /etc/yum.repos.d/dvd.repo后编辑以下内容
[dvd]
name=dvd
baseurl=file:///mnt/iso
gpgcheck=0
enabled=1保存后退出(:wq!)
-
yum repolist
-
yum install bind -y
提示bind安装成功(即DNS服务安装成功)
二、设置IP地址
vim /etc/sysconfig/network-scripts/ifcfg-en16777736
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.3.100
PREFIX=24
sysremctl restart network
ifconfig 确认IP地址是否修改成功
三、修改主配置文件/etc/named.conf
vim /etc/named.conf
listen-on port 53 {any:}; (此行为修改)
allow-query {any:}; (此行为修改)
dnssec-enable no; (此行为修改)
dnssec-validation no; (此行为修改)
(下面8行均为新增内容)
zone “JQE.com”{
type master;
file “JQE.com.zone”;
}:
zone “3.168.192.in-addr.arpa”{
type master;
file “3.168.192.in-addr.arpa.zone”;
};
四、新建正向和反向区域文件
-
cp -p /var/named/named.localhost /var/named/JQE.com.zone
-
cp -p /var/named/named.loopback /var/named/3.168.192.in- addr.arpa.zone
-
vim /var/named/JQE.com.zone
@ NS JQE.com. (此行为修改)
www A 192.168.3.100 (最后面加上这一行)
vim var/named/3.168.192.in-addr.arpa.zone
@ NS JQE.com. (此行为修改)
100 PTR www.JQE.com. (最后面加上这一行)
五、改所属组为named
chgrp named /etc/named.conf
chgrp named /var/named/JQE.com.zone
chgrp named /var/named/3.168.192.in-addr.arpa.zone
六、关闭防火墙
systemctl stop firewalld
七、重启服务器
system restart named
八、验证
-
nslookup www.JQE.com
-
nslookup 192.168.3.100
原创文章,作者:速盾高防cdn,如若转载,请注明出处:https://www.sudun.com/ask/76746.html