ファイアウォールのインストール
ファイアウォールがインストールされていなければ、以下のコマンドを実行します。
sudo dnf install firewalld
コマンド
起動・終了
# 起動
sudo systemctl start firewalld
# 終了
sudo systemctl stop firewalld
状態の確認
sudo systemctl status firewalld
自動起動の有効・無効化
# 自動起動の有効
sudo systemctl enable firewalld
# 自動起動の無効
sudo systemctl disable firewalld
パッケージの詳細情報
sudo dnf info firewalld
# 結果
名前 : firewalld
バージョン : 1.3.4
リリース : 1.el9
Arch : noarch
サイズ : 2.0 M
ソース : firewalld-1.3.4-1.el9.src.rpm
リポジトリー : @System
repo から : anaconda
概要 : A firewall daemon with D-Bus interface providing a dynamic firewall
URL : http://www.firewalld.org
ライセンス : GPLv2+
説明 : firewalld is a firewall service daemon that provides a dynamic customizable
: firewall with a D-Bus interface.
利用可能なパッケージ
名前 : firewalld
バージョン : 1.3.4
リリース : 9.el9_5
Arch : noarch
サイズ : 452 k
ソース : firewalld-1.3.4-9.el9_5.src.rpm
リポジトリー : baseos
概要 : A firewall daemon with D-Bus interface providing a dynamic firewall
URL : http://www.firewalld.org
ライセンス : GPLv2+
説明 : firewalld is a firewall service daemon that provides a dynamic customizable
: firewall with a D-Bus interface.
firewall-cmd
設定を変更した後は、リロードをして反映させます。
# リロード
sudo firewall-cmd --reload
# ゾーンの設定確認
sudo firewall-cmd --list-all
# バージョン情報の確認
sudo firewall-cmd --version
ポートの解放
# Apache
sudo firewall-cmd --permanent --add-service=http --zone=public
sudo firewall-cmd --permanent --add-service=https --zone=public
# OpenSSH
sudo firewall-cmd --permanent --add-service=ssh --zone=public
# 3000 番のポートを解放
sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
サービス・ポートの削除
# サービス削除
sudo firewall-cmd --permanent --remove-service=httpd
# ポート番号の削除
sudo firewall-cmd --permanent --remove-port=10022/tcp