NetFilter
[Top] [All Lists]

Re: Logging NAT Translations

To: "Jan Engelhardt" <jengelh@linux01.gwdg.de>
Subject: Re: Logging NAT Translations
From: "Craig Bernstein" <cbernstein@cbernstein.com>
Date: Tue, 5 Jun 2007 19:10:09 -0700
Cc: netfilter@lists.netfilter.org
Delivered-to: sp-com-lists@consult.net
Delivered-to: netfilter-list1@securepoint.com
In-reply-to: <Pine.LNX.4.61.0705222208440.4452@yvahk01.tjqt.qr>
List-archive: </pipermail/netfilter>
List-help: <mailto:netfilter-request@lists.netfilter.org?subject=help>
List-id: General discussion and user questions <netfilter.lists.netfilter.org>
List-post: <mailto:netfilter@lists.netfilter.org>
List-subscribe: <https://lists.netfilter.org/mailman/listinfo/netfilter>, <mailto:netfilter-request@lists.netfilter.org?subject=subscribe>
List-unsubscribe: <https://lists.netfilter.org/mailman/listinfo/netfilter>, <mailto:netfilter-request@lists.netfilter.org?subject=unsubscribe>
References: <ae1f24730705182015j533102bah985e9ad0e905cd2a@mail.gmail.com> <Pine.LNX.4.61.0705222208440.4452@yvahk01.tjqt.qr>
Sender: netfilter-bounces@lists.netfilter.org
On 5/22/07, Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:
iptables -t nat -N yes_do_me_1
iptables -t nat -A yes_do_me_1 -j LOG ...
iptables -t nat -A yes_do_me_1 -j SNAT ...

iptables -t nat -s 134.76.0.0/16 -d whatever -p tcp -j yes_do_me_1

Or you could use `conntrack -E`... or conntrack -L for a momentary
state.

Jan, thank you for your suggestion, but setting it up that way gives
me the same results as before.  The log entry looks like this:

IN= OUT=eth0 SRC=10.1.2.3 DST=209.85.139.147 LEN=48 TOS=0x00 PREC=0x00
TTL=125 ID=52743 DF PROTO=TCP SPT=1535 DPT=80 WINDOW=16384 RES=0x00
SYN URGP=0

"SRC" is the inside client address.  "DST" is the outside server
address.  I still need to log the outside address the client is SNATed
to, i.e. the public Internet address the server will see.

`cat /proc/net/ip_conntrack` will give me the momentary state, but I
want each connection syslogged at set-up and/or tear-down.

Petr recommended the conntrack tool, which may work but will require
upgrading a box that is currently running Debian Sarge.  Is that my
only option?

Thanks,
Craig


<Prev in Thread] Current Thread [Next in Thread>