实验一,搭建一个基于https协议指定端口访问的web网站
搭建一个基于https://www.zuoye.com:22222访问的web网站,网站首页在/www/https/,内容为zuoye,可以根据https://www.zuoye.com:22222/mimi访问到的信息为mimi,该网站的实际内容在/www/secret,该网站的内容只有用户xiaoming能够查看。
#systemctl stop firewalld 关防火墙
#setenforce 0 设Selinux
安全套接层需要mod_ssl包  添加安全套接层SSL协议(make指令在rhel8无法配置https协议,需要在rhel7版本才能使用,以下仅介绍rhel8配置方法) rhel8安全套接层设定方法 。
# cd /etc/pki/tls/certs/
#/usr/bin/openssl genrsa -aes128 2048 > wenjian.key
# openssl req -utf8 -new -key wenjian.key -x509 -days 365 -out wenjianzhengshu.crt -set_serial 0
# chmod 600 *.crt 对certs目录下的所有证书文件改权限
#htpasswd -c /etc/httpd/mima/mima2 xiaoming
(为redhat用户创建一个在mima目录下的网页访问密码文件)

需要注意authuserfile要选择到普通文件,也就是要选择到为指定用户设的页面访问密码文件。在上面我指定了xiaoming用户的密码文件为mima2,所以新建配置文件中authuserfile要指定该文件的具体路径,否则会报错。
touch /etc/httpd/conf.d/vhost.conf
vim /etc/httpd/conf.d/vhost.conf
 重新加载httpd服务 (添加安全套接层ssl后需要输入密码来确认操作)  配置基本完成,但是要从客户端访问需要本地指定ip访问域名,所以接下来进入到以下路径进行添加,将网卡ip对应域名。 我虚拟机网卡ip是192.168.254.135/24所以用这个来对应域名
C:\Windows\System32\drivers\etc\hosts
 测试结果:  
实验二,搭建dhcp服务器
搭建dhcp服务器使其能够给172.24.8.0网段和192.168.168.0网段的主机分配ip地址,dhcp服务器可以给该网段的主机分配固定ip地址为172.24.8.8和192.168.168.168。

  
注意开头的是con-name要与后头的nmcli con-name对应起来  

 因为我在linux默认用了网络源,这里需要改为本地源装包,步骤如下(rhel8):
1.先挂载mount /dev/sr0 /mnt/
2.进入yum.repos.d目录新建本地源local.repos:
cd /etc/yum.repos.d/
touch local.repos
3.vim local.repos
local.repos文件内编写:
[Appstream]-任取但不能重复标识
name=appstream-标识名字任取
baseurl=file:///mnt/AppStream(含安装包路径)
gpgcheck=0
enable=1
[Baseos]-任取但不能重复标识
name=baseos-表示名字任取
baseurl=file:///mnt/BaseOS(含安装包路径)
gpgcheck=0
enable=1
rpm -qc指令查看主配置文件,确认为dhcpd.conf 
vim /etc/dhcp/dhcpd.conf 编辑dhcp主配置文件
根据主配置文件中的注释查询该文件内容模板 
option domain-name "xixi.com";
ddns-update-style interim;
ignore client-updates;
default-lease-time 2000;
max-lease-time 5000;
subnet 192.168.168.0 netmask 255.255.255.0 {
option domain-name-servers 192.168.168.2;
default-lease-time 2000;
max-lease-time 5000;
range 192.168.168.1 192.168.168.254;
}
subnet 172.24.8.0 netmask 255.255.255.0 {
option domain-name-servers 172.24.8.2;
default-lease-time 2000;
max-lease-time 5000;
range 172.24.8.1 172.24.8.254;
}
host gudin1{
hardware ethernet 00:0c:29:f6:f7:13;
fixed-address 192.168.168.168;
}
host gudin2{
hardware ethernet 00:0c:29:f6:f7:1d;
fixed-address 172.24.8.8;
}
systemctl restart dhcp 这个虚拟端dhcp服务器配置成功
然后来到另一个虚拟端主机(当作客户端)进行dhclient获取dhcp服务器分配的ip地址 得到结果 
|