CentOSのファイアウォールを自動で再起動する方法を教えてください
CentOSファイアウォールを自動再起動するように設定するには、次の手順に従ってください:
- /etc/sysconfig/iptables
sudo vim /etc/sysconfig/iptables
- ファイル内の次の行が見つかりました:
# Save current firewall rules on stop.
# Firewall reloading on start is always performed regardless of the value of
# IPTABLES_SAVE_ON_RESTART.
IPTABLES_SAVE_ON_STOP="no"
- IPTABLES_SAVE_ON_STOP の値を 「yes」 に変更してファイルを保存します。
- iptablesサービスを再起動して設定を有効にする:
sudo systemctl restart iptables
CentOSファイアウォールは設定を完了すると、再起動時に保存していたルールを自動的にロードします。