我试图在Debian(Wheezy)下使用IPtables设置一些规则,并且遇到了一些我认为的问题。
INPUT的策略设置为DROP。 这是否放弃一切基于我放入INPUT的规则,或者它是一些路由器中的标准ACL列表,这意味着所有不符合语句(如果它们设置为ACCEPT)将导致DROP?
以此为例:
Chain INPUT (policy DROP) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpts:ftp-data:ftp
这些ftp-packet会丢失还是会被接受,其他的一切都会丢失?
我希望我不会把它搞乱。
“这意味着所有与语句不匹配的东西(如果它们被设置为ACCEPT)将导致DROP?” – 正确。 这是默认的。
从man iptables :
-j, --jump target This specifies the target of the rule; ie, what to do if the packet matches it. The target can be...one of the special builtin targets which decide the fate of the packet immediately
和
ACCEPT means to let the packet through.
logging总是有助于理解stream程。 试试: iptables -A INPUT -j LOG 。
如果你特别想设置FTP,看看 – --state RELATED 。