Linux防火墙命令

开启防火墙

shell 复制代码
systemctl start firewalld

关闭防火墙

shell 复制代码
systemctl stop firewalld 	# 暂时关闭防火墙
systemctl disable firewalld # 永久关闭防火墙(禁用开机自启)
systemctl enable firewalld	# 永久开启防火墙(启用开机自启)

重启防火墙

shell 复制代码
systemctl restart firewalld

重载规则

shell 复制代码
firewall-cmd --reload

查看已配置规则

shell 复制代码
firewall-cmd --list-all

防火墙端口开放

shell 复制代码
firewall-cmd --zone=public --add-port=5672/tcp --permanent   	# 开放5672端口
firewall-cmd --zone=public --remove-port=5672/tcp --permanent  	#关闭5672端口
firewall-cmd --reload   										# 配置立即生效

查看防火墙所有开放的端口

shell 复制代码
firewall-cmd --zone=public --list-ports

指定端口和ip访问

shell 复制代码
firewall-cmd --permanent --add-rich-rule="rule famil="ipv4" source address="192.168.137.139" port protocol="tcp" port="8080" accept"

移除指定端口和ip访问

shell 复制代码
firewall-cmd --permanent --remove-rich-rule="rule famil="ipv4" source address="192.168.137.139" port protocol="tcp" port="8080" accept"
相关推荐
勤奋的凯尔森同学2 小时前
webmin配置终端显示样式,模仿UbuntuDesktop终端
linux·运维·服务器·ubuntu·webmin
丁卯4043 小时前
Go语言中使用viper绑定结构体和yaml文件信息时,标签的使用
服务器·后端·golang
chengooooooo3 小时前
苍穹外卖day8 地址上传 用户下单 订单支付
java·服务器·数据库
人间打气筒(Ada)5 小时前
MySQL主从架构
服务器·数据库·mysql
落笔画忧愁e5 小时前
FastGPT快速将消息发送至飞书
服务器·数据库·飞书
小冷爱学习!6 小时前
华为动态路由-OSPF-完全末梢区域
服务器·网络·华为
落幕7 小时前
C语言-进程
linux·运维·服务器
xmweisi10 小时前
【华为】报文统计的技术NetStream
运维·服务器·网络·华为认证
DC_BLOG10 小时前
Linux-GlusterFS进阶分布式卷
linux·运维·服务器·分布式
yourkin66610 小时前
TCP...
服务器·网络·tcp/ip