LoginSignup
0
0

More than 1 year has passed since last update.

AlmaLinux9.0でfirewalld設定 (リッチルールでポート番号とサービス許可)

Posted at

firewalldで特定対象のポートとサービスをリッチルールで許可する場合のメモ。
同時に許可できず、別々に分けて許可する必要あり。

まずポート番号だけリッチルールで指定。

# firewall-cmd --permanent --zone=XXXX_Zone --add-rich-rule='rule family="ipv4" source address="XXX.XX.XXX.XXX" port port="XXXX" protocol="tcp" accept'

その後、同じ対象にサービス許可設定。

# firewall-cmd --permanent --zone=XXXX_Zone --add-rich-rule='rule family="ipv4" source address="XXX.XX.XXX.XXX" service name="XXXX" accept'

firewalldの再読み込み。

# firewall-cmd --reload

反映されている事を確認。

# firewall-cmd --list-all --zone=XXXX_Zone
XXXX_Zone (active)
  target: ACCEPT
  icmp-block-inversion: no
  interfaces: XXXXX
  sources:
  services:
  ports:
  protocols:
  forward: no
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
        rule family="ipv4" source address="XXX.XX.XXX.XXX" port port="XXXX" protocol="tcp" accept
        rule family="ipv4" source address="XXX.XX.XXX.XXX" service name="XXXX" accept

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0