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"
相关推荐
bcbobo21cn2 小时前
初步了解Linux etc/profile文件
linux·运维·服务器·shell·profile
wayuncn2 小时前
月付物理服务器租用平台-青蛙云
运维·服务器·服务器租用·服务器托管·物理机租用
望获linux2 小时前
【实时Linux实战系列】CPU 隔离与屏蔽技术
java·linux·运维·服务器·操作系统·开源软件·嵌入式软件
0wioiw03 小时前
C#基础(项目结构和编译运行)
linux·运维·服务器
2401_873587824 小时前
Linux常见指令以及权限理解
linux·运维·服务器
晨曦丿5 小时前
双11服务器
linux·服务器·网络
wanhengidc6 小时前
UDP服务器主要是指什么意思?
服务器·网络协议·udp
李迟6 小时前
在Linux服务器上使用kvm创建虚拟机
java·linux·服务器
从后端到QT6 小时前
SRS流媒体服务器(8)源码分析之rtc/rtmp互相转码详解
运维·服务器·实时音视频
QMCY_jason6 小时前
linux 内存占用排查 vm.nr_hugepages
linux·运维·服务器