简体   繁体   English

debian buster/10 iptables raw TRACE,没有日志

[英]debian buster/10 iptables raw TRACE, no logs

I have a new installed debian buster/10, I want to check the iptables TRACE log, so I added iptables's raw TRACE rule:我有一个新安装的 debian buster/10,我想查看 iptables TRACE 日志,所以我添加了 iptables 的原始 TRACE 规则:

iptables -t raw -A PREROUTING -j TRACE

And I set this according to this page :我根据这个页面设置了这个:

modprobe nf_log_ipv4
sysctl net.netfilter.nf_log.2=nf_log_ipv4

But I still got no TRACE log in syslog, kern.log or messages, -j LOG works.但是我在 syslog、kern.log 或消息中仍然没有 TRACE 日志,-j LOG 有效。 And " xtables-monitor -t " can show the TRACE packages.并且“ xtables-monitor -t ”可以显示TRACE包。

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

# uname -a
Linux debian 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux

# iptables --version
iptables v1.8.2 (nf_tables)

# lsmod | grep xt_
xt_LOG                 16384  0
xt_TRACE               16384  0
xt_mark                16384  3
xt_TPROXY              16384  2
nf_tproxy_ipv6         16384  1 xt_TPROXY
nf_tproxy_ipv4         16384  1 xt_TPROXY
xt_nat                 16384  5
nf_nat                 36864  2 nf_nat_ipv4,xt_nat
xt_addrtype            16384  2
xt_tcpudp              16384  10
xt_conntrack           16384  3
nf_conntrack          172032  6 xt_conntrack,nf_nat,ipt_MASQUERADE,nf_nat_ipv4,xt_nat,nf_conntrack_netlink
nf_defrag_ipv6         20480  2 nf_conntrack,xt_TPROXY
nf_defrag_ipv4         16384  2 nf_conntrack,xt_TPROXY
x_tables               45056  11 xt_conntrack,nft_compat,xt_TRACE,xt_LOG,xt_tcpudp,ipt_MASQUERADE,xt_addrtype,xt_nat,xt_TPROXY,ip_tables,xt_mark

# lsmod | grep log
nft_log                16384  0
nfnetlink_log          20480  0
nf_log_ipv4            16384  0
nf_log_common          16384  1 nf_log_ipv4
nf_tables             143360  303 nft_chain_route_ipv4,nft_compat,nft_log,nft_chain_nat_ipv4,nft_counter
nfnetlink              16384  5 nft_compat,nf_conntrack_netlink,nf_tables,nfnetlink_log

Anything I missed?我错过了什么吗? Thank you.谢谢你。

As here expresses, debian buster uses nftables as backend by default:正如这里所表达的,debian buster 默认使用 nftables 作为后端:

NOTE: iptables is being replaced by nftables starting with Debian Buster注意:从 Debian Buster 开始,iptables 被 nftables 取代

Current status当前状态

NOTE: Debian Buster uses the nftables framework by default.注意:Debian Buster 默认使用 nftables 框架。

Starting with Debian Buster, nf_tables is the default backend when using iptables, by means of the iptables-nft layer (ie, using iptables syntax with the nf_tables kernel subsystem).从 Debian Buster 开始,nf_tables 是使用 iptables 时的默认后端,通过 iptables-nft 层(即,在 nf_tables 内核子系统中使用 iptables 语法)。 This also affects ip6tables, arptables and ebtables.这也会影响 ip6tables、arptables 和 ebtables。

somiaj@freenode on #debian channel suggests to use nft , I tried it and it worked like a charm, the rules was from iptables wrapper: #debian 频道上的 somiaj@freenode 建议使用nft ,我尝试了它,它就像一个魅力,规则来自 iptables 包装器:

chain OUTPUT {
        type filter hook output priority -300; policy accept;
        meta l4proto udp udp dport 53 counter packets 10526 bytes 658659 nftrace set 1
}

nft monitor trace : nft 监视器跟踪

# nft monitor trace
trace id 802a6813 ip raw OUTPUT packet: oif "eth0" ip saddr 192.168.0.88 ip daddr 208.67.222.222 ip dscp cs0 ip ecn not-ect ip ttl 64 ip id 32950 ip length 75 udp sport 54299 udp dport domain udp length 55 @th,64,96 4657996495637740913470472193
trace id 802a6813 ip raw OUTPUT rule meta l4proto udp udp dport 53 counter packets 10694 bytes 669129 nftrace set 1 (verdict continue)
trace id 802a6813 ip raw OUTPUT verdict continue
trace id 802a6813 ip raw OUTPUT
......
trace id 8c561cef ip mangle POSTROUTING mark 0x000000ff
trace id 8c561cef ip nat POSTROUTING verdict continue mark 0x000000ff
trace id 8c561cef ip nat POSTROUTING mark 0x000000ff

More please refer to https://wiki.nftables.org/wiki-nftables/index.php/Ruleset_debug/tracing .更多请参考https://wiki.nftables.org/wiki-nftables/index.php/Ruleset_debug/tracing

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM