DNS解析综合学习案例
1、用户需把/dev/myvg/mylv逻辑卷以支持磁盘配额的方式挂载到网页目录下
2、在网页目录下创建测试文件index.html,内容为用户名称,通过浏览器访问测试
3、创建用户账户,对LVM配置磁盘配额限制用户磁盘容量为软限制80M;硬限制100M、文件数量软限制为80个;硬限制为100个。
4、构建主从DNS域名解析环境
5、主从DNS都可将www.study.com域名解析为192.168.200.113
6、客户机可通过浏览器访问www.study.com得到WEB服务器相应内容
7、主域名服务器要同时担任缓存域名服务器功能
8、客户机通过nslookup域名测试工具可解析到www.jd.com等网站的域名解析
113 服务器 113 服务器 113 服务器
1
[root@localhost ~]# mdadm -C /dev/md5 -l5 -n3 /dev/sd[bcd]1
mdadm: /dev/sdb1 appears to be part of a raid array:
level=raid5 devices=3 ctime=Sat Aug 3 15:31:28 2019
mdadm: /dev/sdc1 appears to be part of a raid array:
level=raid5 devices=3 ctime=Sat Aug 3 15:31:28 2019
mdadm: /dev/sdd1 appears to be part of a raid array:
level=raid5 devices=3 ctime=Sat Aug 3 15:31:28 2019
Continue creating array?
Continue creating array? (y/n) y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[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 20G -n mylv myvg
Logical volume "mylv" created.
[root@localhost ~]# mkfs.xfs /dev/myvg/mylv
log stripe unit (524288 bytes) is too large (maximum is 256KiB)
log stripe unit adjusted to 32KiB
meta-data=/dev/myvg/mylv isize=256 agcount=16,
agsize=327552 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=5240832,
imaxpct=25
= sunit=128 swidth=256 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=8 blks, lazy-
count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost ~]# vim /etc/fstab
/dev/myvg/mylv /usr/local/httpd/htdocs xfs
defaults,usrquota,grpquota 0 0
2
[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]# yum -y install gcc gcc-c++ &&./configure --prefix=/usr/local/httpd &&make &&make install
[root@localhost ~]# cd /usr/local/httpd/conf/
[root@localhost conf]# vim httpd.conf 去掉97行的#
[root@localhost conf]# /usr/local/httpd/bin/apachectl start
[root@localhost conf]# yum -y install lynx
[root@localhost conf]# lynx 127.0.0.1
[root@localhost ~]# cd /usr/local/httpd/htdocs/
[root@localhost htdocs]# vim index.html
maoyanqing
关闭Linux安全机制和防火墙
systemctl stop firewalld
setenforce 0
3
3
[root@localhost ~]# mount /dev/myvg/mylv /usr/local/httpd/htdocs/
[root@localhost ~]# useradd -d /usr/local/httpd/htdocs/maoyanqing maoyanqing
[root@localhost ~]# quotacheck -aug
[root@localhost ~]# quotaon -aug
reboot
[root@localhost ~]# quotacheck -aug
[root@localhost ~]# quotaon -aug
[root@localhost ~]# edquota -u maoyanqing
Disk quotas for user maoyanqing (uid 1001):
Filesystem blocks soft hard inodes soft hard
/dev/mapper/myvg-mylv 12 80000 100000 4 80 100000
[root@localhost ~]# repquota -aus
*** Report for user quotas on device /dev/mapper/myvg-mylv
Block grace time: 7days; Inode grace time: 7days
Space limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 0K 0K 0K 3 0 0
maoyanqing -- 12K 80000K 100000K 4 80 100k
[root@localhost ~]# su - maoyanqing
[maoyanqing@localhost ~]$ touch yan
[maoyanqing@localhost ~]$ dd if=/dev/zero of=/usr/local/httpd/htdocs/maoyanqing/yan bs=1M count=110
dd: 写入"/usr/local/httpd/htdocs/maoyanqing/yan" 出错: 超出磁盘限额
记录了98+0 的读入
记录了97+0 的写出
102387712字节(102 MB)已复制,0.322939 秒,317 MB/秒 //测试成功
#
[root@localhost ~]# /usr/local/httpd/bin/apachectl start //因为其中重启机器,所以apa服务重启
4 主服务器 主服务器 111 111 主服务器
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
[root@localhost ~]# yum -y install bind
[root@localhost ~]# mount /dev/cdrom /media
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.study.com
192.168.200.112 ns2.study.com
[root@localhost ~]# vim /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.200.111
nameserver 192.168.200.112
[root@localhost ~]# vim /etc/named.conf
主服务器 主服务器 主服务器 主服务器
[root@localhost ~]# vim /var/named/study.zheng
[root@localhost ~]# vim /var/named/study.fan
[root@localhost ~]# systemctl restart named
[root@localhost ~]# chown :named /var/named/study.*
[root@localhost ~]# scp /etc/named.conf [email protected]:/etc/
[email protected]'s password:
named.conf 100% 523 0.5KB/s 00:00
从服务器 113 从服务器113 从服务器113 从服务器113
iptables -F
systemctl stop firewalld
setenforce 0
[root@localhost ~]# yum -y install bind
[root@localhost ~]# vim /etc/hosts
192.168.200.111 ns1.study.com
192.168.200.112 ns2.study.com
[root@localhost ~]# vim /etc/resolv.conf
nameserver 192.168.200.111
nameserver 192.168.200.112
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# systemctl restart named
配置 window 客户机 配置window 客户机
113机 出现的小状况
[root@localhost ~]# cd /usr/local/httpd/htdocs/
[root@localhost htdocs]# vi index.html
此格式输入 即可成功