LoginSignup
3
5

More than 5 years have passed since last update.

iptables で位置を指定してルールを設定する方法

Last updated at Posted at 2014-09-28

いつも忘れるので、memo。。。

iptables -I Chain rulenum(位置)

まずは、位置を確認

$ iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

例)インサートコマンド(-I)で Chain INPUTの4番目に挿入する場合
$ iptables -I INPUT 4 -p tcp --dport 80 -j ACCEPT

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