防火牆設定

  1. 查看目前防火牆。
    [root@kvm3 ~]# firewall-cmd --list-all
    public (default, active)
      target: default
      ingress-priority: 0
      egress-priority: 0
      icmp-block-inversion: no
      interfaces: enp1s0
      sources:
      services: cockpit dhcpv6-client ssh
      ports: 3306/tcp
      protocols:
      forward: yes
      masquerade: no
      forward-ports:
      source-ports:
      icmp-blocks:
      rich rules:
    
  2. 增加開機開放 httpd 服務。
    [root@kvm3 ~]# firewall-cmd --permanent --add-service=http
    success
    
  3. 重新載入防火牆設定。
    [root@kvm3 ~]# firewall-cmd --reload 
    success
    
  4. 再查詢防火牆,已加入 httpd 服務。
    [root@kvm3 ~]# firewall-cmd --list-all
    public (default, active)
      target: default
      ingress-priority: 0
      egress-priority: 0
      icmp-block-inversion: no
      interfaces: enp1s0
      sources:
      services: cockpit dhcpv6-client http ssh
      ports: 3306/tcp
      protocols:
      forward: yes
      masquerade: no
      forward-ports:
      source-ports:
      icmp-blocks:
      rich rules:
    
  5. 登出 kvm3,回到 host deyu.wang。
    [root@kvm3 ~]# exit
    logout
    Connection to kvm3 closed.
    
  6. 從 deyu.wang 主機必須可以連線 http://kvm3.deyu.wang,出現 AlmaLinux 的測試頁面,以下過濾 AlmaLinux 字串,且只顯示兩行。
    [dywang@deyu ~]# curl -s http://kvm3.deyu.wang/ | grep -m2 AlmaLinux
    		<title>Test Page for the HTTP Server on AlmaLinux</title>
                <img src="system_noindex_logo.png" alt="AlmaLinux Logo" /><br />