zoukankan      html  css  js  c++  java
  • DNS解析综合案例

    DNS解析综合学习案例

    1、用户需把/dev/myvg/mylv逻辑卷以支持磁盘配额的方式挂载到网页目录下

    2、在网页目录下创建测试文件index.html,内容为用户名称,通过浏览器访问测试

    3、创建用户账户,对LVM配置磁盘配额限制用户磁盘容量为软限制80M;硬限制100M、文件数量软限制为80个;硬限制为100个。

    4、构建主从DNS域名解析环境

    5、主从DNS都可将www.crushlinux.com域名解析为192.168.200.113

    6、客户机可通过浏览器访问www.crushliunx.com得到WEB服务器相应内容

    7、主域名服务器要同时担任缓存域名服务器功能

    8、客户机通过nslookup域名测试工具可解析到www.jd.com等网站的域名解析结果

    [root@localhost ~]# rpm -q gcc gcc-c++ make lynx
    未安装软件包 gcc
    未安装软件包 gcc-c++
    make-3.82-23.el7.x86_64
    未安装软件包 lynx
    [root@localhost ~]# mount /dev/sr0 /media
    mount: /dev/sr0 写保护,将以只读方式挂载
    [root@localhost ~]# yum -y install gcc gcc-c++ lynx

    [root@localhost ~]# rpm -q gcc gcc-c++ make lynx

    gcc-4.8.5-36.el7_6.2.x86_64
    gcc-c++-4.8.5-36.el7_6.2.x86_64
    make-3.82-23.el7.x86_64
    lynx-2.8.8-0.3.dev15.el7.x86_64

    [root@localhost ~]# yum -y install lrzsz

    [root@localhost ~]# rz -E
    rz waiting to receive.

    [root@localhost ~]# ls
    anaconda-ks.cfg httpd-2.2.17.tar.gz
    [root@localhost ~]# tar xf httpd-2.2.17.tar.gz -C /usr/local/

    [root@localhost ~]# cd /usr/local/httpd-2.2.17/
    [root@localhost httpd-2.2.17]# ./configure --prefix=/usr/local/httpd && make && make install

    [root@localhost httpd-2.2.17]# cd /usr/local/httpd/conf
    [root@localhost conf]# cp httpd.con{,.bak}
    [root@localhost conf]# ls
    extra httpd.conf httpd.conf.bak magic mime.types original
    [root@localhost conf]# vi httpd.conf

    [root@localhost /]# /usr/local/apache/bin/apachectl start
    [root@localhost /]# lynx 127.0.0.1

    [root@localhost local]# fdisk /dev/sdb

    [root@localhost local]# fdisk /dev/sdc

    [root@localhost local]# fdisk /dev/sdd

    [root@localhost /]# yum -y install mdadm

    [root@localhost /]# mdadm -C md5 -l 5 -n 3 /dev/sd[bcd]1

    [root@localhost ~]# pvcreate /dev/md5
    Physical volume "/dev/md5" successfully created.
    [root@localhost ~]# vgcreate myvg /dev/md5
    Volume group "myvg" successfully created
    [root@localhost ~]# lvcreate -L 35G -n mylv myvg
    Logical volume "mylv" created.

    [root@localhost ~]# mkfs.ext4 /dev/myvg/mylv 

    [root@localhost ~]# vi /etc/fstab

    /dev/myvg/mylv    /usr/local/apache/htdocs      ext4     defaults,usrquota,grpquota      0 0

    [root@localhost ~]# mount -a

    [root@localhost ~]# mount | grep /usr/local/apache/htdocs
    /dev/mapper/myvg-mylv on /usr/local/apache/htdocs type ext4(rw,relatime,seclabel,attr2,inode64,sunit=1024,swidth=2048,usrquota,grpquota)

    [root@localhost ~]# useradd 2567

    [root@localhost ~]# quotacheck -auvg

    [root@localhost ~]# quotaon /usr/local/httpd/htdocs/

    [root@localhost ~]# edquota -u 2567

    [root@localhost ~]# quota -uvs 2567
    Disk quotas for user #2567 (uid 2567):
    Filesystem         space    quota    limit    grace    files    quota    limit  grace
    /dev/mapper/myvg-mylv  0K    81920K    100M         0       80     100

    所有服务器:
    iptables -F
    systemctl stop firewalld
    setenforce 0

    配置yum


    主服务器:
    [root@localhost ~]# yum -y install bind
    [root@localhost ~]# cat /etc/resolv.conf
    # Generated by NetworkManager
    nameserver 192.168.200.111
    nameserver 192.168.200.112
    [root@localhost ~]# cat /etc/hosts
    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.200.111 ns1.crushlinux.com
    192.168.200.112 ns2.crushlinux.com

    [root@localhost ~]# cat /etc/named.conf
    options {

      listen-on port 53 { 192.168.200.111;  };
      directory "/var/named";

      allow-query  { any; };

      recursion  yes;
    };

    zone "crushlinux.com" IN {
      type master;
      file "crushlinux.zheng";
      allow-transfer { 192.168.200.112; };
    };

    zone "200.168.192.in-addr.arpa" IN {
      type master;
      file "crushlinux.fan";
      allow-transfer { 192.168.200.112; };
    };
    [root@localhost ~]#
    [root@localhost ~]# cat /var/named/crushlinux.zheng
    $TTL 86400
    @   IN   SOA   crushlinux.com.   admin.crushlinux.com. (
          20190817
           3H
           15M
           1W
           1D
    )
        IN   NS     ns1.crushlinux.com.
        IN   NS     ns2.crushlinux.com.
        IN   MX 10     mail.crushlinux.com.
    ns1   IN   A        192.168.200.111
    ns2   IN   A      192.168.200.112
    mail   IN   A        192.168.200.118
    www    IN   A        192.168.200.114
    study   IN   A      192.168.200.113
    *     IN   A      192.168.200.111
    ftp     IN   CNAME   www

    [root@localhost ~]# cat /var/named/crushlinux.fan
    $TTL 86400                     
    @   IN   SOA   crushlinux.com.   admin.crushlinux.com. (
          20190817
           3H
           15M  
           1W
           1D
    )
        IN    NS     ns1.crushlinux.com.
        IN      NS      ns2.crushlinux.com.
        IN   MX 10    mail.crushlinux.com.
    111    IN   PTR     ns1.crushlinux.com.
    112    IN   PTR     ns2.crushlinux.com.
    118    IN   PTR     mail.crushlinux.com.
    114    IN   PTR     www.crushlinux.com.
    113    IN   PTR     study.crushlinux.com.
    111    IN   PTR     ns1.crushlinux.com.
    [root@localhost ~]# chown :named /var/named/crushlinux.*
    [root@localhost ~]# named-checkconf -z /etc/named.conf
    [root@localhost ~]# named-checkzone crushlinux.com /var/named/crushlinux.zheng
    [root@localhost ~]# named-checkzone crushlinux.com /var/named/crushlinux.fan
    [root@localhost ~]# systemctl restart named

    ===============================================================================
    从服务器:
    [root@localhost ~]# yum -y install bind
    [root@localhost ~]# cat /etc/resolv.conf
    # Generated by NetworkManager
    nameserver 192.168.200.111
    nameserver 192.168.200.112
    [root@localhost ~]# cat /etc/hosts
    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.200.111 ns1.crushlinux.com
    192.168.200.112 ns2.crushlinux.com


    [root@localhost ~]# cat /etc/named.conf
    options {
      directory "/var/named";
    };

    zone "crushlinux.com" IN {
      type slave;
      file "slaves/crushlinux.zheng";
      masters { 192.168.200.111; };
    };
    zone "200.168.192.in-addr.arpa" IN {
      type slave;
      file "slaves/crushlinux.fan";
      masters { 192.168.200.111; };
    };

    [root@localhost ~]# systemctl restart named

    =================================================================================

    客户机:

    [root@localhost ~]# cat /etc/resolv.conf 
    # Generated by NetworkManager
    nameserver 192.168.200.111
    [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens32

    ...

    DNS1=192.168.200.111

  • 相关阅读:
    039 RabbitMq及数据同步01
    038 商品详情02-----页面静态化
    037 商品详情01
    036 搭建搜索微服务04----分类和品牌的过滤
    035 搭建搜索微服务03----页面分页效果
    034 通过域名访问服务器或本地的图片资源---switchhost+nginx
    033 搭建搜索微服务02----实现基本搜索功能
    ubuntu server 无线网卡的处理
    grub 启动错误 "file not found"
    Ubuntu 的 desktop 和 server 还是有区别。
  • 原文地址:https://www.cnblogs.com/2567xl/p/11379254.html
Copyright © 2011-2022 走看看