1. DNS主从服务器

1.1 主从服务器概述

辅助DNS是DNS容灾备份服务:在主DNS和辅DNS之间建立区域数据传输机制,当主DNS遇到故障或者服务中断时,辅DNS仍可以继续提供解析服务,因此保障业务稳定运行。例如阿里云提供的主从服务器223.5.5.5和223.6.6.6

辅助DNS的优势:

  • 容灾备份,降低业务中断风险:主DNS系统故障,辅助DNS可继续提供域名解析服务,保障业务可用性。

  • 负责均衡,流量均摊降低负载:当辅助DNS与主DNS同时对外提供解析服务时,可以达到流量负载均衡的效果。

主从服务器实现原理如下:

注意:从服务器是区域级别的概念;

1.2 主从DNS实现

1.2.1 主从DNS实现要点

DNS主从服务器实现的注意事项如下:

  • 确保防火墙规则开放(建议关闭)
  • 保持主从服务器时钟一致;
  • bind程序的版本应该保持一致;否则,应该从高,主低;

主从DNS服务器的配置要点如下:

  • 主 DNS 的 named.conf 里配置 allow-transfer 和 also-notify 选项;
  • 辅助 DNS 主配置文件 option 段添加 masterfile-format text ,否则同步的文件为 data 类型;
  • 辅助 DNS 添加区域配置文件,类型为 slave ,同时指向 masters 参数指向master 地址;
  • 辅助 DNS 不可主动修改 DNS 数据库文件;
  • 从服务器只需要定义区域,而无须提供解析库文件;解析库文件应该放置于/var/named/slaves/目录中;
  • 主服务器的区域解析库文件中必须有一条NS记录指向从服务器;
  • 搭建完主从后,若修改主服务器域配置, Serail Number 必须递增,否则不会立即同步;

实验环境介绍:

  • 主DNS服务器:地址:192.168.20.70,主机名:dns01;
  • 从DNS服务器:地址:192.168.20.71,主机名:dns02;

1.2.2 主DNS服务器配置

  1. 主DNS服务器的配置文件如下:

    [root@dns01 named]# cat /etc/named.conf
    options {
    listen-on port 53 { localhost; };
    listen-on-v6 port 53 { localhost; };
    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";
    recursing-file "/var/named/data/named.recursing";
    secroots-file "/var/named/data/named.secroots";
    allow-query { any; };
    recursion yes;
    allow-recursion { 192.168.20.0/24; 192.168.50.0/24; }; allow-transfer {192.168.20.71;}; <==指定允许哪些主机来同步自己的数据库解析文件;
    also-notify {192.168.20.71;}; <==指定允许把自己的数据库解析文件同步给哪些主机; dnssec-enable yes;
    dnssec-validation yes;
    bindkeys-file "/etc/named.root.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";
    include "/etc/named.xuzhichao.com.zone"; #区域配置文件
    [root@dns01 named]# cat /etc/named.xuzhichao.com.zone
    zone "xuzhichao.com" IN {
    type master;
    file "xuzhichao.com.zone";
    notify yes; <==允许本区域数据解析文件进行通告
    }; zone "20.168.192.in-addr.arpa" IN {
    type master;
    file "20.168.192.in-addr.arpa.zone";
    notify yes; <==允许本区域数据解析文件进行通告
    };
  2. 主dns的区域解析文件如下:

    #1.正向解析文件:
    [root@dns01 named]# cat /var/named/xuzhichao.com.zone
    $TTL 86400 xuzhichao.com. IN SOA ns1.xuzhichao.com. mail.xuzhichao.com. (
    2021071601
    10800
    900
    604800
    86400
    ) xuzhichao.com. IN NS ns1.xuzhichao.com.
    xuzhichao.com. IN NS ns2.xuzhichao.com. <==注意:需要添加从服务器的NS记录和对应的A记录 ns1 IN A 192.168.20.70
    ns2 IN A 192.168.20.71 ;业务域 xuzhichao.com. IN MX 10 mx1.xuzhichao.com.
    mx1 IN A 192.168.20.11 www.xuzhichao.com. IN A 192.168.20.31
    www.xuzhichao.com. IN A 192.168.20.32 web.xuzhichao.com. IN CNAME www.xuzhichao.com. ;主机域 nginx02.xuzhichao.com. IN A 192.168.20.22
    ngxin03.xuzhichao.com. IN A 192.168.20.23 nginx-lb01.xuzhichao.com. IN A 192.168.20.19
    nginx-lb02.xuzhichao.com. IN A 192.168.20.20 apache01.xuzhichao.com. IN A 192.168.20.21 lvs01.xuzhichao.com. IN A 192.168.20.31
    lvs02.xuzhichao.com. IN A 192.168.20.32 mysql01.xuzhichao.com. IN A 192.168.20.50 redis01.xuzhichao.com. IN A 192.168.20.61 nfs01.xuzhichao.com. IN A 192.168.20.30 dns01.xuzhichao.com. IN A 192.168.20.70 #2.反向解析文件:
    [root@dns01 named]# cat /var/named/20.168.192.in-addr.arpa.zone
    $TTL 86400 @ IN SOA ns1.xuzhichao.com. mail.xuzhichao.com. (
    2021071601
    10800
    900
    604800
    86400
    ) @ IN NS ns1.xuzhichao.com.
    @ IN NS ns2.xuzhichao.com. <==注意:需要添加从服务器的NS记录和对应的PTR记录 70 IN PTR ns1.xuzhichao.com.
    71 IN PTR ns2.xuzhichao.com. ;业务域
    31 IN PTR www.xuzhichao.com.
    32 IN PTR www.xuzhichao.com. ;主机域 22 IN PTR nginx02.xuzhichao.com.
    23 IN PTR ngxin03.xuzhichao.com. 19 IN PTR nginx-lb01.xuzhichao.com.
    20 IN PTR nginx-lb02.xuzhichao.com. 21 IN PTR apache01.xuzhichao.com. 31 IN PTR lvs01.xuzhichao.com.
    32 IN PTR lvs02.xuzhichao.com. 50 IN PTR mysql01.xuzhichao.com. 61 IN PTR redis01.xuzhichao.com. 30 IN PTR nfs01.xuzhichao.com. 70 IN PTR dns01.xuzhichao.com.

1.2.3 从DNS服务器配置

  1. 从服务器的配置文件如下:

    [root@dns02 ~]# cat /etc/named.conf
    options {
    listen-on port 53 { localhost; };
    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";
    recursing-file "/var/named/data/named.recursing";
    secroots-file "/var/named/data/named.secroots";
    allow-query { any; };
    recursion yes;
    allow-recursion { 192.168.20.0/24; 192.168.50.0/24; }; masterfile-format text; <==从DNS需要增加此配置,指定同步的格式为text;
    allow-transfer {192.168.20.70;}; <==指定允许哪些主机来同步自己的数据库解析文件;
    also-notify {192.168.20.70;}; <==指定允许把自己的数据库解析文件同步给哪些主机; dnssec-enable yes;
    dnssec-validation yes; /* Path to ISC DLV key */
    bindkeys-file "/etc/named.root.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";
    include "/etc/named.xuzhichao.com.zone"; #区域配置文件:
    [root@dns02 ~]# cat /etc/named.xuzhichao.com.zone
    zone "xuzhichao.com" IN {
    type slave;
    file "slaves/xuzhichao.com.zone";
    masters {192.168.20.70;};
    }; zone "20.168.192.in-addr.arpa" IN {
    type slave;
    file "slaves/20.168.192.in-addr.arpa.zone";
    masters {192.168.20.70;};
    }; #修改区域配置文件属性
    [root@dns02 ~]# chgrp named /etc/named.xuzhichao.com.zone
    [root@dns02 ~]# chmod 640 /etc/named.xuzhichao.com.zone
  2. 检测配置文件语法,启动DNS服务

    [root@dns02 ~]# named-checkconf
    [root@dns02 ~]# systemctl start named.service #查看日志,发现主从解析数据库文件自动完成同步
    [root@dns02 ~]# systemctl status named.service
    ● named.service - Berkeley Internet Name Domain (DNS)
    Loaded: loaded (/usr/lib/systemd/system/named.service; disabled; vendor preset: disabled)
    Active: active (running) since Sat 2021-07-17 11:09:06 CST; 39s ago
    Process: 1835 ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS (code=exited, status=0/SUCCESS)
    Process: 1833 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)
    Main PID: 1837 (named)
    CGroup: /system.slice/named.service
    └─1837 /usr/sbin/named -u named -c /etc/named.conf Jul 17 11:09:06 dns02 named[1837]: transfer of '20.168.192.in-addr.arpa/IN' from 192.168.20.70#53: Transfer completed: 1 messages, 19 records, 504 bytes, 0.001 secs (504000 bytes/sec)
    Jul 17 11:09:06 dns02 named[1837]: zone 20.168.192.in-addr.arpa/IN: sending notifies (serial 2021071601)
    Jul 17 11:09:06 dns02 named[1837]: zone xuzhichao.com/IN: Transfer started.
    Jul 17 11:09:06 dns02 named[1837]: transfer of 'xuzhichao.com/IN' from 192.168.20.70#53: connected using 192.168.20.71#47495
    Jul 17 11:09:06 dns02 named[1837]: zone xuzhichao.com/IN: transferred serial 2021071601
    Jul 17 11:09:06 dns02 named[1837]: transfer of 'xuzhichao.com/IN' from 192.168.20.70#53: Transfer status: success
    Jul 17 11:09:06 dns02 named[1837]: transfer of 'xuzhichao.com/IN' from 192.168.20.70#53: Transfer completed: 1 messages, 22 records, 529 bytes, 0.001 secs (529000 bytes/sec)
    Jul 17 11:09:06 dns02 named[1837]: zone xuzhichao.com/IN: sending notifies (serial 2021071601)
    Jul 17 11:09:06 dns02 named[1837]: managed-keys-zone: Key 20326 for zone . acceptance timer complete: key now trusted
    Jul 17 11:09:06 dns02 named[1837]: resolver priming query complete
  3. 同步主DNS解析数据库文件:

    [root@dns02 ~]# ll /var/named/slaves/
    total 8
    -rw-r--r-- 1 named named 808 Jul 17 11:09 20.168.192.in-addr.arpa.zone
    -rw-r--r-- 1 named named 765 Jul 17 11:09 xuzhichao.com.zone
  4. 测试客户端通过从DNS服务器解析:

    #测试正向解析:
    [root@xuzhichao ~]# dig nginx02.xuzhichao.com @192.168.20.71 +short
    192.168.20.22
    [root@xuzhichao ~]# dig web.xuzhichao.com @192.168.20.71 +short
    www.xuzhichao.com.
    192.168.20.32
    192.168.20.31 #测试方向解析:
    [root@xuzhichao ~]# dig -x 192.168.20.21 @192.168.20.71 +short
    apache01.xuzhichao.com.

1.2.4 测试主从同步

在主DNS上增加一条记录,并修改序列号,测试从DNS是否会进行同步。

  • 主DNS增加A记录,并修改序列号:

    #修改正向解析文件:
    [root@dns01 named]# cat /var/named/xuzhichao.com.zone
    $TTL 86400 xuzhichao.com. IN SOA ns1.xuzhichao.com. mail.xuzhichao.com. (
    2021071602 <==增加序列号
    10800
    900
    604800
    86400
    ) xuzhichao.com. IN NS ns1.xuzhichao.com.
    xuzhichao.com. IN NS ns2.xuzhichao.com. ns1 IN A 192.168.20.70
    ns2 IN A 192.168.20.71 ;业务域 xuzhichao.com. IN MX 10 mx1.xuzhichao.com.
    mx1 IN A 192.168.20.11 www.xuzhichao.com. IN A 192.168.20.31
    www.xuzhichao.com. IN A 192.168.20.32 web.xuzhichao.com. IN CNAME www.xuzhichao.com. ;主机域 nginx02.xuzhichao.com. IN A 192.168.20.22
    ngxin03.xuzhichao.com. IN A 192.168.20.23 nginx-lb01.xuzhichao.com. IN A 192.168.20.19
    nginx-lb02.xuzhichao.com. IN A 192.168.20.20 apache01.xuzhichao.com. IN A 192.168.20.21 lvs01.xuzhichao.com. IN A 192.168.20.31
    lvs02.xuzhichao.com. IN A 192.168.20.32 mysql01.xuzhichao.com. IN A 192.168.20.50 redis01.xuzhichao.com. IN A 192.168.20.61 nfs01.xuzhichao.com. IN A 192.168.20.30 dns01.xuzhichao.com. IN A 192.168.20.70
    dns02.xuzhichao.com. IN A 192.168.20.71 <==增加A记录 #修改反向解析文件:
    [root@dns01 named]# cat /var/named/20.168.192.in-addr.arpa.zone
    $TTL 86400 @ IN SOA ns1.xuzhichao.com. mail.xuzhichao.com. (
    2021071602 <==增加序列号
    10800
    900
    604800
    86400
    ) @ IN NS ns1.xuzhichao.com.
    @ IN NS ns2.xuzhichao.com. 70 IN PTR ns1.xuzhichao.com.
    71 IN PTR ns2.xuzhichao.com. ;@ IN MX 10 mx1.xuzhichao.com.
    ;11 IN PTR mx1.xuzhichao.com.
    ;mx1.xuzhichao.com. IN A 192.168.20.11
    ;业务域
    31 IN PTR www.xuzhichao.com.
    32 IN PTR www.xuzhichao.com. ;主机域 22 IN PTR nginx02.xuzhichao.com.
    23 IN PTR ngxin03.xuzhichao.com. 19 IN PTR nginx-lb01.xuzhichao.com.
    20 IN PTR nginx-lb02.xuzhichao.com. 21 IN PTR apache01.xuzhichao.com. 31 IN PTR lvs01.xuzhichao.com.
    32 IN PTR lvs02.xuzhichao.com. 50 IN PTR mysql01.xuzhichao.com. 61 IN PTR redis01.xuzhichao.com. 30 IN PTR nfs01.xuzhichao.com. 70 IN PTR dns01.xuzhichao.com.
    71 IN PTR dns02.xuzhichao.com. <==增加PTR记录 #重启dns服务:
    [root@dns01 named]# rndc reload
    server reload successful
  • 查看从DNS同步情况

    #通过日志查看,已经完成同步:
    [root@dns02 ~]# systemctl status named.service
    ● named.service - Berkeley Internet Name Domain (DNS)
    Loaded: loaded (/usr/lib/systemd/system/named.service; disabled; vendor preset: disabled)
    Active: active (running) since Sat 2021-07-17 11:09:06 CST; 13min ago
    Process: 1835 ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS (code=exited, status=0/SUCCESS)
    Process: 1833 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)
    Main PID: 1837 (named)
    CGroup: /system.slice/named.service
    └─1837 /usr/sbin/named -u named -c /etc/named.conf Jul 17 11:19:43 dns02 named[1837]: transfer of 'xuzhichao.com/IN' from 192.168.20.70#53: Transfer completed: 1 messages, 23 records, 551 bytes, 0.001 secs (551000 bytes/sec)
    Jul 17 11:19:43 dns02 named[1837]: zone xuzhichao.com/IN: sending notifies (serial 2021071602)
    Jul 17 11:19:44 dns02 named[1837]: client @0x7f5cd40c6790 192.168.20.70#52480: received notify for zone '20.168.192.in-addr.arpa'
    Jul 17 11:19:44 dns02 named[1837]: zone 20.168.192.in-addr.arpa/IN: notify from 192.168.20.70#52480: serial 2021071602
    Jul 17 11:19:44 dns02 named[1837]: zone 20.168.192.in-addr.arpa/IN: Transfer started.
    Jul 17 11:19:44 dns02 named[1837]: transfer of '20.168.192.in-addr.arpa/IN' from 192.168.20.70#53: connected using 192.168.20.71#58675
    Jul 17 11:19:44 dns02 named[1837]: zone 20.168.192.in-addr.arpa/IN: transferred serial 2021071602
    Jul 17 11:19:44 dns02 named[1837]: transfer of '20.168.192.in-addr.arpa/IN' from 192.168.20.70#53: Transfer status: success
    Jul 17 11:19:44 dns02 named[1837]: transfer of '20.168.192.in-addr.arpa/IN' from 192.168.20.70#53: Transfer completed: 1 messages, 20 records, 524 bytes, 0.001 secs (524000 bytes/sec)
    Jul 17 11:19:44 dns02 named[1837]: zone 20.168.192.in-addr.arpa/IN: sending notifies (serial 2021071602)
  • 从客户端测试能否解析成功:

    #测试从主DNS解析:
    [root@xuzhichao ~]# dig dns02.xuzhichao.com @192.168.20.70 +short
    192.168.20.71
    [root@xuzhichao ~]# dig -x 192.168.20.71 @192.168.20.70 +short
    ns2.xuzhichao.com.
    dns02.xuzhichao.com. #测试从从DNS解析:
    [root@xuzhichao ~]# dig dns02.xuzhichao.com @192.168.20.71 +short
    192.168.20.71
    [root@xuzhichao ~]# dig -x 192.168.20.71 @192.168.20.71 +short
    dns02.xuzhichao.com.
    ns2.xuzhichao.com.

1.2.5 客户端配置DNS高可用

在客户端上需要实现DNS的高可用,就要配置两个DNS的地址:

[root@xuzhichao ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search lan
nameserver 192.168.20.70
nameserver 192.168.20.71

1.2.6 手动同步区域解析文件

在从DNS上使用dig命令可以手动同步主DNS的配置文件:

在从DNS上同步主DNS的xuzhichao.com域的区域解析文件:

[root@dns02 ~]# dig -t axfr xuzhichao.com @192.168.20.70

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7 <<>> -t axfr xuzhichao.com @192.168.20.70
;; global options: +cmd
xuzhichao.com. 86400 IN SOA ns1.xuzhichao.com. mail.xuzhichao.com. 2021071602 10800 900 604800 86400
xuzhichao.com. 86400 IN NS ns1.xuzhichao.com.
xuzhichao.com. 86400 IN NS ns2.xuzhichao.com.
xuzhichao.com. 86400 IN MX 10 mx1.xuzhichao.com.
apache01.xuzhichao.com. 86400 IN A 192.168.20.21
dns01.xuzhichao.com. 86400 IN A 192.168.20.70
dns02.xuzhichao.com. 86400 IN A 192.168.20.71
lvs01.xuzhichao.com. 86400 IN A 192.168.20.31
lvs02.xuzhichao.com. 86400 IN A 192.168.20.32
mx1.xuzhichao.com. 86400 IN A 192.168.20.11
mysql01.xuzhichao.com. 86400 IN A 192.168.20.50
nfs01.xuzhichao.com. 86400 IN A 192.168.20.30
nginx-lb01.xuzhichao.com. 86400 IN A 192.168.20.19
nginx-lb02.xuzhichao.com. 86400 IN A 192.168.20.20
nginx02.xuzhichao.com. 86400 IN A 192.168.20.22
ngxin03.xuzhichao.com. 86400 IN A 192.168.20.23
ns1.xuzhichao.com. 86400 IN A 192.168.20.70
ns2.xuzhichao.com. 86400 IN A 192.168.20.71
redis01.xuzhichao.com. 86400 IN A 192.168.20.61
web.xuzhichao.com. 86400 IN CNAME www.xuzhichao.com.
www.xuzhichao.com. 86400 IN A 192.168.20.31
www.xuzhichao.com. 86400 IN A 192.168.20.32
xuzhichao.com. 86400 IN SOA ns1.xuzhichao.com. mail.xuzhichao.com. 2021071602 10800 900 604800 86400
;; Query time: 0 msec
;; SERVER: 192.168.20.70#53(192.168.20.70)
;; WHEN: Sat Jul 17 11:26:59 CST 2021
;; XFR size: 23 records (messages 1, bytes 562)

这样我们就需要在主从DNS中明确指明允许哪台主机进行DNS同步,否则会存在安全隐患,配置指令为:

allow-transfer {192.168.20.71;};     <==指定允许哪些主机来同步自己的数据库解析文件;
also-notify {192.168.20.71;}; <==指定允许把自己的数据库解析文件同步给哪些主机;

此时从其他主机进行同步主DNS的文件就无法同步:

[root@xuzhichao ~]# dig -t axfr xuzhichao.com @192.168.20.70

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7 <<>> -t axfr xuzhichao.com @192.168.20.70
;; global options: +cmd
; Transfer failed.

DNS(5) -- 主从dns的更多相关文章

  1. 使用bind实现主从DNS服务器数据同步

    一.bind简介 Linux中通常使用bind来实现DNS服务器的架设,bind软件由isc(www.isc.org)维护.在yum仓库中可以找到软件,配置好yum源,直接使用命令yum instal ...

  2. 架构师成长之路6.4 DNS服务器搭建(部署主从DNS)

    点击返回架构师成长之路 架构师成长之路6.3 DNS服务器搭建(部署主从DNS)  部署主DNS : 点击 部署从DNS : 如下步骤 1.与主DNS一样,安装bind yum -y install ...

  3. centos DNS服务搭建 DNS原理 使用bind搭建DNS服务器 配置DNS转发 配置主从 安装dig工具 DHCP dhclient 各种域名解析记录 mydns DNS动态更新 第三十节课

    centos  DNS服务搭建  DNS原理  使用bind搭建DNS服务器 配置DNS转发 配置主从  安装dig工具  DHCP  dhclient  各种域名解析记录  mydns DNS动态更 ...

  4. 基于Bind实现的DNS正反向解析及主从DNS的配置

    一.什么是DNS? 1.1 简单的理解,Domain Name System,是互联网一项核心的服务,他作为一个桥梁可以将域名和IP地址相互因素的一个分布式数据库,能够使人更加方便的访问互联网,而不用 ...

  5. DNS的主从,转发与负载功能

    接着原来<DNS原理与应用>的文章,本章内容主要通过实现DNS的主从,转发,及基于域名解析不同的ip实现后端服务负载均衡的效果.最后再实现DNS的高级功能:类似CDN原理实现基于IP实现区 ...

  6. 使用BIND安装智能DNS服务器(一)---基本的主从DNS服务器搭建

    参考网址:http://www.unixmen.com/dns-server-installation-step-by-step-using-centos-6-3/ DNS(Domain Name S ...

  7. DNS的主从、子域授权和转发服务器

    DNS的主从.子域授权和转发服务器 主从DNS 注意: 1.全局配置options{} 里面的内容,其中 listen-on port 53 {any or local:}:或者直接注释掉,或删掉 a ...

  8. Centos7搭建主从DNS服务器

    1.准备 例:两台192.168.11.10(主),192.168.11.11(从),域名www.test1.com # 主从DNS服务器均需要安装bind.bind-chroot.bind-util ...

  9. centos7 主从dns配置 bind服务

    一,配置前请先关闭防火墙selinux 防火墙关闭方法,参见上一篇文章. setenforce 0    #临时关闭 修改/etc/selinux/config 文件  将SELINUX=enforc ...

  10. DNS劫持和DNS污染的区别

    我们知道,某些网络运营商为了某些目的,对DNS进行了某些操作,导致使用ISP的正常上网设置无法通过域名取得正确的IP地址.常用的手段有:DNS劫持和DNS污染. 什么是DNS劫持 DNS劫持就是通过劫 ...

随机推荐

  1. 2023 LGR 非专业级别软件能力认证第一轮(初赛)S组

    计算器.背包.代码都不能带进考场 禁赛三年并全国通报 B选项符合while语句 弱类型编程语言指的是可以进行类型转换,可以参与各种类型变量的运算 \[3\times 60(秒)\times 44.1\ ...

  2. #构造#CF891B Gluttony

    题目 有一个长度为 \(n\) 的数列 \(a\),数字互不相同, 现在要打乱这个数列,设其为 \(b\), 使得 \(a\) 的任意真子序列与对应的 \(b\) 的任意真子序列的数字和不同 输出任意 ...

  3. #三分,分治,计算几何,prim#JZOJ 3860 地壳运动

    题目 \(q\)组询问查询最小生成树,边权为\(u*k1+v*k2\)(\(k1,k2\)每次询问都不同) \(n\leq 35,m\leq 25000,q\leq 200000\) 分析 纯\(\t ...

  4. #trie,树链剖分#洛谷 6088 [JSOI2015]字符串树

    题目 分析 显然树上的问题可以转换成根节点到两点的答案减去2倍根节点到LCA的答案 化边为点,考虑子节点承接父节点的trie,再加入一条新的字符串, 在循环的过程中统计一个位置被多少个字符串经过, 这 ...

  5. 【Java面试指北】单例模式

    单线程下的单例模式: public class Singleton { private static Singleton instance; private Singleton() {} public ...

  6. 有奖活动 | 以代码之名,写出对Ta的爱

      七夕情人节到了,为了Ta, 你打算用什么方式表达爱? 是包包.鲜花.美酒.巧克力, 还是一封充满爱意的短信? 在HarmonyOS,有一群精致又机智的开发者们,他们#以代码之名,表达爱# 比起鲜花 ...

  7. CentOS6.5安装与配置JDK-7

    系统环境:centos-6.5 安装方式:rpm安装 软件:jdk-7-linux-i586.rpm 下载地址:http://www.oracle.com/technetwork/java/javas ...

  8. Web自动化实战:去哪儿网购票流程测试

    克隆源码 项目Github地址:https://github.com/gy-7/Web-automation-practice/tree/main/project1_qunar_booking_tic ...

  9. 推荐一个计算Grad-CAM的Python库

    前言 类激活图CAM(class activation mapping)用于可视化深度学习模型的感兴趣区域,增加了神经网络的可解释性.现在常用Grad-CAM可视化,Grad-CAM基于梯度计算激活图 ...

  10. js深浅复制(拷贝)

    从两种数据类型说起 在js中,变量的类型可以大致分成两种:基本数据类型和引用数据类型,其中基本数据类型指的是简单的数据段,包括: Undefined Null Boolean Number Strin ...