0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

iptablesの設定を再起動しても保持する

Posted at

iptablesの設定は再起動すると初期化されてしまいます.どうすれば再起動しても以前の設定が保持(再反映)できるでしょうか?

iptableの設定の保持

まず,iptablesに設定を読み込みます.

sudo iptables-restore < rules

iptablesの設定を自動的にソフトをインストールします.

sudo apt install iptables-persistent

インストールの途中で,現在の設定を保存するかどうか聞いてくるのでyesと答えましょう.ここで保存したiptableの設定が,再起動したとき使用されます.
以上で終わりです.

iptableの設定を変える場合

iptablesの設定を変える場合は,新たなルールをiptableに読み込みます.

sudo iptables-restore < rules

このまま再起動すると,以前のiptables-persistentに保存した設定が再現されてしまいます.次のコマンドを入力し,新たな設定を保存します.

sudo /sbin/netfilter-persistent save

これで,再起動時に新たな設定が反映されます.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?