質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

firewalld

firewalldは、CentOS7からデフォルトになったパケットフィルタリングです。一時的なルールと永続的なルールが設定でき、通信の許可・拒否をコントロール。バージョン6まで利用されてきた「iptables」における課題をカバーしています。

iptables

iptablesは、一般的なLinuxに備わっているパケットフィルタリング型のファイアウォール機能。パケットフィルタリングルールおよびネットワークアドレス変換ルールを適用することが可能です。

Q&A

0回答

2373閲覧

Firewalldの起動を試みるがタイムアウトする

maedamin

総合スコア13

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

firewalld

firewalldは、CentOS7からデフォルトになったパケットフィルタリングです。一時的なルールと永続的なルールが設定でき、通信の許可・拒否をコントロール。バージョン6まで利用されてきた「iptables」における課題をカバーしています。

iptables

iptablesは、一般的なLinuxに備わっているパケットフィルタリング型のファイアウォール機能。パケットフィルタリングルールおよびネットワークアドレス変換ルールを適用することが可能です。

0グッド

0クリップ

投稿2021/12/14 06:25

Firewalldを起動させたい

現在、稼働中サービスのOS、Apacheバージョンアップを行うため環境作成テストを行っています。
その中でfirewalldの設定をきちんと行おうとしているのですが、どうもタイムアウトしてしまっているようです。

やったこと

AWSにて動いている本番サーバのイメージを取得し、別途インスタンスを生成、OS、Apacheの更新を試行しています。
OS:CentOS Linux release 7.9.2009 (Core)
Apache: Apache/2.4.51 (IUS)
それぞれ、バージョンアップは成功しています。Apacheもhttpレベルは稼働しており、現在SSLの設定をしようとしています。
その際、セキュリティ向上のためfirewalldも稼働させようとしてハマっています。(もともとは動いていなかった様子。)

現状

systemctl start firewalld

を試みますが、タイムアウトします。

# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: failed (Result: timeout) since Tue 2021-12-14 12:05:32 JST; 3min 9s ago Docs: man:firewalld(1) Process: 28728 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS) Main PID: 28728 (code=exited, status=0/SUCCESS) Dec 14 12:04:01 centos70.xxxx.local systemd[1]: Starting firewalld - dynamic firewall daemon... Dec 14 12:04:02 centos70.xxxx.local firewalld[28728]: WARNING: ip6tables not usable, disabling IPv6 firewall. Dec 14 12:05:31 centos70.xxxx.local systemd[1]: firewalld.service start operation timed out. Terminating. Dec 14 12:05:32 centos70.xxxx.local systemd[1]: Failed to start firewalld - dynamic firewall daemon. Dec 14 12:05:32 centos70.xxxx.local systemd[1]: Unit firewalld.service entered failed state. Dec 14 12:05:32 centos70.xxxx.local systemd[1]: firewalld.service failed.

試したこと

  • リストfirewalldのプロセスが残っているとこのような状態になるという記事を読み、確認したが特に該当プロセスはなかった。
  • firewalldを再インストールした。⇒変化なし。
  • WARNINGでiptable6について出ているので、確認した。
# systemctl status ip6tables ● ip6tables.service - IPv6 firewall with ip6tables Loaded: loaded (/usr/lib/systemd/system/ip6tables.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2021-12-03 21:55:55 JST; 1 weeks 3 days ago Main PID: 2002 (code=exited, status=1/FAILURE) Dec 03 21:55:55 centos70.xxxx.local systemd[1]: Starting IPv6 firewall with ip6tables... Dec 03 21:55:55 centos70.xxxx.local ip6tables.init[2002]: ip6tables: Applying firewall rules: ip6tables-restore v1.4.21: ip6tables-restore: unable to initialize table 'filter' Dec 03 21:55:55 centos70.xxxx.local ip6tables.init[2002]: Error occurred at line: 4 Dec 03 21:55:55 centos70.xxxx.local ip6tables.init[2002]: Try `ip6tables-restore -h' or 'ip6tables-restore --help' for more information. Dec 03 21:55:55 centos70.xxxx.local ip6tables.init[2002]: [FAILED] Dec 03 21:55:55 centos70.xxxx.local systemd[1]: ip6tables.service: main process exited, code=exited, status=1/FAILURE Dec 03 21:55:55 centos70.xxxx.local systemd[1]: Failed to start IPv6 firewall with ip6tables. Dec 03 21:55:55 centos70.xxxx.local systemd[1]: Unit ip6tables.service entered failed state. Dec 03 21:55:55 centos70.xxxx.local systemd[1]: ip6tables.service failed.
  • エラーが出ているので/etc/sysconfig/ip6tablesを確認
# sample configuration for ip6tables service # you can edit this manually or use system-config-firewall # please do not ask us to add additional ports/services to this default configuration *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p ipv6-icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -d fe80::/64 -p udp -m udp --dport 546 -m state --state NEW -j ACCEPT -A INPUT -j REJECT --reject-with icmp6-adm-prohibited -A FORWARD -j REJECT --reject-with icmp6-adm-prohibited COMMIT

現在、行き詰っています。
お知恵拝借できれば幸いです。
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

over

2021/12/14 07:39

journalログ、またはsyslogで原因を追究する必要があります。
yukky1201

2021/12/14 07:44

firewalldの初期設定でも起動できませんか? 初期設定から設定変更しているなら、その内容は記載するようにしてください。 また、利用したいのはfirewalldであってiptablesではないですよね?
maedamin

2021/12/14 09:11

yukky1201様、コメントありがとうございます。 利用したいのはfirewalldです。iptablesのwarningが出ているので、関係していると思い言及したまでです。 初期設定ですが、そもそもこのサーバは既存の実サービスサーバのコピーとなります。(OS、Apache更新の試行目的)今の実サーバを確認しましたが、firewalldはdisabledでinactive(dead)となっています。 初期設定からの設定変更などについては不明な状態です。
maedamin

2021/12/14 11:10

journalctlで探ったところ、supervisordが起動していないことを見つけました。Python3.6がなかったためです。Python3.6をインストールし、この起動エラーはなくなりましたが、firewalldの起動については変わらずタイムアウトしています。
TaichiYanagiya

2021/12/14 13:22

"ip6tables -F" でルールを削除した状態で firewalld を起動するとどうでしょうか?
yukky1201

2021/12/15 05:12

firewalldで制御したいのでしたら、iptablesサービスは不要です。 「iptables-services」をアンインストールしてみてはどうでしょうか。 ※iptablesは残したままにしてください
maedamin

2021/12/15 08:03 編集

Taichi Yanagiyaさん、ありがとございます。 ``` # ip6tables -F ip6tables v1.4.21: can't initialize ip6tables table `filter': Address family not supported by protocol Perhaps ip6tables or your kernel needs to be upgraded. ``` となりました。
maedamin

2021/12/15 08:14

ip6tablesを削除しようとしたら # yum remove ip6tables Loaded plugins: copr, fastestmirror Repository pgdg96 is listed more than once in the configuration Repository pgdg96-source is listed more than once in the configuration No Match for argument: ip6tables No Packages marked for removal で、iptablesを削除 この場合、firewalldを起動しようとしたら、Unit not foundで起動できず。 なので、firewalldを再インストールしました。 結果は同じくタイムアウトです。WARNINGが増えました。 WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now. WARNING: Failed to load nf_conntrack module: sysctl: cannot open "/etc/sysctl.conf": No such file or directory modprobe: ERROR: Error running install command for nf_conntrack modprobe: ERROR: could not insert 'nf_conntrack': Unknown error 255... WARNING: ip6tables not usable, disabling IPv6 firewall.
maedamin

2021/12/15 08:27

上記最初の2つのWARNING(AllowZoneDriftingとnf_conntrack)については対応してWARNINGは消えました。
TaichiYanagiya

2021/12/15 08:37 編集

iptables 自体を削除(アンインストール)したらダメでしょ。firewalld のバックエンドで使うので。
TaichiYanagiya

2021/12/15 08:45

iptables-services も一緒に削除され、OS 起動時に iptables, ip6tables のルールが設定されなくなっていると思います。 OS 再起動して、firewalld 起動できませんでしょうか?
yukky1201

2021/12/16 08:19

削除してもよかったのは、「iptables-services」のみでした。 最小構成でインストールした場合、関連するパッケージは下記となります [root@localhost ~]# [root@localhost ~]# rpm -qa | grep firewall python-firewall-0.6.3-11.el7.noarch firewalld-0.6.3-11.el7.noarch firewalld-filesystem-0.6.3-11.el7.noarch [root@localhost ~]# [root@localhost ~]# rpm -qa | grep table iptables-1.4.21-35.el7.x86_64 ebtables-2.0.10-16.el7.x86_64 [root@localhost ~]# このとき、iptablesサービス(iptables-services)はありません。 ※iptablesパッケージは上記ログの通りあります [root@localhost ~]# [root@localhost ~]# systemctl status iptables Unit iptables.service could not be found. [root@localhost ~]# この状況にてfirewalldは正常に起動します [root@localhost ~]# [root@localhost ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since 木 2021-12-16 17:04:42 JST; 3min 58s ago Docs: man:firewalld(1) Main PID: 704 (firewalld) CGroup: /system.slice/firewalld.service mq704 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid 12月 16 17:04:37 localhost.localdomain systemd[1]: Starting firewalld - dyna... 12月 16 17:04:42 localhost.localdomain systemd[1]: Started firewalld - dynam... 12月 16 17:04:44 localhost.localdomain firewalld[704]: WARNING: AllowZoneDri... Hint: Some lines were ellipsized, use -l to show in full. [root@localhost ~]# こちらで最小構成でインストールした場合、ip6tablesパッケージはインストールされてないんですよね。それでもfirewalldは起動しています
maedamin

2021/12/16 08:51

yukky1201さん、ありがとうございます。確認してみます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問