Centos7 DNS神奇的配置

 

文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
[root@iff etc]# cat /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// See the BIND Administrator's Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html
 
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";
};
 
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
 
zone "." IN {
        type hint;
        file "named.ca";
};
 
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
 
[root@iff etc]#

  

文件

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[root@iff etc]# cat /etc/named.rfc1912.zones
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
 
zone "localhost.localdomain" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};
 
zone "localhost" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};
 
zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.loopback";
        allow-update { none; };
};
 
zone "1.0.0.127.in-addr.arpa" IN {
        type master;
        file "named.loopback";
        allow-update { none; };
};
 
zone "0.in-addr.arpa" IN {
        type master;
        file "named.empty";
        allow-update { none; };
};
zone "179.108.30.129.in-addr.arpa" IN {
        type master;
        file "179.108.30.129.zone";
        allow-update { none; };
};
 
zone "iff.csttires.com.cn" IN {
        type master;
        file "iff.csttires.com.cn.zone";
        allow-update { none; };
};
zone "iff-web.csttires.com.cn" IN {
        type master;
        file "iff-web.csttires.com.cn.zone";
        allow-update { none; };
};
 
[root@iff etc]#

  

文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@iff etc]# cat /var/named/iff.csttires.com.cn.zone
$TTL 1D
@       IN SOA  iff.csttires.com.cn root (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1
 
    IN  A       129.30.108.179
[root@iff etc]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@iff named]# cat iff-web.csttires.com.cn.zone
$TTL 1D
@       IN SOA  iff-web.csttires.com.cn root (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1
 
    IN  A       129.30.108.179
[root@iff named]#

  

文件

1
2
3
4
5
6
7
8
9
10
[root@iff etc]# cat /var/named/179.108.30.129.zone
$TTL 600
@      IN  SOA @ iff.csttires.com.cn. (
                                        0       ; serial
                                        28800      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
          NS     iff.csttires.com.cn.
     IN   PTR   iff.csttires.com.cn.     IN   PTR   iff-web.csttires.com.cn.[root@iff etc]#

  

测试成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@iff etc]# nslookup
> iff.csttires.com.cn
Server:         129.30.108.179
Address:        129.30.108.179#53
 
Name:   iff.csttires.com.cn
Address: 127.0.0.1
Name:   iff.csttires.com.cn
Address: 129.30.108.179> iff-web.csttires.com.cn
Server:         129.30.108.179
Address:        129.30.108.179#53
 
Name:   iff-web.csttires.com.cn
Address: 127.0.0.1
Name:   iff-web.csttires.com.cn
Address: 129.30.108.179<br>
[root@iff etc]# nslookup
> 129.30.108.179
Server:         129.30.108.179
Address:        129.30.108.179#53
 
179.108.30.129.in-addr.arpa     name = iff.csttires.com.cn.179.108.30.129.in-addr.arpa     name = iff-web.csttires.com.cn.>

 常用命令:

1
2
3
4
yum -y install bind<br>rndc flush #清空DNS缓存
systemctl restart named
nslookup
host 129.30.108.179 #查看反向解析<br><br>

  

 

posted @   amoyzhu  阅读(808)  评论(0编辑  收藏  举报
编辑推荐:
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
· 现代计算机视觉入门之:什么是图片特征编码
· .NET 9 new features-C#13新的锁类型和语义
阅读排行:
· 手把手教你在本地部署DeepSeek R1,搭建web-ui ,建议收藏!
· Spring AI + Ollama 实现 deepseek-r1 的API服务和调用
· 数据库服务器 SQL Server 版本升级公告
· C#/.NET/.NET Core技术前沿周刊 | 第 23 期(2025年1.20-1.26)
· 程序员常用高效实用工具推荐,办公效率提升利器!
点击右上角即可分享
微信分享提示