liunx命令—防火墙操作
1.查看防火墙状态:systemctl status firewalld、firewall-cmd --state
2. 暂时关闭防火墙:systemctl stop firewalld
3. 永久关闭防火墙:systemctl disable firewalld
4. 开启防火墙:systemctl start firewalld
5. 开放指定端口:firewall-cmd --zone=public --add-port=8080/tcp --permanent
6. 关闭指定端口:firewall-cmd --zone=public --remove-port=8080/tcp --permanent
7. 立即生效:firewall-cmd --reload
8. 查看开放端口:firewall-cmd --zone=public --list-prots
注:
1.systemctl是管理liunx中服务的命令,可以对服务进行启动、停止、重启、查看状态等操作
2.firewall-cmd是liunx中专门用于控制防火墙的命令