2021-07-27RHCE第二天

桥接模式

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
查看主机的ip地址、网关、DNS等信息
进入系统编辑网卡配置文件
命令为vi /etc/sysconfig/network-scripts/ifcfg-eth0

虚拟机网卡配置文件内容:
设置虚拟机ip地址,与主机ip地址在同一网段
设置子网掩码
设置虚拟机网关,与主机相同
设置虚拟机DNS,与主机相同
编辑完成,保存退出,然后重启虚拟机网卡,使用ping命令ping外网ip,测试能否联网。

NAT
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
开机启动系统,编辑网卡配置文件,命令为vi /etc/sysconfig/network-scripts/ifcfg-eth0
编辑完成,保存退出,然后重启虚拟机网卡,使用ping命令ping外网ip,测试能否联网。

仅主机
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
开机启动系统,然后设置网卡文件。
保存退出,然后重启网卡,利用远程工具测试能否与主机通信。
重新配置网卡,将虚拟网卡作为虚拟机的路由。
重启网卡,然后通过 远程工具测试能否联通外网以及与主机通信。

搭建一个基于https:///www.zuoye.com:22222访问的web 网站,网站首页在/www/https/,内容为zuoye
搭建之前确保光盘已挂载,并且yum源已写好
安装httpd 、mod_ssl包
[root@localhost ~]# yum httpd -y
[root@localhost ~]# yum install mod_ssl -y
切换到/etc/httpd/conf.d目录下
[root@localhost certs]# cd /etc/httpd/conf.d
安装mod_ssl 包,安装lrzsz包
[root@localhost conf.d]# yum install mod_ssl -y
[root@localhost certs]# yum install lrzsz -y
新建IP 并激活
创建并编辑 vhost-https.conf 文件
[root@localhost conf.d]# vim vhost-https.conf
创建证书文件
先切换到 /etc/pki/tls/certs/ 目录
[root@localhost ~]# cd /etc/pki/tls/certs/
创建一个私钥文件 https.key
[root@localhost certs]# openssl genrsa -aes128 2048 > http.key
再创建一个于私钥匹配的公钥文件,制作成证书
[root@localhost certs]# openssl req -utf8 -new -key https.key -x509 -days 365 -out https.crt -set_serial 0

重新切换到/etc/httpd/conf.d目录下,编辑vhost-https.conf文件
[root@localhost certs]# cd -/etc/httpd/conf.d
[root@localhost conf.d]# vim vhost-https.conf
创建目录
[root@localhost conf.d]# mkdir /www/https
[root@localhost conf.d]# mkdir /usr/local/secret
创建认证文件
[root@localhost conf.d]# htpasswd -c /etc/httpd/renzheng xiaoming
New password:
Re-type new password:
Adding password for user xiaoming
[root@localhost conf.d]# cat /etc/httpd/renzheng xiaoming
写index文件
[root@localhost conf.d]# echo zuoye >//www/https/index.html
[root@localhost conf.d]# echo mimi >/usr/local/secret/index.html
重启
[root@locahost~]#systemctl restart httpd
访问
https://192.168.218.128:22222

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值