CentOS7關於防火牆的一些常用命令

2021-08-16 19:18:03 字數 1438 閱讀 1048

1、firewalld的基本使用

啟動: systemctl start firewalld

檢視狀態: systemctl status firewalld 

停止: systemctl disable firewalld

禁用: systemctl stop firewalld

2.systemctl是centos7的服務管理工具中主要的工具,它融合之前service和chkconfig的功能於一體。

啟動乙個服務:systemctl start firewalld.service

關閉乙個服務:systemctl stop firewalld.service

重啟乙個服務:systemctl restart firewalld.service

顯示乙個服務的狀態:systemctl status firewalld.service

在開機時啟用乙個服務:systemctl enable firewalld.service

在開機時禁用乙個服務:systemctl disable firewalld.service

檢視服務是否開機啟動:systemctl is-enabled firewalld.service

檢視已啟動的服務列表:systemctl list-unit-files|grep enabled

檢視啟動失敗的服務列表:systemctl --failed

3.配置firewalld-cmd

檢視版本: firewall-cmd --version

檢視幫助: firewall-cmd --help

顯示狀態: firewall-cmd --state

檢視所有開啟的埠: firewall-cmd --zone=public --list-ports

更新防火牆規則: firewall-cmd --reload

檢視區域資訊:  firewall-cmd --get-active-zones

檢視指定介面所屬區域: firewall-cmd --get-zone-of-inte***ce=eth0

拒絕所有包:firewall-cmd --panic-on

取消拒絕狀態: firewall-cmd --panic-off

檢視是否拒絕: firewall-cmd --query-panic

那怎麼開啟乙個埠呢

新增firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,沒有此引數重啟後失效)

重新載入

firewall-cmd --reload

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

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

centos7關於防火牆的一些操作

檢查防火牆狀態 systemctl status firewalld 開啟防火牆 systemctl start firewalld 關閉防火牆 systemctl stop firewalld 防火牆開放埠 firewall cmd add port 80 tcp permanent firewa...

centos7關於防火牆的一些常見命令

1 檢視firewall防火牆狀態 firewall cmd state 或者systemctl status firewalld 2 開啟防火牆 systemctl start firewalld 3 關閉防火牆 systemctl stop firewalld 4 重啟防火牆 firewall ...

Centos7 關於防火牆的一些簡單配置

近期安裝了linux系統centos7,接觸下來發現了與原來的centos6.5有一些差別,這裡主要記錄下來我的一些關於centos7防火牆的了解。一 firewall簡介 centos 7中防火牆是乙個非常的強大的功能,在centos 6.5中在iptables防火牆中進行了公升級了。在cento...