Linux下查看防火墙状态报错Unit iptables.service could not be found

原文链接:https://blog.csdn.net/sshuidajiao/article/details/82594504

linux下查看防火墙状态

[root@localhost src]# service iptables status

Redirecting to /bin/systemctl status  iptables.service
Unit iptables.service could not be found.
提示Redirecting to /bin/systemctl status  iptables.service Unit iptables.service could not be found.

在CentOS 7或RHEL 7中防火墙由firewalld来管理,

如果要添加范围例外端口 如 1000-2000
语法命令如下:启用区域端口和协议组合
firewall-cmd [–zone=] --add-port=[-]/ [–timeout=]
此举将启用端口和协议的组合。端口可以是一个单独的端口 或者是一个端口范围 - 。协议可以是 tcp 或 udp。
实际命令如下:

添加

firewall-cmd --zone=public --add-port=8088/tcp --permanent (--permanent永久生效,没有此参数重启后失效)

firewall-cmd --zone=public --add-port=1000-2000/tcp --permanent 

重新载入

firewall-cmd --reload

查看

firewall-cmd --zone=public --query-port=80/tcp

删除

firewall-cmd --zone=public --remove-port=80/tcp --permanent

猜你喜欢

转载自blog.csdn.net/liuguichenglove/article/details/84202116
今日推荐