Linux:CentOS-7 防火墙命令行操作
查看防火墙状态
# 显示防火墙状态
firewall-cmd --state
# 或
systemctl status firewalld
开机自启防火墙
systemctl enable firewalld
禁止防火墙开机自启
systemctl disable firewalld
临时开启防火墙
systemctl start firewalld
临时停止防火墙
systemctl stop firewalld
查看已开放的端口
firewall-cmd --list-ports
开放端口(开放后需要要重启防火墙才生效)
firewall-cmd --zone=public --add-port=3338/tcp --permanent
关闭端口(关闭后需要要重启防火墙才生效)
firewall-cmd --zone=public --remove-port=3338/tcp --permanent
重启防火墙
firewall-cmd --reload
-----------------------------------
作者:怒吼的萝卜
链接:http://www.cnblogs.com/nhdlb/
-----------------------------------