Skip to contentSkip to conversation

accounting NAT-ed packets

DISCUSSION Piotrek Kaczmarek 2 participants 3 messages Dec 19, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

I want to account all traffic from the address assigned to the linux box (including NAT, locally generated traffic), but i can't. The rule iptables -t mangle -A POSTROUTING -s 213.25.213.42
seems not to ,,catch'' NAT-ed packets, only locally generated traffic.

Is there any method to ,,catch'' packets after NAT with netfilter?

Best Regards,

Signature · 1 line
Piotr Kaczmarek
#1 lore raw

Yea, in mangle POSTROUTING, or in filter FORWARD the packets which are going to be nat-ed. nat table counts only the first packet from a stream

Quoted 15 lines · Piotrek Kaczmarek

Hello,

I want to account all traffic from the address assigned to the linux box (including NAT, locally generated traffic), but i can't. The rule iptables -t mangle -A POSTROUTING -s 213.25.213.42
seems not to ,,catch'' NAT-ed packets, only locally generated traffic.

Is there any method to ,,catch'' packets after NAT with netfilter?

Best Regards,

--
Piotr Kaczmarek

Signature · 1 line
Bla bla
#2 lore raw
In reply to Piotrek Kaczmarek
Quoted 8 lines · Piotrek Kaczmarek

Hello,

I want to account all traffic from the address assigned to the linux box (including NAT, locally generated traffic), but i can't. The rule iptables -t mangle -A POSTROUTING -s 213.25.213.42
seems not to ,,catch'' NAT-ed packets, only locally generated traffic.

Is there any method to ,,catch'' packets after NAT with netfilter?

I've found a solution. I've added POSTROUTING chain to the raw table but with higher priority than a nat table, so it is now possible to intercept packets with nat-ed source addresses. You can download patch from
http://k.daleka.net/iptable_raw.patch

Could you consider applying this? I couldn't find other solution to do this.

Signature · 1 line
Piotrek Kaczmarek