centos7配置YUM安装DNS服务
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7配置YUM安装DNS服务相关的知识,希望对你有一定的参考价值。
1、配置DNS地址
vim /etc/resolv.conf nameserver 192.168.1.100 #注:这里的地址是你DNS服务器本机的地址
2、安装dns服务
yum install bind bind-utils
3、启动服务
启动DNS服务:service named start 重启DNS服务:systemctl restart named.service 设置开机启动:systemctl enable named
4、编辑dns配置文件
vim /etc/named.conf options { listen-on port 53 { any; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { any;}; recursion yes; dnssec-enable yes; dnssec-validation yes; bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic"; pid-file "/run/named/named.pid"; session-keyfile "/run/named/session.key"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; };
zone "." IN { type hint; file "named.ca"; }; #新增demo.com域名 zone "demo.com" { type master; file "/var/named/demo.com"; }; #新增demo1.com域名 zone "demo1.com" { type master; file "/var/named/demo1.com"; }; #include "/etc/named.rfc1912.zones"; #include "/etc/named.root.key"; #zone "testdongy.com" { # type master; # file "/var/named/testdongy.com"; #};
#如上是我已经配置好的,复制即可
5、配置DNS域解析文件
vim /var/named/demo1.com $TTL 3H @ IN SOA @ demo1.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS @ A 127.0.0.1 AAAA ::1 a IN A 192.168.2.171 b IN A 192.168.2.172 www IN A 192.168.2.171 dev IN A 192.168.2.171
最后重启一下DNS服务器即可,客户机只需指定所配置的地址即可验证。
systemctl restart named.service
6、下面是我win7的DNS配置192.168.2.107
连接特定的 DNS 后缀: 描述: Realtek PCIe GBE Family Controller 物理地址: B0-83-FE-83-A4-4B 已启用 DHCP: 否 IPv4 地址: 192.168.2.102 IPv4 子网掩码: 255.255.255.0 IPv4 默认网关: 192.168.2.1 IPv4 DNS 服务器: 192.168.2.107, 223.5.5.5 IPv4 WINS 服务器: 已启用 NetBios over Tcpip: 是 连接-本地 IPv6 地址: fe80::d25:5b:dda3:f08d%11 IPv6 默认网关: IPv6 DNS 服务器:
7、开始验证
如下就是验证所得结果,好了,验证成功,服务完成了。
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>nslookup www.demo1.com 服务器: UnKnown Address: 192.168.2.107 名称: www.demo1.com Address: 192.168.2.171 C:\Users\Administrator>nslookup a.demo1.com 服务器: UnKnown Address: 192.168.2.107 名称: a.demo1.com Address: 192.168.2.171 C:\Users\Administrator>nslookup b.demo1.com 服务器: UnKnown Address: 192.168.2.107 名称: b.demo1.com Address: 192.168.2.172 linux服务器验证 [[email protected] ~]# nslookup a.demo.com Server: 192.168.2.104 Address: 192.168.2.104#53 Name: a.demo.com Address: 192.168.2.171 [[email protected] ~]# nslookup a.demo.com Server: 192.168.2.104 Address: 192.168.2.104#53 Name: a.demo.com Address: 192.168.2.171
本文出自 “屋檐下的思考” 博客,请务必保留此出处http://wuyanxxk.blog.51cto.com/4130666/1844021
以上是关于centos7配置YUM安装DNS服务的主要内容,如果未能解决你的问题,请参考以下文章