centos7 4 防火牆的配置

2022-03-08 12:54:01 字數 1621 閱讀 1263

systemctl status firewalld.service 

● 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)

狀態選項:

firewall-cmd --state //防火牆的狀態:not running ,running

systemctl start firewalld.service //啟動防火牆

systemctl stop firewalld.service  //關閉防火牆

systemctl restart firewalld.service  //重啟防火牆

firewall-cmd --list-all   檢視防火牆規則

1)新增語法:firewall-cmd  --permanent --zone=public --add-port=[-]/

protocol:tcp,udp,sctp,dccp

說明如果沒有--permanent選項,系統重啟後新增的規則重置

例項:firewall-cmd--permanent --zone=public--add-port=9000/tcp //單一埠

firewall-cmd--permanent --zone=public--add-port=9000-9999/tcp //埠範圍

新增的規則如果立即生效需要執行:firewall-cmd --reload

2)移除語法:firewall-cmd--permanent --zone=public--remove-port=[-]/

protocol:tcp,udp,sctp,dccp

例項:firewall-cmd--permanent --zone=public--remove-port=9000/tcp //單一埠

firewall-cmd--permanent --zone=public--remove-port=9000-9999/tcp //埠範圍

移除的規則如果立即生效需要執行:firewall-cmd --reload

3)按埠查詢:firewall-cmd--permanent --zone=public--query-port=[-]/

返回值:yes/no

例項:firewall-cmd--permanent --zone=public--query-port=9000/tcp //單一埠 

firewall-cmd--permanent --zone=public--query-port=9000-9999/tcp //埠範圍

centOS 7 4 關閉防火牆

systemctl stop firewalld.service 停止firewall systemctl startfirewalld.service 啟動firewall systemctl disable firewalld.service 禁止firewall開機啟動 systemctl e...

Centos7 4防火牆firewalld相關操作

啟動 systemctl start firewalld 檢視狀態 systemctl status firewalld 停止 systemctl disable firewalld 禁用 systemctl stop firewalld 啟動乙個服務 systemctl start firewal...

新裝的centos7 4網絡卡防火牆時區設定

備註 本文件是基於centos7.4作業系統而寫 root localhost cat etc redhat release centos linux release 7.4.1708 core root localhost asia uname a linux localhost.localdom...