Centos 7では、iptables-configの変更はもはや何もしません(停止/再起動時に保存できません)。

Centos 7では、iptables-configの変更はもはや何もしません(停止/再起動時に保存できません)。

長すぎます。 Centos 7でiptableをどのように保存しますか?

~によるとCentos 5 ドキュメントサービスが再起動または停止したときに私のiptablesを保存できるはずです。私の記憶が正しければ、ずっと前にCentos 7でこれが起こったことを確認できます。

service iptables saveコマンドを手動で呼び出さないと、iptablesの変更を保存できません。

ただし、カウンター(使用量など)を保存したいので、再起動後も最新のカウンターを維持する必要があります。

私の/etc/sysconfig/iptables-config外観は次のとおりです。

IPTABLES_MODULES=""
IPTABLES_MODULES_UNLOAD="yes"
IPTABLES_SAVE_ON_STOP="yes"
IPTABLES_SAVE_ON_RESTART="yes"
IPTABLES_SAVE_COUNTER="yes"
IPTABLES_STATUS_NUMERIC="yes"
IPTABLES_STATUS_VERBOSE="no"
IPTABLES_STATUS_LINENUMBERS="yes"

私は使用する:yum info iptables iptables-services xtables-addons

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.coreix.net
 * epel: epel.mirror.wearetriple.com
 * extras: mirrors.coreix.net
 * updates: mirrors.coreix.net
Installed Packages
Name        : iptables
Arch        : x86_64
Version     : 1.4.21
Release     : 18.0.1.el7.centos
Size        : 1.5 M
Repo        : installed
From repo   : base
Summary     : Tools for managing Linux kernel packet filtering capabilities
URL         : http://www.netfilter.org/
License     : GPLv2
Description : The iptables utility controls the network packet filtering code in the
            : Linux kernel. If you need to set up firewalls and/or IP masquerading,
            : you should install this package.

Name        : iptables-services
Arch        : x86_64
Version     : 1.4.21
Release     : 18.0.1.el7.centos
Size        : 25 k
Repo        : installed
From repo   : base
Summary     : iptables and ip6tables services for iptables
URL         : http://www.netfilter.org/
License     : GPLv2
Description : iptables services for IPv4 and IPv6
            :
            : This package provides the services iptables and ip6tables that have been split
            : out of the base package since they are not active by default anymore.

Name        : xtables-addons
Arch        : x86_64
Version     : 2.12
Release     : 1.el7.lux
Size        : 294 k
Repo        : installed
From repo   : lux
Summary     : Extensions targets and matches for iptables
URL         : http://xtables-addons.sourceforge.net
License     : GPLv2 and LGPLv2
Description : Xtables-addons provides extra modules for iptables not present in the kernel,
            : and is the successor of patch-o-matic. Extensions includes new targets like
            : TEE, TARPIT, CHAOS, or modules like geoip, ipset, and account.
            :
            : This package provides the userspace libraries for iptables to use extensions
            : in the xtables-addons-kmod package. You must also install the
            : xtables-addons-kmod package.

アップデート#1:

私はiptables-configファイルが非常に厳しいことがわかりました。単一の空白がファイルを壊す可能性があり、誤った空白が原因でパーサーがそのファイルを完全に無視することがわかりました。元のファイルを再インストールして使用してください。

今私が直面している問題も似ています。service iptables stopする救う。再起動または終了いいえ

アップデート#2:

最初の問題は確かにiptables-config文書化です。 iptables関連のファイルをすべて削除して/etc/sysconfig再インストールすると、問題をすばやく解決できます。

ところで、iptablesは権限の問題として保存できないようです。

アップデート#3:

いつものセキュリティレベルの変更を見逃しました。以下のコマンドは、高度なセキュリティを無効にしてiptablesに保存できるようにします。

setenforce 0

動作しています!

ベストアンサー1

centos7 は iptables のフロントエンドとしてファイアウォールを使用します。使用方法については、次のリンクをクリックしてください。https://www.linode.com/docs/security/firewalls/introduction-to-firewalld-on-centos

おすすめ記事