我正在尝试使用IPtables的TRACE目标,但似乎无法记录任何跟踪信息。我想使用这里描述的内容: iptables的调试器。
来自TRACE的iptables男子:
This target marks packes so that the kernel will log every rule which match the packets as those traverse the tables, chains, rules. (The ipt_LOG or ip6t_LOG module is required for the logging.) The packets are logged with the string prefix: "TRACE: tablename:chain- name:type:rulenum " where type can be "rule" for plain rule, "return" for implicit rule at the end of a user defined chain and "policy" for the policy of the built in chains. It can only be used in the raw table.
我使用以下规则:iptables -A PREROUTING -t raw -p tcp -j TRACE
/ var / log / syslog或/var/log/kern.log中什么都没有附加!
还有其他步骤吗?我看错地方了吗?
编辑
尽管找不到日志条目,但由于数据包计数器增加了,TRACE目标似乎已正确设置:
# iptables -L -v -t raw
Chain PREROUTING (policy ACCEPT 193 packets, 63701 bytes)
pkts bytes target prot opt in out source destination
193 63701 TRACE tcp -- any any anywhere anywhere
Chain OUTPUT (policy ACCEPT 178 packets, 65277 bytes)
pkts bytes target prot opt in out source destination
编辑2
该规则iptables -A PREROUTING -t raw -p tcp -j LOG
不打印包信息到/ var / log / syslog的...为什么不跟踪工作?
1
只是陷入了python程序(也称为iptables-trace :)。启动时,它将具有指定条件的TRACE规则添加到正在运行的iptables中,解析并显示格式化的输出以得到最终的TRACE输出,直到程序停止(这将从iptables中删除了TRACE规则)。会尽快尝试...
—
克里斯