作业
DNS解析综合学习案例
1、用户需把/dev/myvg/mylv逻辑卷以支持磁盘配额的方式挂载到网页目录下
[root@ns1 ~]# cat /etc/fstab
/dev/myvg/mylv /usr/local/apache/htdocs/ xfs defaults,usrquota 0 0
[root@ns1 ~]# df -Th
/dev/mapper/myvg-mylv xfs 20G 33M 20G 1% /usr/local/apache/htdocs
2、在网页目录下创建测试文件index.html,内容为用户名称,通过浏览器访问测试
3、创建用户账户,对LVM配置磁盘配额限制用户磁盘容量为软限制80M;硬限制100M、文件数量软限制为80个;硬限制为100个。
[root@ns1 ~]# repquota -avug
*** Report for user quotas on device /dev/mapper/myvg-mylv
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 4 0 0 4 0 0
dd -- 0 80000 100000 0 80 100
Accounting: ON; Enforcement: ON
Inode: #1027 (2 blocks, 2 extents)
4、构建主从DNS域名解析环境
主服务器
[root@ns1 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.135.100
nameserver 192.168.135.112
[root@ns1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.135.100 ns1.study.com
192.168.135.112 ns2.study.com
[root@ns1 ~]# cat /etc/named.conf
options {
directory "/var/named";
allow-query { any; };
forwarders { 202.106.0.20; };
recursion yes;
};
zone "study.com" IN {
type master;
file "study.zheng";
allow-transfer { 192.168.135.112; };
};
zone "135.168.192.in-addr.arpa" IN {
type master;
file "study.fan";
allow-transfer { 192.168.135.112; };
};
[root@ns1 ~]# cat /var/named/study.zheng 正向解析
$TTL 86400
@ IN SOA study.com. root.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.135.100
ns2 IN A 192.168.135.112
mail IN A 192.168.200.114
www IN A 192.168.135.100
* IN A 192.168.135.113
[root@ns1 ~]# cat /var/named/study.fan 反向解析
$TTL 86400
@ IN SOA study.com. root.study.com.(
20190819
3H
15M
1W
1D
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 mail.study.com.
100 IN PTR ns1.study.com.
112 IN PTR ns2.study.com.
114 IN PTR mail.study.com.
100 IN PTR www.study.com.
113 IN PTR www.study.com.
从服务器
[root@ns2 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.135.100
nameserver 192.168.135.112
[root@ns2 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.135.100 ns1.study.com
192.168.135.112 ns2.study.com
[root@ns2 ~]# cat /etc/named.conf
options {
directory "/var/named";
};
zone "study.com" IN {
type slave;
file "slaves/study.zheng";
masters { 192.168.135.100; };
};
zone "135.168.192.in-addr.arpa" IN {
type slave;
file "slaves/study.fan";
masters { 192.168.135.100; };
};
5、主从DNS都可将www.study.com域名解析为192.168.200.113
6、客户机可通过浏览器访问www.study.com得到WEB服务器相应内容
6、主域名服务器要同时担任缓存域名服务器功能
[root@ns1 ~]# cat /etc/named.conf
options {
directory "/var/named";
allow-query { any; };
forwarders { 202.106.0.20; };
recursion yes;
};
7、客户机通过nslookup域名测试工具可解析到www.jd.com等网站的域名解析结果