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防火牆相關設定
最近由於工作需要,在伺服器上部署cloud專案,一台嶄新的centos7測試伺服器,當註冊中心啟動後無法訪問,第乙個感覺應該是埠未開放,經查詢果然防火牆開全狀態且沒有任何開放埠,一般碰到這樣情況,為了圖個簡單,直接關閉防火牆即可,不過出於對伺服器安全考慮,最安全的做法肯定是開啟特定埠訪問,於是乎就現...
Centos7防火牆相關
在新安裝的linux系統中,防火牆預設是被禁掉的,一般也沒有配置過任何防火牆的策略,所有不存在 etc sysconfig iptables檔案。解決辦法 1.新建立此檔案 vim etc sysconfig iptables root localhost vim etc sysconfig ipt...
Centos 7 設定防火牆
centos 7 firewall 命令 檢視已經開放的埠 firewall cmd list ports開啟埠 firewall cmd zone public add port 80 tcp permanent命令含義 zone 作用域 add port 80 tcp 新增埠,格式為 埠 通訊協...