Rocky Linux 8.4にfirewalld設定方法

2021年12月8日

1.firewalld現在の設定の確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client ntp ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@localhost ~]# firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: ens33 sources: services: cockpit dhcpv6-client ntp ssh ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
[root@localhost ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources:
  services: cockpit dhcpv6-client ntp ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

2.HTTP(80/tcp)を許可する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[root@localhost ~]# firewall-cmd --add-port=80/tcp --permanent
success
HTTPS(443/tcp)を許可する
[root@localhost ~]# firewall-cmd --add-port=443/tcp --permanent
success
設定を読み込む
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]# firewall-cmd --add-port=80/tcp --permanent success HTTPS(443/tcp)を許可する [root@localhost ~]# firewall-cmd --add-port=443/tcp --permanent success 設定を読み込む [root@localhost ~]# firewall-cmd --reload success
[root@localhost ~]# firewall-cmd --add-port=80/tcp --permanent
success
HTTPS(443/tcp)を許可する
[root@localhost ~]# firewall-cmd --add-port=443/tcp --permanent
success

設定を読み込む
[root@localhost ~]# firewall-cmd --reload
success

3.firewalld設定の確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client ntp ssh
ports: 80/tcp 443/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@localhost ~]# firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: ens33 sources: services: cockpit dhcpv6-client ntp ssh ports: 80/tcp 443/tcp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
[root@localhost ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources:
  services: cockpit dhcpv6-client ntp ssh
  ports: 80/tcp 443/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

 

Rocky Linux 8

Posted by arkgame