承接国内外服务器租用托管、定制开发、网站代运营、网站seo优化托管接单、网站代更新,新老站点皆可!!咨询QQ:3787320601

linux基础:防火墙配置详细步骤

管理员 2023-08-22 08:02:54 互联网圈 0 ℃ 0 评论 4006字 收藏

前言

此实验准备两台虚拟机便于调试,一台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⑵12~]# curl -k https://10.1.1.211
Congratulation!

14.网页测试

到此这篇关于linux防火墙配置(基于yum仓的配置)详细步骤的文章就介绍到这了,更多相关linux防火墙配置内容请搜索之前的文章或继续浏览下面的相关文章希望大家以后多多支持!

文章来源:丸子建站

文章标题:linux基础:防火墙配置详细步骤

https://www.wanzijz.com/view/73248.html

相关文章

Related articles

X

截屏,微信识别二维码

微信号:weimawl

(点击微信号复制,添加好友)

打开微信