防火墙配置(基于yum仓的配置)(此实验准备两台虚拟机便于调试,一台CentOs6,一台红帽6)

1.首先确保yum仓的配置是否完好(CentOs6)

 2.要求在centOs6中安装httpd和mod_ssl软件包

[root@cento211 yum.repos.d]# yum -y install httpd mod_ssl

3.在CentOs6中启用httpd.service并使其开机自启

[root@cento211 ~]# systemctl enable httpd.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

[root@cento211 ~]# systemctl start httpd.service

4.在web内容的开发者完成Web应用之前,使用Congratulation!来提供占位符页面

[root@cento211 ~]# vim /var/www/html/index.html
 
Congratulation!

查看应用web页面的编辑内容

[root@cento211 ~]# cat /var/www/html/index.html 
Congratulation!

5.启用和启动firewalld服务

[root@cento211 ~]# systemctl is-enabled firewalld
enabled

6.在CentOs6上的firewalld配置对所有未指定连接使用dmz区域

(1).首先看Firewalld的默认区域

[root@cento211 ~]# firewall-cmd --get-default 
public (是默认的public区域)

(2).使用dmz区域

[root@cento211 ~]# firewall-cmd --set-default-zone=dmz 
success

(3).查看此时的默认区域

[root@cento211 ~]# firewall-cmd --get-default 
dmz

7.打开两台虚拟机,分别查看虚拟机地址

8.来自子网10.1.1.0/24网段的流量路由到work区域

[root@cento211 ~]# firewall-cmd --permanent --add-source=10.1.1.0/24 --zone=work 
success

9.重置

[root@cento211 ~]# firewall-cmd --reload 
success

10.查看此时的source

[root@cento211 ~]# firewall-cmd --list-all --zone=work 
work (active)
  target: default
  icmp-block-inversion: no
  interfaces: 
  sources: 10.1.1.0/24 (这个就是我们配置的地址)
  services: dhcpv6-client ssh
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:

11.work区域应打开Https需要的所有端口,并且对所有未加密的http流量进行过滤

(1).首先打开Https服务

[root@cento211 ~]# firewall-cmd --permanent --add-service=https --zone work 
success

(2).重置

[root@cento211 ~]# firewall-cmd --reload 
success

(3).查看此服务被启用

12.在另一台虚拟机红帽6上查看yum仓是否完好

 

13.在红帽6中使用curl 来对服务器进行测试,测试https://10.1.1.211

[root@centos6-212~]# curl -k https://10.1.1.211
Congratulation!

14.网页测试

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

会写代码的丑小鸭~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值