zoukankan      html  css  js  c++  java
  • 马哥博客作业第九周

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

      [root@88 ~]vim /etc/named.conf  

      listen-on port 53 { loaclhost; };
      allow-query { any; };
      dnssec-enable no;
      dnssec-validation no;

    [root@88 ~]vim  /etc/named.rfc1912.zones
    zone "magedu.org" { type master; file "magedu.org.zone"; }; 
     [root@88 ~]cp -p /var/named/named.localhost /var/named/magedu.org.zone 
    [root@88 ~]vim /var/named/magedu.org.zone
    $TTL 1D @ IN SOA master admin (             
    0 ; serial             1D ; refresh             1H ; retry             1W ; expire             3H ) ; minimum        NS master master    A 10.0.0.88 www      A 10.0.0.99
      [root@88 ~]named-checkconf 
      [root@88 ~]named-checkzone magedu.org /var/named/magedu.org.zone
      [root@88 ~]rndc reload

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

    [root@88 ~]#vim /etc/named.rfc1912.zones
    zone "0.0.10.in-addr.arpa" { type master; file "10.0.0.zone"; };
    [root@88 ~]#cp -p /var/named/named.loopback /var/named/10.0.0.zone
    [root@88 ~]#vim /var/named/10.0.0.zone
    $TTL 1D @ IN SOA ns admin.magedu.org. (
    0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS ns.magedu.org. 99 PTR www.magedu.org.
     [root@88 ~]#named-checkzone 0.0.10.in-addr.apra /var/named/10.0.0.zone
    
      root@88 ~]#rndc reload

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

      主服务器配置:  

    [root@88 ~]#vim /etc/named.conf
    dnssec-enable no;
    dnssec-validation no;
    allow-transfer {10.0.0.99;};  
    [root@88 ~]#vim /var/named/magedu.org.zone
    $TTL 1D @ IN SOA master admin (
    0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS master master A 10.0.0.88 www A 10.0.0.99 slave A 10.0.0.99
    [root@88 ~]#named-checkconf 
    
    [root@88 ~]#named-checkzone magedu.org /var/named/magedu.org.zone
    
    [root@88 ~]#rndc reload

      从服务器配置: 

    [16:20:27 root@99 ~]#yum install named named-utils -y;systemctl enable --now named.service 
    [16:21:51 root@99 ~]#vim /etc/named.conf  
      //listen-on port 53 { 127.0.0.1; };
     //allow-query { localhost; }; allow-transfer {none;};  
    [16:23:08 root@99 ~]#vim /etc/named.rfc1912.zones
    zone "magedu.org" { type slave; masters {10.0.0.88;}; file "slaves/magedu.org.slave"; }; 
    [16:24:27 root@99 ~]#named-checkconf 
    
       [16:25:25 root@99 ~]#rndc reload 
     [16:25:30 root@99 ~]#ls /var/named/slaves/magedu.org.slave 
      var/named/slaves/magedu.org.slave
    [16:28:45 root@99 ~]#cat /etc/resolv.conf 
    # Generated by NetworkManager
    nameserver 10.0.0.88
    nameserver 10.0.0.99

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

      父域服务器配置:10.0.0.8

    [root@8 ~]#yum install bind-utils -y;systemctl enable --now named.service
    [root@8 ~]#vim /etc/named.conf
      options {
          //listen-on port 53 { 127.0.0.1; };
    
          //allow-query { localhost; };
    
          allow-transfer {10.0.0.18;};
    
      dnssec-enable no;
      dnssec-validation no;
    [root@8 ~]#cp -p /var/named/named.localhost /var/named/magedu.org.zone
    [root@8 ~]#vim /var/named/magedu.org.zone

    $TTL 1D
    @ IN SOA master admin (
                0 ; serial
                1D ; refresh
                1H ; retry
                1W ; expire
                3H ) ; minimum
             NS master
    shanghai     NS shanghains
    master      A 10.0.0.8
    shanghains   A 10.0.0.18
    websrv     A 10.0.0.77
    www       CNAME websrv

    [root@8 ~]#named-checkconf
    [root@8 ~]#named-checkzone magedu.org /var/named/magedu.org.zone
    zone magedu.org/IN: loaded serial 0
    OK
    [root@8 ~]#rndc reload
    server reload successful

      子域服务器配置:10.0.0.18

    [17:40:11 root@18 ~]#yum install bind bind-utils -y;systemctl enable --now named
    [17:40:11 root@18 ~]#vim /etc/named.conf
    options {
        //listen-on port 53 { 127.0.0.1; };
        //allow-query     { localhost; };
        allow-transfer  {none;};
        dnssec-enable no;
        dnssec-validation no;
    [17:40:11 root@18 ~]#vim /etc/named.conf
    options {
        //listen-on port 53 { 127.0.0.1; };
        //allow-query     { localhost; };
        allow-transfer  {none;};
        dnssec-enable no;
        dnssec-validation no;
    [17:41:22 root@18 ~]#vim /etc/named.rfc1912.zones
    zone "shanghai.magedu.org" {
        type master;
        file "shanghai.magedu.org.zone";                                                                                             
    };
    [17:41:54 root@18 ~]#cp -p /var/named/named.localhost /var/named/shanghai.magedu.org.zone
    [17:41:54 root@18 ~]#vim /var/named/shanghai.magedu.org.zone
    $TTL 1D
    @   IN SOA  master admin.magedu.org. (
                        0   ; serial
                        1D  ; refresh
                        1H  ; retry
                        1W  ; expire
                        3H )    ; minimum
             NS  master
    master      A   10.0.0.18
    websrv      A   10.0.0.78
    www         CNAME   websrv     
    [17:44:08 root@18 ~]#named-checkconf 
    [17:44:23 root@18 ~]#named-checkzone shanghai.magedu.org /var/named/shanghai.magedu.org.zone
    zone shanghai.magedu.org/IN: loaded serial 0
    OK
    [17:44:27 root@18 ~]#rndc reload
    server reload successful
    [17:44:42 root@18 ~]#vie0
    DNS1=127.0.0.1  
    [17:45:32 root@18 ~]#nmcli c reload
    [17:45:58 root@18 ~]#nmcli c up eth0
    Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3) 

      父域的web服务器:10.0.0.77

    [17:27:53 root@77 ~]#yum install httpd -y ;systemctl enable --now httpd;echo "`hostname -I`" >/var/www/html/index.html
    [17:27:57 root@77 ~]#cat /var/www/html/index.html 
    10.0.0.77 

      子域的web服务器:10.0.0.78

    [root@78 ~]#yum install httpd -y ;systemctl enable --now httpd;echo "`hostname -I`" >/var/www/html/index.html
    [root@78 ~]#cat /var/www/html/index.html
    10.0.0.78

      客户端测试:ubuntu10.0.0.100

    [17:29:07 root@ubuntu18044 ~]#vim /etc/netplan/01-netcfg.yaml
    network:                                                                                                                         
      version: 2
      renderer: networkd
      ethernets:
        eth0:
          dhcp4: no
          addresses: [10.0.0.100/24]
          gateway4: 10.0.0.2
          nameservers:
                    addresses: [10.0.0.8,10.0.0.18]
    [17:29:21 root@ubuntu18044 ~]#netplan apply 
    [17:29:48 root@ubuntu18044 ~]#curl www.magedu.org
    10.0.0.77 
    [17:30:05 root@ubuntu18044 ~]#curl www.shanghai.magedu.org
    10.0.0.78 

  • 相关阅读:
    全球疫情实时监控——约翰斯·霍普金斯大学数据大屏实现方案
    少儿编程崛起?2020年4月编程语言排名发布——Java,C,Python分列前三,Scratch挤进前20
    干货来了!阿里发布近300页Flink实战电子书
    Druid 0.17 入门(3)—— 数据接入指南
    Druid 0.17 入门(2)—— 安装与部署
    Flink 1.10 正式发布!——与Blink集成完成,集成Hive,K8S
    Druid入门(1)—— 快速入门实时分析利器-Druid_0.17
    程序员需要了解依赖冲突的原因以及解决方案
    每日一技|活锁,也许你需要了解一下
    Dubbo 服务 IP 注册错误踩坑经历
  • 原文地址:https://www.cnblogs.com/huangguangrui/p/13380716.html
Copyright © 2011-2022 走看看