systemctl命令
1.启动防火墙
systemctl start firewalld
2.关闭防火墙
systemctl stop firewalld
3.重启防火墙
systemctl restart firewalld
4.查看防火墙状态
systemctl status firewalld
5.开机启用防火墙
systemctl enable firewalld
6.开机禁用防火墙
systemctl disable firewalld
firewall-cmd命令
1.开启80端口
firewall-cmd --zone=public --add-port=80/tcp 重启后失效
firewall-cmd --zone=public --add-port=80/tcp --permanent 重启后不失效(永久失效)
2.关闭80端口
firewall-cmd --zone=public --remove-port=80/tcp 重启后失效
firewall-cmd --zone=public --remove-port=80/tcp --permanent 重启后不失效(永久失效)
3.查看80端口
firewall-cmd --zone=public --query-port=80/tcp
4.查看所有打开的端口
firewall-cmd --zone=public --list-ports
网友评论