私のルータが自分に転送するパケットを拒否するのはなぜですか?

私のルータが自分に転送するパケットを拒否するのはなぜですか?

FORWARDチェーンの最初のルールは私にとって興味深かったです。ポリシーを免除する必要がある場合、これはなぜ必要なルールですか?

root@tomato:/tmp/home/root# iptables -L --line-numbers
Chain INPUT (policy DROP)
num  target     prot opt source               destination
1    REJECT     tcp  --  anywhere             tomato               multiport dports www,https,ssh reject-with tcp-reset
2    REJECT     tcp  --  anywhere             tomato-lan1          multiport dports www,https,ssh reject-with tcp-reset
3    DROP       all  --  anywhere             anywhere             state INVALID
4    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
5    shlimit    tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW
6    ACCEPT     all  --  anywhere             anywhere
7    ACCEPT     all  --  anywhere             anywhere
8    ACCEPT     all  --  anywhere             anywhere

Chain FORWARD (policy DROP)
num  target     prot opt source               destination
1    REJECT     tcp  --  anywhere             tomato               multiport dports www,https,ssh reject-with tcp-reset
2    REJECT     tcp  --  anywhere             tomato-lan1          multiport dports www,https,ssh reject-with tcp-reset
3    ACCEPT     all  --  anywhere             anywhere
4    ACCEPT     all  --  anywhere             anywhere
5    DROP       all  --  anywhere             anywhere             state INVALID
6    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
7    DROP       all  --  anywhere             anywhere
8    DROP       all  --  anywhere             anywhere
9    wanin      all  --  anywhere             anywhere
10   wanout     all  --  anywhere             anywhere
11   ACCEPT     all  --  anywhere             anywhere
12   ACCEPT     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination

Chain shlimit (1 references)
num  target     prot opt source               destination
1               all  --  anywhere             anywhere             recent: SET name: shlimit side: source
2    DROP       all  --  anywhere             anywhere             recent: UPDATE seconds: 60 hit_count: 4 name: shlimit side: source

Chain wanin (1 references)
num  target     prot opt source               destination
1    ACCEPT     tcp  --  anywhere             oldtimer             tcp dpt:3300

Chain wanout (1 references)
num  target     prot opt source               destination

ベストアンサー1

1) ルールは、上位レベルの記述を使用して一部のプログラムで自動的に生成されます。ルールがそこに現れるという理由だけで「必要」と仮定しないでください。

2) 規則が必ずしも必要ではなくても、許可されていない事項を明示的に明記して規則を含めることをお勧めします。

3)つまり、パケットを受け入れてテーブルの最後に到達する前にデフォルトのDROPポリシーを適用する他のルールがある場合は、実際にこのルールを含める必要があります。

特に、FORWARDチェーンの規則11と12は同じように見え、すべてを許可するように見えます(したがって、リストにない属性がある可能性があります。-S代わりに試してみてください-L)。その場合は、基本方針が許可するものと同じであるため、放棄したいすべてを明示的に放棄する必要があります。

おすすめ記事