linux CentOS 7 开放/关闭端口,关闭防火墙

本文介绍了如何在Linux CentOS 7系统中进行端口的开放和关闭,以及如何管理和配置防火墙,以实现系统的安全设置。

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

CentOS 7 开放/关闭端口,关闭防火墙

常用的防火墙操作集合

# 永久的开放需要的端口
firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload

# 永久关闭某端口
firewall-cmd --remove-port=3000/tcp --permanent

# 检查防火墙规则
systemctl stop firewalld

# 临时关闭防火墙,重启后会重新自动打开
systemctl restart firewalld
# 检查防火墙状态
firewall-cmd --state
firewall-cmd --list-all
# Disable firewall
systemctl disable firewalld
systemctl status firewalld
# Enable firewall
systemctl enable firewalld
systemctl start firewalld
systemctl status firewalld

source: 根据源地址过滤(优先级最高)
interface: 根据网卡过滤(优先级次高)
service: 根据服务名过滤
po
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值