DNS服务——服务端 和 客户端 配置

Posted kelamoyujuzhen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DNS服务——服务端 和 客户端 配置相关的知识,希望对你有一定的参考价值。

参考:Linux下DNS主从服务器搭建详解 

前言

电脑经常会出现一些网络小毛病。有的时候,QQ能正常上网,但是网页却打不开。这种时候十有八九是DNS出问题了。

QQ在DNS不可用的时候,可以跳过DNS解析,直接访问对方IP

实验环境

rhel-server-6.4-x86_64-dvd(ED2000.COM).iso最小化安装

常用公网DNS服务器

8.8.8.8

222.222.222.222

202.99.168.8

202.99.160.68

配置DNS服务器

设置本地yum源

搭建KVM环境——03 创建虚拟机后配置环境

安装bind

域名系统 (Domain Name System, DNS)一种因特网的通讯协议名称,提供这种服务的软件有很多,比如(Berkeley Internet Name Domain, BIND)。

[root@ziqiang ~]# yum list | grep bind
PackageKit-device-rebind.x86_64        0.5.8-21.el6                         vcd 
bind.x86_64                            32:9.8.2-0.17.rc1.el6                vcd 
bind-chroot.x86_64                     32:9.8.2-0.17.rc1.el6                vcd 
bind-dyndb-ldap.x86_64                 2.3-2.el6                            vcd 
bind-libs.i686                         32:9.8.2-0.17.rc1.el6                vcd 
bind-libs.x86_64                       32:9.8.2-0.17.rc1.el6                vcd 
bind-utils.x86_64                      32:9.8.2-0.17.rc1.el6                vcd 
rpcbind.x86_64                         0.2.0-11.el6                         vcd 
samba-winbind.x86_64                   3.6.9-151.el6                        vcd 
samba-winbind-clients.i686             3.6.9-151.el6                        vcd 
samba-winbind-clients.x86_64           3.6.9-151.el6                        vcd 
samba4-winbind.x86_64                  4.0.0-55.el6.rc4                     vcd 
samba4-winbind-clients.x86_64          4.0.0-55.el6.rc4                     vcd 
samba4-winbind-krb5-locator.x86_64     4.0.0-55.el6.rc4                     vcd 
ypbind.x86_64                          3:1.20.4-30.el6                      vcd 
[root@ziqiang ~]# yum -y install bind
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.8.2-0.17.rc1.el6 will be installed
--> Processing Dependency: bind-libs = 32:9.8.2-0.17.rc1.el6 for package: 32:bind-9.8.2-0.17.rc1.el6.x86_64
--> Processing Dependency: liblwres.so.80()(64bit) for package: 32:bind-9.8.2-0.17.rc1.el6.x86_64
--> Processing Dependency: libisccfg.so.82()(64bit) for package: 32:bind-9.8.2-0.17.rc1.el6.x86_64
--> Processing Dependency: libisccc.so.80()(64bit) for package: 32:bind-9.8.2-0.17.rc1.el6.x86_64
--> Processing Dependency: libisc.so.83()(64bit) for package: 32:bind-9.8.2-0.17.rc1.el6.x86_64
--> Processing Dependency: libdns.so.81()(64bit) for package: 32:bind-9.8.2-0.17.rc1.el6.x86_64
--> Processing Dependency: libbind9.so.80()(64bit) for package: 32:bind-9.8.2-0.17.rc1.el6.x86_64
--> Running transaction check
---> Package bind-libs.x86_64 32:9.8.2-0.17.rc1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================
 Package                       Arch                       Version                                    Repository               Size
===================================================================================================================================
Installing:
 bind                          x86_64                     32:9.8.2-0.17.rc1.el6                      vcd                     4.0 M
Installing for dependencies:
 bind-libs                     x86_64                     32:9.8.2-0.17.rc1.el6                      vcd                     871 k

Transaction Summary
===================================================================================================================================
Install       2 Package(s)

Total download size: 4.8 M
Installed size: 9.4 M
Downloading Packages:
-----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                               69 MB/s | 4.8 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-libs-9.8.2-0.17.rc1.el6.x86_64                                                                          1/2 
  Installing : 32:bind-9.8.2-0.17.rc1.el6.x86_64                                                                               2/2 
  Verifying  : 32:bind-9.8.2-0.17.rc1.el6.x86_64                                                                               1/2 
  Verifying  : 32:bind-libs-9.8.2-0.17.rc1.el6.x86_64                                                                          2/2 

Installed:
  bind.x86_64 32:9.8.2-0.17.rc1.el6                                                                                                

Dependency Installed:
  bind-libs.x86_64 32:9.8.2-0.17.rc1.el6                                                                                           

Complete!
View Code

查看安装完毕后的DNS服务

[root@ziqiang ~]# chkconfig 
auditd             0:off    1:off    2:on    3:on    4:on    5:on    6:off
crond              0:off    1:off    2:on    3:on    4:on    5:on    6:off
dhcpd              0:off    1:off    2:off    3:off    4:off    5:off    6:off
dhcpd6             0:off    1:off    2:off    3:off    4:off    5:off    6:off
dhcrelay           0:off    1:off    2:off    3:off    4:off    5:off    6:off
ip6tables          0:off    1:off    2:on    3:on    4:on    5:on    6:off
iptables           0:off    1:off    2:on    3:on    4:on    5:on    6:off
named              0:off    1:off    2:off    3:off    4:off    5:off    6:off
netconsole         0:off    1:off    2:off    3:off    4:off    5:off    6:off
netfs              0:off    1:off    2:off    3:on    4:on    5:on    6:off
network            0:off    1:off    2:on    3:on    4:on    5:on    6:off
portreserve        0:off    1:off    2:on    3:on    4:on    5:on    6:off
postfix            0:off    1:off    2:on    3:on    4:on    5:on    6:off
rdisc              0:off    1:off    2:off    3:off    4:off    5:off    6:off
restorecond        0:off    1:off    2:off    3:off    4:off    5:off    6:off
rhnsd              0:off    1:off    2:on    3:on    4:on    5:on    6:off
rhsmcertd          0:off    1:off    2:off    3:on    4:on    5:on    6:off
rsyslog            0:off    1:off    2:on    3:on    4:on    5:on    6:off
saslauthd          0:off    1:off    2:off    3:off    4:off    5:off    6:off
sshd               0:off    1:off    2:on    3:on    4:on    5:on    6:off
udev-post          0:off    1:on    2:on    3:on    4:on    5:on    6:off
View Code

刚刚安装的服务叫named,显示是关闭状态,接下来开启该服务

[root@ziqiang ~]# chkconfig named on
[root@ziqiang ~]# chkconfig 
auditd             0:off    1:off    2:on    3:on    4:on    5:on    6:off
crond              0:off    1:off    2:on    3:on    4:on    5:on    6:off
dhcpd              0:off    1:off    2:off    3:off    4:off    5:off    6:off
dhcpd6             0:off    1:off    2:off    3:off    4:off    5:off    6:off
dhcrelay           0:off    1:off    2:off    3:off    4:off    5:off    6:off
ip6tables          0:off    1:off    2:on    3:on    4:on    5:on    6:off
iptables           0:off    1:off    2:on    3:on    4:on    5:on    6:off
named              0:off    1:off    2:on    3:on    4:on    5:on    6:off
netconsole         0:off    1:off    2:off    3:off    4:off    5:off    6:off
netfs              0:off    1:off    2:off    3:on    4:on    5:on    6:off
network            0:off    1:off    2:on    3:on    4:on    5:on    6:off
portreserve        0:off    1:off    2:on    3:on    4:on    5:on    6:off
postfix            0:off    1:off    2:on    3:on    4:on    5:on    6:off
rdisc              0:off    1:off    2:off    3:off    4:off    5:off    6:off
restorecond        0:off    1:off    2:off    3:off    4:off    5:off    6:off
rhnsd              0:off    1:off    2:on    3:on    4:on    5:on    6:off
rhsmcertd          0:off    1:off    2:off    3:on    4:on    5:on    6:off
rsyslog            0:off    1:off    2:on    3:on    4:on    5:on    6:off
saslauthd          0:off    1:off    2:off    3:off    4:off    5:off    6:off
sshd               0:off    1:off    2:on    3:on    4:on    5:on    6:off
udev-post          0:off    1:on    2:on    3:on    4:on    5:on    6:off
[root@ziqiang ~]# runlevel
N 3
View Code

查看配置文件

bind安装完毕后所有配置文件(包含可执行文件)

[root@ziqiang ~]# rpm -lq bind
/etc/NetworkManager/dispatcher.d/13-named
/etc/logrotate.d/named
/etc/named
/etc/named.conf
/etc/named.iscdlv.key
/etc/named.rfc1912.zones
/etc/named.root.key
/etc/portreserve/named
/etc/rc.d/init.d/named
/etc/rndc.conf
/etc/rndc.key
/etc/sysconfig/named
/usr/lib64/bind
/usr/sbin/arpaname
/usr/sbin/ddns-confgen
/usr/sbin/dnssec-dsfromkey
/usr/sbin/dnssec-keyfromlabel
/usr/sbin/dnssec-keygen
/usr/sbin/dnssec-revoke
/usr/sbin/dnssec-settime
/usr/sbin/dnssec-signzone
/usr/sbin/genrandom
/usr/sbin/isc-hmac-fixup
/usr/sbin/lwresd
/usr/sbin/named
/usr/sbin/named-checkconf
/usr/sbin/named-checkzone
/usr/sbin/named-compilezone
/usr/sbin/named-journalprint
/usr/sbin/nsec3hash
/usr/sbin/rndc
/usr/sbin/rndc-confgen
/usr/share/doc/bind-9.8.2
/usr/share/doc/bind-9.8.2/CHANGES
/usr/share/doc/bind-9.8.2/COPYRIGHT
/usr/share/doc/bind-9.8.2/Copyright
/usr/share/doc/bind-9.8.2/README
/usr/share/doc/bind-9.8.2/arm
/usr/share/doc/bind-9.8.2/arm/Bv9ARM-book.xml
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch01.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch02.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch03.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch04.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch05.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch06.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch07.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch08.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch09.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.ch10.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.html
/usr/share/doc/bind-9.8.2/arm/Bv9ARM.pdf
/usr/share/doc/bind-9.8.2/arm/Makefile
/usr/share/doc/bind-9.8.2/arm/Makefile.in
/usr/share/doc/bind-9.8.2/arm/README-SGML
/usr/share/doc/bind-9.8.2/arm/dnssec.xml
/usr/share/doc/bind-9.8.2/arm/isc-logo.eps
/usr/share/doc/bind-9.8.2/arm/isc-logo.pdf
/usr/share/doc/bind-9.8.2/arm/latex-fixup.pl
/usr/share/doc/bind-9.8.2/arm/libdns.xml
/usr/share/doc/bind-9.8.2/arm/man.arpaname.html
/usr/share/doc/bind-9.8.2/arm/man.ddns-confgen.html
/usr/share/doc/bind-9.8.2/arm/man.dig.html
/usr/share/doc/bind-9.8.2/arm/man.dnssec-dsfromkey.html
/usr/share/doc/bind-9.8.2/arm/man.dnssec-keyfromlabel.html
/usr/share/doc/bind-9.8.2/arm/man.dnssec-keygen.html
/usr/share/doc/bind-9.8.2/arm/man.dnssec-revoke.html
/usr/share/doc/bind-9.8.2/arm/man.dnssec-settime.html
/usr/share/doc/bind-9.8.2/arm/man.dnssec-signzone.html
/usr/share/doc/bind-9.8.2/arm/man.genrandom.html
/usr/share/doc/bind-9.8.2/arm/man.host.html
/usr/share/doc/bind-9.8.2/arm/man.isc-hmac-fixup.html
/usr/share/doc/bind-9.8.2/arm/man.named-checkconf.html
/usr/share/doc/bind-9.8.2/arm/man.named-checkzone.html
/usr/share/doc/bind-9.8.2/arm/man.named-journalprint.html
/usr/share/doc/bind-9.8.2/arm/man.named.html
/usr/share/doc/bind-9.8.2/arm/man.nsec3hash.html
/usr/share/doc/bind-9.8.2/arm/man.nsupdate.html
/usr/share/doc/bind-9.8.2/arm/man.rndc-confgen.html
/usr/share/doc/bind-9.8.2/arm/man.rndc.conf.html
/usr/share/doc/bind-9.8.2/arm/man.rndc.html
/usr/share/doc/bind-9.8.2/arm/managed-keys.xml
/usr/share/doc/bind-9.8.2/arm/pkcs11.xml
/usr/share/doc/bind-9.8.2/draft
/usr/share/doc/bind-9.8.2/draft/draft-faltstrom-uri-06.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-6man-text-addr-representation-07.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-behave-address-format-07.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-behave-dns64-11.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-axfr-clarify-14.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-dns-tcp-requirements-03.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-dnssec-bis-updates-12.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-dnssec-registry-fixes-06.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-ecc-key-07.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-interop3597-02.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-rfc2671bis-edns0-05.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-rfc2672bis-dname-19.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-rfc3597-bis-02.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsext-tsig-md5-deprecated-03.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsop-bad-dns-res-05.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsop-dnssec-key-timing-02.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsop-dnssec-trust-history-01.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsop-inaddr-required-07.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsop-name-server-management-reqs-02.txt
/usr/share/doc/bind-9.8.2/draft/draft-ietf-dnsop-respsize-06.txt
/usr/share/doc/bind-9.8.2/draft/draft-kato-dnsop-local-zones-00.txt
/usr/share/doc/bind-9.8.2/draft/draft-kerr-ixfr-only-01.txt
/usr/share/doc/bind-9.8.2/draft/draft-mekking-dnsop-auto-cpsync-00.txt
/usr/share/doc/bind-9.8.2/draft/draft-yao-dnsext-bname-04.txt
/usr/share/doc/bind-9.8.2/draft/update
/usr/share/doc/bind-9.8.2/misc
/usr/share/doc/bind-9.8.2/misc/Makefile
/usr/share/doc/bind-9.8.2/misc/Makefile.in
/usr/share/doc/bind-9.8.2/misc/dnssec
/usr/share/doc/bind-9.8.2/misc/format-options.pl
/usr/share/doc/bind-9.8.2/misc/ipv6
/usr/share/doc/bind-9.8.2/misc/migration
/usr/share/doc/bind-9.8.2/misc/migration-4to9
/usr/share/doc/bind-9.8.2/misc/options
/usr/share/doc/bind-9.8.2/misc/rfc-compliance
/usr/share/doc/bind-9.8.2/misc/roadmap
/usr/share/doc/bind-9.8.2/misc/sdb
/usr/share/doc/bind-9.8.2/misc/sort-options.pl
/usr/share/doc/bind-9.8.2/named.conf.default
/usr/share/doc/bind-9.8.2/rfc
/usr/share/doc/bind-9.8.2/rfc/index.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1032.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1033.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1034.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1035.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1101.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1122.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1123.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1183.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1348.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1535.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1536.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1537.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1591.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1611.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1612.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1706.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1712.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1750.txt.gz
/usr/share/doc/bind-9.8.2/rfc/rfc1876.txt.gz
/usr/share/doc/bind-以上是关于DNS服务——服务端 和 客户端 配置的主要内容,如果未能解决你的问题,请参考以下文章

DNS服务之DNS正反向解析

DNS服务器搭建

DNS服务器搭建

Linux DNS服务器搭建和DNS 客户端配置

Linux之DNS服务

eureka集群基于DNS配置方式