测试二 2019.8.19

测试二 2019.8.19

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等网站的域名解析结果

 

 

步骤:

111:
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.200.111
NETMASK=255.255.255.0
[root@localhost ~]# yum -y install dhcp
[root@localhost ~]# cat /usr/share/doc/dhcp*/dhcpd.conf.example > /etc/dhcp/dhcpd.conf
[root@localhost ~]# systemctl restart dhcpd
配置yum源步骤 省略.........
[root@localhost ~]# yum -y install bind  bind-libs  bind-utils   net-tools
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
构建缓存域名服务器:
[root@localhost ~]# vi /etc/named.conf
listen-on port 53 { any; };
allow-query { any; };
[root@localhost ~]# vi /etc/dhcp/dhcpd.conf
option domain-name "study.com";
option domain-name-servers 192.168.200.111;
default-lease-time 21600;
max-lease-time 43200;
subnet 192.168.200.0 netmask 255.255.255.0 {
range 192.168.200.150 192.168.200.200;
option routers 192.168.200.1;
}
[root@localhost ~]# systemctl restart named
[root@localhost ~]# systemctl restart dhcpd
[root@localhost ~]#dig www.baidu.com @192.168.200.111
构建主域名DNS服务器:
[root@localhost ~]# vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.200.111
nameserver 192.168.200.112
[root@localhost ~]# vi /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 ~]# vi /etc/named.conf
options {
options {
listen-on port 53 { 192.168.200.111; };
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";
allow-query { any; };
recursion yes;
};
zone "study.com" IN {
type master;
file "study.zheng";
allow-transfer { 192.168.200.112; };
};
zone "200.168.192.in-addr.arpa" IN {
type master;
file "study.fan";
allow-transfer { 192.168.200.112; };
};
[root@localhost ~]# vi /var/named/study.zheng
$TTL 86400
@ IN SOA study.com. admin.study.com. (
20190819
3H
15M
1W
1D
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 mail.study.com.
ns1 IN A 192.168.200.111
ns2 IN A 192.168.200.112
www IN A 192.168.200.113
mail IN A 192.168.200.114
* IN A 192.168.200.111
[root@localhost ~]# vi /var/named/study.fan
$TTL 86400
@ IN SOA study.com. admin.study.com. (
20190819
3H
15M
1W
1D
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 mail.study.com.
111 IN PTR ns1.study.com.
112 IN PTR ns2.study.com.
113 IN PTR www.study.com.
114 IN PTR mail.study.com.
[root@localhost ~]# chmod :name /var/named/study.*
[root@localhost ~]# named-checkconf /etc/named.conf
[root@localhost ~]# systemctl restart named

112:

构建从服务器:

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0

[root@localhost ~]# vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.200.111
nameserver 192.168.200.112
[root@localhost ~]# vi /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 ~]# vi /etc/named.conf
options {
listen-on port 53 { 192.168.200.112; };
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";
allow-query { any; };
recursion yes;
};
zone "study.com" IN {
type slave;
file "slaves/study.zheng";
masters { 192.168.200.111; };
};
zone "200.168.192.in-addr.arpa" IN {
type slave;
file "slaves/study.fan";
masters { 192.168.200.111; };
};
[root@localhost ~]# systemctl restart named

 

113:

构建总服务器:

113:
[root@localhost ~]# fdisk /dev/sdb
[root@localhost ~]# fdisk /dev/sdc
[root@localhost ~]# fdisk /dev/sdd
[root@localhost ~]# mdadm -C /dev/md5 -l 5 -n 3 /dev/sd[bcd]1
[root@localhost ~]# pvcreate /dev/md5
[root@localhost ~]# vgcreate myvg /dev/md5
[root@localhost ~]# lvcreate -L 30G myvg -n mylv
[root@localhost ~]# mkfs.xfs /dev/myvg/mylv
[root@localhost ~]# tar xf httpd-2.2.17.tar.gz -C /usr/src/
[root@localhost ~]# cd /usr/src/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.conf {,.bak}
[root@localhost conf]# vi /usr/local/httpd/conf/httpd.conf
#ServerName www.example.com:80 ->ServerName www.example.com:80
[root@localhost ~]# /usr/local/httpd/bin/apachectl start
[root@localhost ~]# yum -y install lynx
[root@localhost ~]# mount -O usrquota,grpquota /dev/myvg/mylv /usr/local/httpd/htdocs
[root@localhost ~]# vi /etc/fstab
/dev/myvg/mylv /usr/local/httpd/htdocs ext4 defaults,usrquota,grpquota 0 0
[root@localhost ~]# mount -a
[root@localhost ~]# quotacheck -avug // 实在不行就reboot重启
[root@localhost ~]# quotaon -avug
[root@localhost ~]# useradd -d /usr/local/httpd/htdocs/lyq lyq
[root@localhost ~]# edquota -u lyq
/dev/mapper/myvg-mylv 16 81920 102400 4 80 100/dev/mapper/myvg-mylv 16 81920 102400 4 80 100

[root@localhost ~]# vi /usr/local/httpd/htdocs/index.html
<html>
<body>
<h1>LYQ</h1>
</body>
</html>
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0

 

上一篇:study 第一天


下一篇:别人家的博客