Linux下檢視防火牆狀態報錯Unit iptables.service could not be found
阿新 • • 發佈:2018-11-19
原文連結:https://blog.csdn.net/sshuidajiao/article/details/82594504
linux下檢視防火牆狀態
[[email protected] 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