3
3

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 5 years have passed since last update.

ファイヤーウォールを設定する

Last updated at Posted at 2016-03-19

インストール&設定前の準備

$ apt-get install ufw
$ ufw status

ファイヤーウォールを有効にする。
SSHで接続している場合は以下のメッセージが出るので有効にする。

$ ufw enable

Command may disrupt existing ssh connections. Proceed with operation (y|n)?

ファイヤーウォールを無効にして設定をリセットする

$ ufw disable
$ ufw reset

Resetting all rules to installed defaults. This may disrupt existing ssh
connections. Proceed with operation (y|n)?


ファイヤーウォール設定例

以下の順で設定

  1. 外部からの接続をすべて受け付けない
  2. 必要なポートだけを許可する
$ ufw default deny
$ ufw allow proto tcp from 192.168.10.0/24 to any port 22
$ ufw allow 80
$ ufw enable

状態を確認

$ ufw status

Status: active

To Action From

22/tcp ALLOW 192.168.10.0/24
8080 ALLOW Anywhere
80 ALLOW Anywhere

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?