菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
441
0

FirewallD is not running

原创
05/13 14:22
阅读数 76994

在linux开放6379端口时,提示 FirewallD is not running,发现防火墙没有开启。

问题发现

[root@VM_0_9_centos redis-4.0.8]#  firewall-cmd --zone=public --add-port=6379/tcp --permanent
FirewallD is not running

查看防火墙状态

[root@VM_0_9_centos redis-4.0.8]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

发现当前是dead状态,即防火墙未开启。

开启防火墙

[root@VM_0_9_centos redis-4.0.8]# systemctl start firewalld

没有任何提示,表示开启成功。

检查防火墙状态

[root@VM_0_9_centos redis-4.0.8]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-10-27 16:28:08 CST; 11s ago
     Docs: man:firewalld(1)
 Main PID: 32232 (firewalld)
    Tasks: 2
   Memory: 32.0M
   CGroup: /system.slice/firewalld.service
           └─32232 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Oct 27 16:28:08 VM_0_9_centos systemd[1]: Starting firewalld - dynamic firewall daemon...
Oct 27 16:28:08 VM_0_9_centos systemd[1]: Started firewalld - dynamic firewall daemon.

防火墙开启成功。

关闭防火墙

[root@VM_0_9_centos redis-4.0.8]# systemctl stop firewalld

再次开放6379端口

[root@VM_0_9_centos redis-4.0.8]# firewall-cmd --zone=public --add-port=6379/tcp --permanent
success

重启防火墙使配置即使生效

[root@VM_0_9_centos redis-4.0.8]# systemctl restart firewalld

查看系统所开放的端口

[root@VM_0_9_centos redis-4.0.8]# firewall-cmd --zone=public --list-ports
6379/tcp

结束!

发表评论

0/200
441 点赞
0 评论
收藏