centos8默认的防火墙是firewalld工具,所以使用方法就很简单了
[root@centos8 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-10-17 23:58:48 CST; 7s ago
Docs: man:firewalld(1)
Main PID: 7592 (firewalld)
Tasks: 2 (limit: 11357)
Memory: 20.6M
CGroup: /system.slice/firewalld.service
└─7592 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid
10月 17 23:58:48 centos8 systemd[1]: Starting firewalld - dynamic firewall daemon...
10月 17 23:58:48 centos8 systemd[1]: Started firewalld - dynamic firewall daemon.
具体的几个使用方法
systemctl stop firewalld.service
那怎么开启一个端口呢
添加 firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
查看所有打开的端口: firewall-cmd --zone=public --list-ports
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone=public --query-port=80/tcp
删除
firewall-cmd --zone=public --remove-port=80/tcp --permanent
登录过307天