1.首先查看防火墙状态
- running 代表已开启
- not running 代表没有开启
[root@localhost ~]# firewall-cmd --state
not running
2.开启防火墙
[root@localhost ~]# systemctl start firewalld
3.关闭防火墙
[root@localhost ~]#systemctl stop firewalld
4.重启防火墙
[root@localhost ~]# systemctl restart firewalld
5.设置防火墙开机自启
[root@localhost ~]# systemctl enable firewalld
6.设置开放端口
[root@localhost ~]# firewall-cmd --add-port=8080/tcp --permanent
7.查看已经开放的端口
[root@localhost ~]# firewall-cmd --list-port
8.设置开机禁止启动
[root@localhost ~]# systemctl disable firewalld.service
后续继续更新!!!!
记录学习~