LoginSignup
5
5

More than 5 years have passed since last update.

iptablesの設定

Last updated at Posted at 2015-09-07

設定ファイルを作成

sudo vim /etc/sysconfig/iptables
/etc/sysconfig/iptables
*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 25 -j ACCEPT
-A SERVICES -p tcp --dport 110 -j ACCEPT
-A SERVICES -p tcp --dport 587 -j ACCEPT
-A SERVICES -p tcp --dport 80 -j ACCEPT
-A SERVICES -p tcp --dport 443 -j ACCEPT

-A INPUT -p udp -m udp --dport 137:138 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 139 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 445 -j ACCEPT


COMMIT

設定を反映


sudo service iptables restart

sudo iptables -L

sudo chkconfig iptables on

sudo chkconfig --list iptables

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