1.搭建一个NFS服务器,客户端可以从该服务器的、share目录上传并下载文件
2.搭建一个web服务器,客户端通过www.haha.com访问该网站时能够看到内容:thisishaha
3.建立一个DNS服务器,客户端可以使用该服务器解析域名www.haha.com为web服务器的IP
4.将客户端的IP地址中的域名解析服务器地址修改为第三题的dns服务器的ip,使用ping命令ping www.haha.com看能否ping通,用curl www.haha,com看是否能看到内容
1.搭建一个NFS服务器
下载安装包
[root@server ~]# yum install rpcbind -y
[root@server ~]# yum install nfs-utils
服务端配置【服务端的IP地址192.168.154.141】
[root@server ~]# mkdir /share
[root@server ~]# vim /etc/exports
/share 192.168.154.143(rw)
[root@server ~]# chmod o+w /share/
[root@server ~]# systemctl disable firewalld --now
[root@server ~]# getenforce
Permissive
[root@server ~]# setenforce 0
[root@server ~]# systemctl restart nfs-server
[root@server ~]# showmount -e 192.168.154.141
Export list for 192.168.154.141:
/share 192.168.154.143
客户端配置【客户端IP地址192.168.154.143】
[root@client ~]# showmount -e 192.168.154.141
Export list for 192.168.154.141:
/share 192.168.154.143
[root@client ~]# mkdir -p /nfsclient/nfsclient-share/
[root@client ~]# mount 192.168.154.141:/share /nfsclient/nfsclient-share/
[root@client ~]# df -h
2.搭建一个web服务器
下载安装包Nginx
[root@server ~]# yum install nginx -y
添加IP地址并重新启动
[root@server ~]# nmtui
[root@server ~]# nmcli connection up ens160
创建目录,配置文件内容并写入网页内容
[root@server ~]# mkdir /www/haha
[root@server ~]# echo this is haha > /www/haha/index.html
[root@server ~]# vim /etc/nginx/conf.d/test_haha.conf
[root@server ~]# cat /etc/nginx/conf.d/test_haha.conf
server {
listen 192.168.154.21:80;
server_name www.haha.com;
root /www/haha/21;
location / {
}
}
[root@server ~]# vim /etc/hosts
[root@server ~]# cat /etc/hosts
192.168.154.21 www.haha.com
关掉防火墙,selinux,重启nginx服务
[root@server ~]# systemctl disable firewalld --now
[root@server ~]# setenforce 0
[root@server ~]# getenforce
Permissive
[root@server ~]# systemctl restart nginx
测试
[root@server ~]# curl 192.168.154.21
this is haha
3.建立一个DNS服务器
下载安装包:
[root@server ~]# yum install bind -y
主配置文件的操作如下:
[root@server ~]# vim /etc/named.conf
options{
listen-on port 53 {any;};
directory "/var/named";
};
zone "haha.com" IN {
type master;
file "named.haha.com";
};
文件资源记录:
[root@server ~]# vim /var/named/named.haha.com
$TTL 1D
@ IN SOA @ admin.haha.com. (0 1D 1H 1W 3H)
IN NS ns.haha.com.
IN MX 10 mail.haha.com.
ns IN A 192.168.154.141
mail IN A 192.168.154.21
www IN A 192.168.154.22
whaha IN CNAME www
[root@server ~]# systemctl restart named #重启系统
[root@server ~]# systemctl disable firewalld --now #关掉防火墙
[root@server ~]# setenforce 0 #关掉seliunx
客户端测试:
[root@client ~]# host www.haha.com 192.168.154.141
4.将客户端的IP地址中的域名解析服务器地址修改为第三题的dns服务器的ip
客户端服务器配置
[root@server ~]# yum install bind -y
[root@server ~]# rpm -ql bind
/etc/named.conf
/var/named/slaves
[root@server ~]# vim /etc/name.conf
[root@server ~]# vim /etc/named.conf
[root@server ~]# cat /etc/named.conf
options{
listen-on port 53 {any;};
directory "/var/named";
};
zone "haha.com" IN {
type master;
file "named.haha.com";
};
[root@server ~]# vim /var/named/named.haha.com
[root@server ~]# cat /var/named/named.haha.com
$TTL 1D
@ IN SOA @ admin.haha.com. (0 1D 1H 1W 3H)
IN NS ns.haha.com.
IN MX 10 main.haha.com.
ns IN A 192.168.154.141
main IN A 192.168.154.10
www IN A 192.168.154.22
whaha IN CNAME www
[root@server ~]# systemctl restart named
[root@server ~]# systemctl disable firewalld --now
[root@server ~]# setenforce 0
[root@server ~]# getenforce
Permissive
服务端服务器测试
[root@client ~]# ping www.haha.com
[root@client ~]# curl www.haha.com