From: Florian Boelstler <euphoria@arcor.de>
To: netfilter@lists.netfilter.org
Subject: Re: how to log dropped packet
Date: Tue, 28 Sep 2004 13:50:26 +0200 [thread overview]
Message-ID: <41595002.70706@arcor.de> (raw)
In-Reply-To: <web-6413785@infinito.it>
What I usually do is:
---------------------------------------------------------------------
#!/bin/sh
# Some handy variables
IPTABLES=`which iptables`
d_HTTP="http,https"
p_high="1024:65535"
EXT="wlan0"
# DROP & LOG chain
$IPTABLES -N DROPnLOG
$IPTABLES -A DROPnLOG -p ICMP -j ULOG --ulog-nlgroup 1 --ulog-prefix
"DROP-ICMP "
$IPTABLES -A DROPnLOG -p TCP -j ULOG --ulog-nlgroup 1 --ulog-prefix
"DROP-TCP "
$IPTABLES -A DROPnLOG -p UDP -j ULOG --ulog-nlgroup 1 --ulog-prefix
"DROP-UDP "
# Default rule for established connections
$IPTABLES -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Put several rules to allow outgoing traffic here. E.g. for web sites:
$IPTABLES -A OUTPUT -o $EXT -m state --state NEW -p TCP --sport $p_high
-m multiport --destination-ports $d_HTTP -j ACCEPT
# Wipe anything not matching any of the rulesets above
$IPTABLES -A INPUT -j DROPnLOG
$IPTABLES -A FORWARD -j DROPnLOG
$IPTABLES -A OUTPUT -j DROPnLOG
---------------------------------------------------------------------
The script above requires that you're kernel is aware of the ULOG target.
This allows to log iptable's output to another destination (i.e. file)
than syslog.
You will need an appropriate ULOG configuration file.
The output will look like this:
Jan 1 01:00:00 beamstation DROP-UDP IN= OUT=wlan0 MAC=
SRC=192.168.2.100 DST=192.168.2.255 LEN=268 TOS=00 PREC=0x00 TTL=64 ID=8
DF PROTO=UDP SPT=138 DPT=138 LEN=248
Good luck,
Florian
next prev parent reply other threads:[~2004-09-28 11:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-28 10:12 how to log dropped packet hamals
2004-09-28 10:28 ` Wan Seman Bin Wan Ismail
2004-09-28 11:50 ` Florian Boelstler [this message]
2004-09-28 15:37 ` Florian Boelstler
2004-09-28 15:30 ` Alistair Tonner
2004-09-29 9:19 ` Florian Boelstler
2004-09-28 14:09 ` Jason Opperisano
2004-09-28 14:21 ` Aleksandar Milivojevic
2004-09-28 14:30 ` Jose Maria Lopez
2004-09-28 14:27 ` Jose Maria Lopez
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=41595002.70706@arcor.de \
--to=euphoria@arcor.de \
--cc=netfilter@lists.netfilter.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.