任务1:画出vmware workstation的三种网络连接模式图,并给三个不同模式的网卡配置相应的ip参数并远程连接,测试哪种网络模式可以上网。
任务2:搭建一个基于https://www.zuoye.com:22222访问的web网站,网站首页在/www/https/,内容为zuoye
任务1:三种网络连接模式
NAT模式:
NAT模式下的网络连接模式图
通过此命令来查看当前网卡的配置信息
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
远程连接上虚拟机并能访问外网上网通信
仅主机模式
仅主机模式的网络连接图
仅主机模式下也是通过DHCP自动获取地址
但不能访问外网
桥接模式
桥接模式下的网络连接图
进入该配置进行配置IP参数信息
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
任务2:https网站搭建
搭建一个基于https://www.zuoye.com:22222访问的web网站,网站首页在/www/https/,内容为zuoye
步骤:
1.安装密码保护软件包
[root@localhost ~]# yum install mod_ssl -y
2.进入证书目录,创建密匙密码,
[root@localhost ~]# cd /etc/pki/tls/certs/
[root@localhost certs]# openssl genrsa -aes128 2048 > openlab.key
Generating RSA private key, 2048 bit long modulus (2 primes)
.+++++
............................................................................................................................................................+++++
e is 65537 (0x010001)
Enter pass phrase:
Verifying - Enter pass phrase:
3.创建安全证书
[root@localhost certs]# openssl req -utf8 -new -key openlab.key -x509 -days 365 -out openlab.crt
Enter pass phrase for openlab.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:xa
State or Province Name (full name) []:xa
Locality Name (eg, city) [Default City]:xa
Organization Name (eg, company) [Default Company Ltd]:xa
Organizational Unit Name (eg, section) []:xa
Common Name (eg, your name or your server's hostname) []:xian
Email Address []:admin@haha.com
[root@localhost certs]# vim /etc/httpd/conf.d/vhosts.conf
[root@localhost certs]# systemctl restart httpd
Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xe" for details.
4.进入http子配置文件配置网页信息
[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf
Listen 22222
<VirtualHost 192.168.223.128:22222>
ServerName 192.168.223.128
DocumentRoot /www/https
SSLEngine 'on'
SSLCertificateFile /etc/pki/tls/certs/openlab.crt
SSLCertificateKeyFile /etc/pki/tls/certs/openlab.key
</VirtualHost>
<Directory /www/https>
AllowOverride none
Require all granted
</Directory>
~
5.进入主机的hosts文件中添加IP和域名(hosts文件位于 C:\Windows\System32\drivers\etc)
6.访问该网站信息显示
任务完成