Linux防火墙firewalld指南


firewalld

(docker容器-p映射端口时会穿透firewalld导致配置失效)

查看防火墙状态

systemctl status firewalld

开启防火墙

systemctl start firewalld

关闭防火墙

systemctl stop firewalld

开放端口

1
2
firewall-cmd --permanent --zone=public \
--add-port=80/tcp

删除开放端口

1
2
firewall-cmd --permanent --zone=public \
--remove-port=80/tcp

查看所有开放的端口

firewall-cmd --list-ports

加载配置

firewall-cmd --reload

增加对指定ip开放的端口

1
2
3
4
firewall-cmd --permanent \
--add-rich-rule="rule family="ipv4" \
source address="183.134.220.130" \
port protocol="tcp" port="3306" accept"

查看所有配置

firewall-cmd --list-all

删除对指定ip开放的端口

1
2
3
4
firewall-cmd --permanent \
--remove-rich-rule="rule family="ipv4" \
source address="183.134.220.130" \
port protocol="tcp" port="3306" accept"

← Prev Spring AOP实现接口日志 | Spring Security项目搭建 Next →