随心所欲操作 Linux 防火墙

本文涉及的产品
云防火墙,500元 1000GB
简介: 操作 Linux 防火墙的方式

防火墙服务

# 其中 .service 都可以省略
# 启动防火墙服务
systemctl start firewalld.service
# 关闭防火墙服务
systemctl stop firewalld.service
# 重启防火墙服务
systemctl restart firewalld.service
# 查看防火墙服务状态
systemctl status firewalld.service
# 开机时启用防火墙服务
systemctl enable firewalld.service
# 开机时禁用防火墙服务
systemctl disable firewalld.service

查看防火墙规则


# 查看防火墙版本
firewall-cmd --version
# 查看防火墙状态
firewall-cmd --state
# 查看打开的端口
firewall-cmd --zone=public --list-ports


开启、关闭端口


# 示例:开启8080端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
# 示例:关闭8080端口
firewall-cmd --zone=public --remove-port=8080/tcp --permanent
# 开启或关闭端口后需要重启服务才能生效
--zone=public #作用域
--add-port=8080/tcp #开启端口(port/protocol)
--remove-port=8080/tcp #关闭端口(port/protocol)
--permanent #永久生效(否则重启即失效)


相关文章
|
2月前
|
安全 Linux 应用服务中间件
在Linux中,包过滤防火墙与代理应用防火墙有什么区别?有哪些相应的产品?
在Linux中,包过滤防火墙与代理应用防火墙有什么区别?有哪些相应的产品?
|
1月前
|
机器学习/深度学习 安全 网络协议
Linux防火墙iptables命令管理入门
本文介绍了关于Linux防火墙iptables命令管理入门的教程,涵盖了iptables的基本概念、语法格式、常用参数、基础查询操作以及链和规则管理等内容。
193 73
|
2月前
|
Linux 网络安全
linux关闭方防火墙的命令
linux关闭方防火墙的命令
50 2
|
2月前
|
Linux 网络安全
在Linux中,如何设置防火墙规则?
在Linux中,如何设置防火墙规则?
|
2月前
|
安全 Linux 测试技术
在Linux中,如何配置防火墙和安全规则?
在Linux中,如何配置防火墙和安全规则?
|
2月前
|
监控 安全 Linux
在Linux中,什么是入侵检测系统(IDS)和入侵防御系统(IPS)?
在Linux中,什么是入侵检测系统(IDS)和入侵防御系统(IPS)?
|
2月前
|
前端开发 Linux 网络安全
在Linux中,如何配置防火墙?
在Linux中,如何配置防火墙?
|
3月前
|
网络协议 Linux 网络安全
入职必会-开发环境搭建39-Linux常用操作-Linux防火墙操作
在CentOS 7中,新引入了firewalld服务(防火墙),取代了CentOS 6之前的iptables服务(防火墙)。
入职必会-开发环境搭建39-Linux常用操作-Linux防火墙操作
|
2月前
|
Linux 网络安全
在Linux中,iptables和firewalld两种防火墙如何使用?
在Linux中,iptables和firewalld两种防火墙如何使用?
|
2月前
|
监控 安全 Linux
在Linux中,如何使用Snort进行入侵检测和防御?
在Linux中,如何使用Snort进行入侵检测和防御?