• 第九周作业


    1、配置 bind 服务,实现 www.magedu.org 域名解析

    • 配置环境
    # 主DNS服务器:10.0.0.8
    # www.magedu.org:10.0.0.9
    •  修改主配置文件/etc/named.conf
    [root@centos8 scripts]#vim /etc/named.conf
    #注释如下两行
    //      listen-on port 53 { 127.0.0.1; };
    //      allow-query     { localhost; };
    • 在配置文件/etc/named.rfc1912.zones中定义区域
    zone "magedu.org" IN {
            type master;
            file "magedu.org.zone";
    };
    • 编写区域解析库文件
    [root@centos8 named]#vim magedu.org.zone
    $TTL 86400
    @       IN  SOA  master admin ( 01 1H 10M 1D 1H )
            IN   NS  master
    master  IN    A  10.0.0.8
    www     IN    A  10.0.0.9
    • 解析测试
    [root@centos8 named]#host www.magedu.org 10.0.0.8
    Using domain server:
    Name: 10.0.0.8
    Address: 10.0.0.8#53
    Aliases:
    
    www.magedu.org has address 10.0.0.9

     

    2、配置 bind 服务,实现域名反向解析

    • 在配置文件/etc/named.rfc1912.zones中定义反向区域
    [root@centos8 named]#vim /etc/named.rfc1912.zones
    
    zone "0.0.10.in-addr.arpa" IN {
            type master;
            file "10.0.0.zone";
    };
    • 定义反向解析库文件
    [root@centos8 named]#vim /var/named/10.0.0.zone
    $TTL 86400
    @       IN  SOA  master.magedu.org.  admin.magedu.org.  ( 01 1H 10M 1D 1H )
            IN   NS  master.magedu.org.
    8       IN  PTR  master.magedu.org.
    9       IN  PTR  www.magedu.org.
    • 测试
    [root@centos8 named]#rndc reload
    server reload successful
    
    [root@centos8 named]#named-checkconf
    [root@centos8 named]#named-checkzone 0.0.10.in-addr.arpa /var/named/10.0.0.zone
    zone 0.0.10.in-addr.arpa/IN: loaded serial 1
    OK
    
    [root@centos8 named]#host -t PTR 10.0.0.9 10.0.0.8
    Using domain server:
    Name: 10.0.0.8
    Address: 10.0.0.8#53
    Aliases:
    
    9.0.0.10.in-addr.arpa domain name pointer www.magedu.org.

     

    3、配置 bind 服务,实现主从 DNS 服务配置:

    • 环境配置
    #主DNS服务器:10.0.0.8
    #从DNS服务器:10.0.0.18
    # www.magedu.org:10.0.0.9
    #客户机:10.0.0.6
    • 修改从DNS服务器的主配置文件/etc/named.conf
    [root@centos8 scripts]#vim /etc/named.conf
    #注释如下两行
    //      listen-on port 53 { 127.0.0.1; };
    //      allow-query     { localhost; };
    • 在从DNS服务器(10.0.0.18)上设置区域配置文件
    [root@centos8 script]#vim /etc/named.rfc1912.zones
    
    zone "magedu.org" IN {
            type slave;
            file "slaves/magedu.org.zone";
            masters { 10.0.0.8; };
    };
    
    zone "0.0.10.in-addr.arpa" IN {
            type slave;
            file "slaves/10.0.0.zone";
            masters { 10.0.0.8; };
    };
    • 修改主DNS服务器(10.0.0.8)区域解析库文件

    [root@centos8 named]#vim /var/named/magedu.org.zone $TTL 86400 @ IN SOA master admin ( 02 1H 10M 1D 1H ) IN NS master IN NS slave master IN A 10.0.0.8 slave IN A 10.0.0.18 www IN A 10.0.0.9
    #反向区域
    [root@centos8 named]#vim /var/named/10.0.0.zone $TTL 86400 @ IN SOA master.magedu.org. admin.magedu.org. ( 02 1H 10M 1D 1H ) IN NS master.magedu.org. IN NS slave.magedu.org. 8 IN PTR master.magedu.org. 18 IN PTR slave.magedu.org. 9 IN PTR www.magedu.org.
    • 主从DNS服务器都重新读取配置文件:rndc reload,并使用客户机(10.0.0.6)测试
    #正向测试
    [root@localhost ~]# host www.magedu.org 10.0.0.18 Using domain server: Name: 10.0.0.18 Address: 10.0.0.18#53 Aliases: www.magedu.org has address 10.0.0.9
    #反向测试
    [root@localhost ~]# host -t PTR 10.0.0.9 10.0.0.18 Using domain server: Name: 10.0.0.18 Address: 10.0.0.18#53 Aliases: 9.0.0.10.in-addr.arpa domain name pointer www.magedu.org.

    4、 配置 bind 服务,实现子域服务器

    • 环境配置
    #子域为:ops.magedu.org
    #子域DNS服务器:10.0.0.28
    #www.ops.magedu.org:10.0.0.10
    #父域主DNS服务器:
    10.0.0.8 #父域从DNS服务器:10.0.0.18
    #www.magedu.org:10.0.0.9
    • 修改子域DNS服务器(10.0.0.28)的主配置文件
    [root@centos8 scripts]#vim /etc/named.conf
    #注释如下两行
    //      listen-on port 53 { 127.0.0.1; };
    //      allow-query     { localhost; };
    • 在子域DNS服务器的配置文件/etc/named.rfc1912.zone增加子域配置

    [root@centos8 script]#vim /etc/named.rfc1912.zones

    zone "ops.magedu.org" IN {
            type master;
            file "ops.magedu.org.zone";
    };
    • 在子域DNS服务器中增加解析库文件
    [root@centos8 script]#vim /var/named/ops.magedu.org.zone
    $TTL 86400
    @       IN  SOA  subns1  admin  ( 01 1H 10M 1D 1H )
            IN   NS  subns1
    subns1  IN    A  10.0.0.28
    www     IN    A  10.0.0.10

    #启动子域DNS服务

    [root@centos8 script]#systemctl start named

     
    • 在父域DNS服务器中授权子域
    [root@centos8 named]#vim /var/named/magedu.org.zone
    $TTL 86400
    @               IN  SOA  master admin ( 03 1H 10M 1D 1H )
                    IN   NS  master
                    IN   NS  slave
    master          IN    A  10.0.0.8
    slave           IN    A  10.0.0.18
    www             IN    A  10.0.0.9
    
    ops             IN   NS  subns1.ops
    subns1.ops      IN    A  10.0.0.28
    ~
    • 测试:使用父域DNS服务器来解析子域主机
    [root@localhost ~]# host -t NS ops.magedu.org 10.0.0.8
    Using domain server:
    Name: 10.0.0.8
    Address: 10.0.0.8#53
    Aliases:
    
    ops.magedu.org name server subns1.ops.magedu.org.
    [root@localhost ~]# host subns1.ops.magedu.org 10.0.0.8
    Using domain server:
    Name: 10.0.0.8
    Address: 10.0.0.8#53
    Aliases:
    
    subns1.ops.magedu.org has address 10.0.0.28
    [root@localhost ~]# host www.ops.magedu.org 10.0.0.8
    Using domain server:
    Name: 10.0.0.8
    Address: 10.0.0.8#53
    Aliases:
    
    www.ops.magedu.org has address 10.0.0.10
    • 实现子域解析父域:修改子域dns服务器(10.0.0.28)的配置文件:/etc/named.rfc1912.zones

    [root@centos8 script]#vim /etc/named.rfc1912.zones

    zone "magedu.org" IN {
            type forward;
            forward only;
            forwarders { 10.0.0.8; };
    };
    • 测试:使用子域DNS服务器解析www.magedu.org
    [root@centos8 script]#rndc reload
    server reload successful
    [root@centos8 script]#
    [root@centos8 script]#host www.magedu.org 10.0.0.28
    Using domain server:
    Name: 10.0.0.28
    Address: 10.0.0.28#53
    Aliases:
    
    www.magedu.org has address 10.0.0.9
  • 相关阅读:
    c# 测试篇之Linq性能测试
    F# 笔记
    c# DataSource和BindingSource
    .net中配置的保存格式笔记
    泛型约束(转)
    c# 调用showDialog后需要Dispose
    c# 实现ComboBox自动模糊匹配
    c# 二进制或算法实现枚举的HasFlag函数
    C# WinForm自定义控件整理
    微软中文MSDN上的一些文章链接
  • 原文地址:https://www.cnblogs.com/jojohyj/p/13385709.html
Copyright © 2020-2023  润新知