LoginSignup
6
6

More than 5 years have passed since last update.

さくらVPS: ファイアーウォールの設定をする

Last updated at Posted at 2013-12-28

iptablesの設定ファイルの編集

sudo vim /etc/sysconfig/iptables

でファイアーウォールの設定を行います。
設定方法がわかりにくいのでdotinstalllの記事から設定ファイルを拝借。

*filter
:INPUT    DROP    [0:0]
:FORWARD  DROP    [0:0]
:OUTPUT   ACCEPT  [0:0]
:SERVICES -       [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s --limit-burst 4  -j ACCEPT
-A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -j SERVICES
-A INPUT -p udp --sport 53 -j ACCEPT
-A INPUT -p udp --sport 123 --dport 123 -j ACCEPT
-A SERVICES -p tcp --dport YOUR_PORT_NUMBER(★★) -j ACCEPT
-A SERVICES -p tcp --dport 80 -j ACCEPT
-A SERVICES -p tcp --dport 443 -j ACCEPT
COMMIT

YOURT_PORT_NUMBERのところを設定している4569に変更する。

iptabelsの起動

service iptables start

iptablesの設定の確認

iptables -L

参考にしたサイト

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