1.开放/nfs/upload目录,该目录为192.168.xxx.0/24网段的主机的数据
关闭防火墙和设置selinux为disabled
准备两台虚拟机,本实验虚拟机1为服务器(192.168.80.1), 虚拟机2为客户端(192.168.80.2).
两台机器都下载nfs-utils和rpcbind
[root@localhost ~]# yum install rpcbind
[root@localhost ~]# yum install nfs-utils
在服务端新建一个nfs服务器提供的目录/nfs/upload: mkdir -p /nfs/upload
[root@localhost ~]# mkdir -p /nfs/upload
编辑/etc/exports:vim /etc/exports
[root@localhost ~]# vim /etc/exports
编辑以下内容让80网段内的客户端可读可写:/etc/exports 192.168.80.0/24(rw)
/nfs/upload 192.168.80.0/24(rw)
重启服务(先rpcbind在nfs-server):systemctl restart rpcbind
systemctl restart nfs-server
[root@localhost ~]# systemctl restart rpcbind
[root@localhost ~]# systemctl restart nfs-server
查看挂载信息:showmount -e
[root@localhost ~]# showmount -e
在客户端创建一个名为ceshi的目录:mkdir /ceshi
[root@server ~]# mkdir /ceshi
在客户端将服务器的nfs挂载在ceshi目录下:mount 192.168.80.1:/nfs/upload /ceshi
[root@server ~]# mount 192.168.80.1:/nfs/upload /ceshi
进入到ceshi目录:cd /ceshi
[root@server ~]# cd /ceshi
创建一个文件,如果出现以下权限问题,是因为没有服务器没给/nfs/upload的权限:touch ceshi1
[root@server ceshi]# touch ceshi1
在服务端赋予该文件最高权限:chmod 777 /nfs/upload
[root@localhost ~]# chmod 777 /nfs/upload
再次返回到客户端的ceshi目录创建一个ceshi1的文件:touch ceshi1
[root@server ceshi]# touch ceshi1
在客户端查看创建的文件:ls -l
[root@server ceshi]# ls -l
在服务端/nfs/upload查看是否存在该文件: ls -l
[root@localhost upload]# ls -l
在该目录下创建ceshi2文件并查看: touch ceshi2
[root@localhost upload]# touch ceshi2
在客户端ceshi目录查看是否拥有创建成功:ls -l
[root@server ceshi]# ls -l
ceshi1 ceshi2
实验完成
2.配置dns正向解析
规划:
192.168.xxx.xxx dns1.abc.com主域名服务器(注意为真实的IP)
172.16.0.253 dns2.abc.com从域名服务器
172.16.0.100 fileserver.abc.com文件服务器
172.16.0.101 printserver.abc.com打印服务器
172.16.0.200 www.abc.com网站服务器
172.16.0.201 www.abc.com网站服务器
172.16.0.25 mail.abc.com邮件服务器
172.16.0.22 ntp.abc.com时间服务器
关闭防火墙和设置seliux为disabled
虚拟机一台,本实验用的为rocky(192.168.80.1)
下载bind
[root@localhost ~]# yum install bind -y
编辑/etc/named.conf文件:vim /etc/named.conf
[root@localhost ~]# vim /etc/named.conf
编辑以下内容:
(1) 修改解析的主机为自己
listen-on port 53 { 192.168.80.1; };
并且允许的用户为80网段的所有人
allow-query { 192.168.80.0/24; };
options{
listen-on port 53 {192.168.80.1; };
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";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query { 192.168.80.0/24; };
(2)修改区域配置文件,添加正向区域配置
zone “abc.com” IN{ #正向解析abc.com区域
type master; #类型为主区域服务器配置
file “abc.zone”; #指定区域解析文件为abc.zone
};
zone "abc.com" IN{
type master;
file "abc.zone";
};
进入到/var/named下:cd /var/named
[root@localhost ~]# cd /var/named/
创建并进去abc.zone文本:vim abc.zone
[root@localhost named]# vim abc.zone
编辑以下内容:
$TTL 1D
@ IN SOA dns1.abc.com. test.163.com (
0 ;serial #序列号,主从同步序列号越大代表越新
1D ;refresh #刷新时间
1H ;retry #请求dns请求不到重试时间间隔
1w ;expire #和主dns连接不上的时候,失效时间不在请求
3H ) ;minimum #最小的刷新时间
IN NS dns1.abc.com.
IN MX 10 mail.abc.com.
dns1.abc.com. IN A 192.168.80.1
dns2.abc.com. IN A 172.16.0.253
fileserver.abc.com. IN A 172.16.0.100
printserver.abc.com. IN A 172.16.0.101
www.abc.com. IN A 172.16.0.200
www.abc.com. IN A 172.16.0.201
mail.abc.com. IN A 172.16.0.25
ntp.abc.com. IN A 172.16.0.22
;CNAME: www,abc.com. -> web.abc.com.
web IN CNAME www #别名:web.abc.com
启动服务: systenctl restart named
[root@localhost named]# systenctl restart named
测试: nslookup dns1.abc.com 192.168.80.1
nslookup dns2.abc.com 192.168.80.1
nslookup fileserver.abc.com 192.168.80.1
nslookup printserver.abc.com 192.168.80.1
nslookup www.abc.com 192.168.80.1
nslookup www.abc.com 192.168.80.1
nslookup mail.abc.com 192.168.80.1
nslookup ntp.abc.com 192.168.80.1
[root@localhost ~]nslookup dns1.abc.com 192.168.80.1
Server: 192.168.80.1
Address: 192.168.80.1#53
Name: dns1.abc.com
Address: 192.168.80.1
[root@localhost ~]nslookup dns2.abc.com 192.168.80.1
Server: 192.168.80.1
Address: 192.168.80.1#53
Name: dns2.abc.com
Address: 172.16.0.253
[root@localhost ~]nslookup fileserver.abc.com 192.168.80.1
Server: 192.168.80.1
Address: 192.168.80.1#53
Name: fileserver.abc.com
Address: 172.16.0.100
[root@localhost ~]nslookup printserver.abc.com 192.168.80.1
Server: 192.168.80.1
Address: 192.168.80.1#53
Name: printserver.abc.com
Address: 172.16.0.101
完成