centos 安装防火墙,并开启对应端口号

1.查看防火墙状态:
命令:systemctl status firewalld.service
开启防火墙时,提示没有安装防火墙

[root@localhost ~]# systemctl start firewalld.service
Failed to start firewalld.service: Unit not found.

2.安装防火墙

[root@localhost ~]# yum install firewalld

2.开启防火墙

[root@localhost ~]# systemctl start firewalld.service

3.开启端口

[root@localhost ~]# firewall-cmd --add-port=5889/tcp --permanent
success

4.重启防火墙

[root@localhost ~]# firewall-cmd --reload
success

5.查看开启端口号

[root@localhost ~]# firewall-cmd --list-ports
5889/tcp

你可能感兴趣的:(centos,linux,运维)