在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
结束!