【LIUNX】配置DNS
- A.安装bind bind-utils
- B.修改named.conf配置文件
- C.生成并修改uos.com.db 文件
- 1.复制模版文件named.localhost 到文件uos.com.db
- 2.修改uos.com.db文件
- D.重启named服务
- E.配置DNS服务器
- F.测试DNS服务器
A.安装bind bind-utils
yum -y install bind bind-utils
or
dnf install bind bind-utils -y
B.修改named.conf配置文件
vim /etc/named.con\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
options{
listen-on port 53 {192.168.122.1;};
directory"/var/named";
allow-query{any;};
};
zone "uos.com" IN {
type master;
file "uos.com.db";
};
zone "." IN {
type hint;
file "named.ca";
};
C.生成并修改uos.com.db 文件
1.复制模版文件named.localhost 到文件uos.com.db
cd /var/named
cp -p named.localhost uos.com.db
2.修改uos.com.db文件
vi uos.com.db
修改为
$TTL 1D
@ IN SOA ns.uos.com root.nos.uos.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns.uos.com.
ns IN A 192.168.122.1
www IN A 192.168.122.1
admin IN A 192.168.122.1
oa IN A 192.168.122.1
如图:
D.重启named服务
systemctl restart named
E.配置DNS服务器
vi /etc/resolv.conf
内容如下
nameserver 192.168.122.1
nameserver 114.114.114.114
F.测试DNS服务器
nslookup ns.uos.com server1
nslookup www.uos.com server1
nslookup oa.uos.com server1
nslookup admin.uos.com server1