DNS服务器安装与配置(Linux)

1、yum install -y bind bind-utils bind-chroot bind-libs;
2、其中:/etc/named.conf 为主配置文件;/var/named 为解析文件
3、客户端的dns查询时的配置文件
/etc/hosts 默认优先查询这个
/etc/resolv.conf DNS写在这里面
/etc/nsswitch.conf 查询优先级的设在这里
4、vi /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; };

    /*
     - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
     - If you are building a RECURSIVE (caching) DNS server, you need to enable
       recursion.
     - If your recursive DNS server has a public IP address, you MUST enable access
       control to limit queries to your legitimate users. Failing to do so will
       cause your server to become part of large scale DNS amplification
       attacks. Implementing BCP38 within your network would greatly
       reduce such attack surface
    */
    recursion yes;

    dnssec-enable yes;
    dnssec-validation yes;

    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";

    managed-keys-directory "/var/named/dynamic";

    pid-file "/run/named/named.pid";
    session-keyfile "/run/named/session.key";

};

zone "." IN {
type hint;
file "named.ca";
};

zone "weixin.qq.com" IN {
type master;
file "named.weixin.qq.com";
};
zone "49.61.183.in-addr.arpa" IN{
type master;
file "named.183.61.49";
};
zone "140.215.14.in-addr.arpa" IN{
type master;
file "named.14.215.140";
};
zone "alipay.com" IN {
type master;
file "named.alipay.com";
};
zone "75.110.in-addr.arpa" IN{
type master;
file "named.110.75";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

5、vi /var/named/named.aplipay.com
$TTL 600
@ IN SOA dns.xmrbi.com. dns.xmrbi.com. (2018011901 3H 15M 1W 1D )
@ IN NS dns.xmrbi.com. ; DNS 服务器名称
dns.xmrbi.com. IN A 172.16.50.30 ; DNS 服务器 IP

openapi.alipay.com. IN A 110.75.244.202
mapi.alipay.com. IN A 110.75.231.40

6、vi /var/namd/named.110.75

$TTL 600
@ IN SOA dns.xmrbi.com. dns.xmrbi.com. (2018011901 3H 15M 1W 1D )
@ IN NS dns.xmrbi.com. ; DNS 服务器名称
dns.xmrbi.com. IN A 172.16.50.30 ; DNS 服务器 IP

244.202 IN PTR openapi.alipay.com.
231.40 IN PTR mapi.alipay.com.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1. 概述 在网络环境中一般用户只需要在浏览器中输入url如www.sunny.com就可以到对应服务器获取相应的...
    ghbsunny阅读 3,447评论 0 7
  • 一、BIND是什么 BIND是互联网应用最为广泛的DNS软件。 二、BIND的安装与使用 以下内容转自 http:...
    0_0啊阅读 3,352评论 0 0
  • DNS工作原理 DNS 查询的过程 DNS( Domain Name System)是“域名系统”的英文缩写,是一...
    ghbsunny阅读 9,279评论 0 0
  • 一、实现从根,com,rj.com 模拟互联网的DNS架构 DNS(Domain Name System,域名系统...
    ssjinyao阅读 1,625评论 0 7
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 2,996评论 0 0

友情链接更多精彩内容