- 查看防火墙状态:
systemctl status firewalld
- 开启防火墙:
systemctl start firewalld
- 临时关闭:
systemctl stop firewalld
- 永久关闭:
systemctl disable firewalld.service
- 临时开放端口:
firewall-cmd --zone=public --add-port=6379/tcp
- 永久开放端口:
firewall-cmd --zone=public --add-port=6379/tcp --permanent
- 查看已经在运行的端口号:
netstat -pltn
- 重新启动防火墙:
firewall-cmd --reload
- 查看端口是否开放:
firewall-cmd --zone=public --query-port=6379/tcp
- 启用区域端口和协议组合:
firewall-cmd [--zone=<zone>] --add-port=<port>[-<port>]/<protocol> [--timeout=<seconds>]