CentOS7 firewall 開放埠和關閉防火牆
阿新 • • 發佈:2019-01-04
CentOS7開放埠,過載防火牆配置
sudo firewall-cmd --zone=public --add-port=6379/tcp --permanent
sudo firewall-cmd --reload
檢查防火牆規則命令
firewall-cmd --list-all
會顯示:
public (active) # 狀態 target: default icmp-block-inversion: no interfaces: ens33 #介面資訊 sources: services: ssh dhcpv6-client #開放服務 ports: 6379/tcp # 開放埠 protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
其他命令:
# 重啟防火牆 systemctl restart firewalld # 檢查狀態 firewall-cmd --state firewall-cmd --list-all #禁用 firewall systemctl disable firewalld systemctl stop firewalld # 查詢防火牆狀態 systemctl status firewalld #啟用防火牆 systemctl enable firewalld systemctl start firewalld # 查詢防火牆狀態 systemctl status firewalld