firewalld服务正在运行,但firewall-cmd不起作用

我是Centos 7 / Serverpipe理新手。 我想弄清楚如何使用firewalld。 我的内核版本是:2.6.32-042stab084.20(OpenVZ)

和:

#firewall-cmd --version #0.3.9 

问题是我无法从firewall-cmd中获得任何function。 以下是我尝试过的一些命令:

 # systemctl status firewalld -l firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since ...; Main PID: 120 CGroup: /system.slice/firewalld.service └─120 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid systemd[1]: Starting firewalld - dynamic firewall daemon... systemd[1]: Started firewalld - dynamic firewall daemon. firewalld[120]: ERROR: ebtables not usable, disabling ethernet bridge firewall. firewalld[120]: ERROR: INVALID_ZONE 

看来firewalld正在运行,实际上它正在做防火墙的工作。 但是当我尝试使用firewall-cmd时:

 # firewall-cmd --state not running #firewall-cmd --get-zones #[nothing happens] #firewall-cmd --reload [X]Server crashed and I had to request a reboot! 

我已经安装了fail2ban,它通过添加IP到禁止列表,我可以查看:iptables -L -n。

 # iptables -V #iptables v1.4.21 # iptables -nvL Chain INPUT (policy ACCEPT 798 packets, 89141 bytes) pkts bytes target prot opt in out source destination 76260 14M f2b-SSH tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 69823 14M f2b-sshd tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 22 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 725 packets, 113K bytes) pkts bytes target prot opt in out source destination Chain INPUT_ZONES (0 references) pkts bytes target prot opt in out source destination Chain INPUT_ZONES_SOURCE (0 references) pkts bytes target prot opt in out source destination Chain INPUT_direct (0 references) pkts bytes target prot opt in out source destination Chain f2b-SSH (1 references) pkts bytes target prot opt in out source destination 17 1060 REJECT all -- * * 111.222.333.444 0.0.0.0/0 reject-with icmp-port-unreachable ... ... 

但是现在我想为应用程序打开一个特定的端口,我不能使用firewall-cmd。 那我能做什么?

  • PS:我将防火墙客户端更改为firewalld并禁用了iptables服务的原因是fail2ban不能和iptables一起使用。 它只是坐在那里,什么都没做。但这是另一个问题!

问题是你正在使用OpenVZ。 OpenVZ正在运行一个2.6内核,它没有firewalld守护进程所依赖的function,所有的systemd修改都被反向移植到了OpenVZ的sysvinit中。