All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jack Bates <uo4zau@nottheoilrig.com>
To: netfilter@vger.kernel.org
Subject: How to mirror traffic received on WAN interface *before* NAT?
Date: Sat, 03 Mar 2012 20:14:33 -0800	[thread overview]
Message-ID: <4F52EC29.9080607@nottheoilrig.com> (raw)

We run "ntop" on a computer connected to our router, for traffic 
analysis: 
http://jdbates.blogspot.com/2012/02/this-is-followup-to-this-post-on-how-to.html

We forward all traffic sent and received on our WAN interface to the 
"ntop" computer with the following lines in /etc/firewall.user:


> iptables -A PREROUTING -t mangle -i eth0.1 -j TEE --gateway 192.168.1.7
> iptables -A POSTROUTING -t mangle -o eth0.1 -j TEE --gateway 192.168.1.7


This works well, except that we also NAT traffic on our WAN interface. 
We want to monitor traffic *before* NAT

Currently the source addresses of mirrored outgoing traffic are our 
"private" addresses, e.g. 192.168.1.123, 192.168.1.234, etc. so these 
rules happily mirror *outgoing* traffic before NAT

However the destination address of mirrored *incoming* traffic is our 
"public" address. I guess I want to mirror incoming traffic after NAT, 
so I tried "POSTROUTING" for incoming traffic:


> iptables -A POSTROUTING -t mangle -i eth0.1 -j TEE --gateway 192.168.1.7
> iptables -A POSTROUTING -t mangle -o eth0.1 -j TEE --gateway 192.168.1.7


  - but I get the following error:


> iptables v1.4.6: Can't use -i with POSTROUTING


Any advice, how to improve these rules to monitor traffic *before* NAT? 
so analysis of incoming and outgoing traffic consistently references our 
"private" addresses associated with the traffic?

Any general advice concerning this setup?

             reply	other threads:[~2012-03-04  4:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04  4:14 Jack Bates [this message]
2012-03-04  4:54 ` How to mirror traffic received on WAN interface *before* NAT? John A. Sullivan III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F52EC29.9080607@nottheoilrig.com \
    --to=uo4zau@nottheoilrig.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.