服务器安全设置Centos7 防火墙firewall与iptables

本文介绍了如何在CentOS 7系统中配置和管理防火墙,包括启用firewall防火墙,添加端口,以及切换到iptables防火墙的详细步骤。内容涉及关闭firewalld服务,安装iptables,设置出入站规则,并保存规则以确保下次启动时生效。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

一.>>>>>>启用centos7 iptables防火墙Centos7 防火墙firewall设置方法

我们Sinesafe在处理客户服务器Linux Centos7 64位系统里配置防火墙安全设置需要选择2种方案其中之一,最后选择了iptables防火墙。

因为在Centos 7版本里默认的防火墙是firewall,所以首先用firewall防火墙的话,下面就是配置方法:

# firewall-cmd --zone=public --add-port=8080/tcp --permanent #添加8080端口

# firewall-cmd --reload #重新加载策略配置,以使新配置生效

注:禁止firewall开机启动为:systemctldisable firewalld.service

1、运行、停止、禁用firewalld

启动:# systemctl start firewalld

查看状态:# systemctl status firewalld 或者 firewall-cmd --state

停止:# systemctl disable firewalld

禁用:# systemctl stop firewalld

关闭防火墙

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

开启端口

firewall-cmd --zone=public -

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值