経緯
yum update で CentOS 7.6 から 7.7 にアップデートしている途中で、
なぜかネットワークが切断しました。
リモート接続はあきらめ、サーバに直接ディスプレイ等をつなげて確認すると、
以下のようなことが分かりました。
● アップデート ( yum update ) 自体は正常終了している。
● firewalld がバージョンアップしたが、その再起動でエラーが発生した。
/var/log/messages
Oct 2 10:35:30 xxxxxxxx firewalld[10315]: ERROR: argument of type 'Rich_Destination' is not iterable
Oct 2 10:35:30 xxxxxxxx firewalld[10315]: ERROR: COMMAND_FAILED: argument of type 'Rich_Destination' is not iterable
Oct 2 10:35:30 xxxxxxxx firewalld[10315]: ERROR: '/usr/sbin/iptables-restore -w -n' failed: iptables-restore v1.4.21: goto 'FWDI_public' is not a chain#012#012Error occurred at line: 2#012Try `iptables-restore -h' or 'iptables-restore --help' for more information.
Oct 2 10:35:30 xxxxxxxx firewalld[10315]: ERROR: '/usr/sbin/ip6tables-restore -w -n' failed: ip6tables-restore v1.4.21: goto 'FWDI_public' is not a chain#012#012Error occurred at line: 9#012Try `ip6tables-restore -h' or 'ip6tables-restore --help' for more information.
Oct 2 10:35:30 xxxxxxxx firewalld[10315]: ERROR: COMMAND_FAILED: '/usr/sbin/ip6tables-restore -w -n' failed: ip6tables-restore v1.4.21: goto 'FWDI_public' is not a chain#012#012Error occurred at line: 9#012Try `ip6tables-restore -h' or 'ip6tables-restore --help' for more information.
ネットワークが落ちているわけではありません。
ネットワークは起動しているけど、firewalld の zone=public の情報が取れなくて、
結果的に外部からのアクセスを遮断しているように見えました。
(ちなみにサーバから外部への ping は通りました。)
さらに以下のURLによると、zone=public にリッチルール ( rich rule ) が設定されていると、
今回の現象が起きるようです。
https://bugs.centos.org/view.php?id=16425
https://access.redhat.com/solutions/4284811
https://bugzilla.redhat.com/show_bug.cgi?id=1715977
結局 firewalld のバグが原因で、ネットワーク不通になったようです。
暫定復旧
いち早くネットワークを復旧するには、リッチルールを削除します。
firewall-cmd コマンドでも消せるはずですが、
その時おこなったのは、ファイルの編集でした。
/etc/firewalld/zones/public.xml
vi コマンドで、rule タグを全部 消しました。
そしてサーバを再起動しました。
(もしかしたらサーバ再起動でなく、firewalld の再起動だけで
よかったかもしれませんが、それは試していません。)
これでネットワークは復旧するはずです。
(リッチルールは、ひとまず あきらめる。)
firewalld バージョンダウン
firewalld のバグ修正を待っていられないので、前のバージョンに戻します。
(10/7 現在、CentOS7 で yum check-update で確認しましたが、
バグ修正版は出ていないようでした。)
yum update 後は、0.6.3-2.el7_7.1 がインストールされているので、
0.5.3-5.el7 にバージョンダウンします。
(ウチのサーバでは、以下の3ファイル適用でOKでしたが、
各環境に置き換えて試してください。)
● インストール済みの firewall 関連を確認する
yum list installed *firewall*
● 旧 firewalld のダウンロード
wget http://vault.centos.org/7.6.1810/os/x86_64/Packages/firewalld-0.5.3-5.el7.noarch.rpm
wget http://vault.centos.org/7.6.1810/os/x86_64/Packages/firewalld-filesystem-0.5.3-5.el7.noarch.rpm
wget http://vault.centos.org/7.6.1810/os/x86_64/Packages/python-firewall-0.5.3-5.el7.noarch.rpm
● 現 firewalld の アンインストール(削除)
yum remove firewalld firewalld-filesystem python-firewall
● 旧 firewalld のインストール(テスト)
rpm -ivh --test *.rpm
● 旧 firewalld のインストール
rpm -ivh *.rpm
これでサーバ再起動なり、firewalld の再起動なりすれば、
リッチルールを適用しても安全です。
ちなみに firewalld を停止しても、ssh 等のネットワークは接続したままでした。
なのでリモートで作業できます。