Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Vincent Bernat <bernat@luffy.cx>
To: David Madore <david+ml@madore.org>
Cc: netfilter@vger.kernel.org
Subject: Re: workaround for no DROP in table nat ?
Date: Mon, 15 Jun 2009 19:24:10 +0200	[thread overview]
Message-ID: <m33aa1v29x.fsf@neo.luffy.cx> (raw)
In-Reply-To: <20090615165904.GA29477@regulus.madore.org> (David Madore's message of "Mon, 15 Jun 2009 18:59:04 +0200")

OoO Lors de la soirée naissante du lundi 15 juin 2009, vers 18:59, David
Madore <david+ml@madore.org> disait :

> Recent versions of iptables have forbidden the use of DROP in the nat
> table.  I can't understand, however, how one is supposed to work
> around this limitation: is there a howto or some kind of documentation
> somewhere which explains how to deal with this change?

> Suppose my current rules look something like this:

> -t nat -A OUTPUT -p tcp -d somenetwork -m tcp --syn --dport 80 -j CONTROLLED
> -t nat -A CONTROLLED -m limit --limit 10/hour -j RETURN
> -t nat -A CONTROLLED -p tcp -m statistic --mode random --probability 0.1 -j REDIRECT --to-ports 80
> -t nat -A CONTROLLED -j DROP

You can DROP in the mangle table instead.

-t mangle -A OUTPUT -p tcp -d ... -j CONTROLLED
-t mangle -j CONTROLLED -m limit --limit ... -j RETURN
-t mangle -j CONTROLLED -p tcp -m statistic --mode random --probability 0.9 -j DROP
-t mangle -j CONTROLLED -j MARK --set-mark 1
-t nat -A OUTPUT -m mark --mark 1 -j REDIRECT --to-ports 80

You can also  DROP in the raw table,  but I think you cannot  set a mark
here.
-- 
BOFH excuse #381:
Robotic tape changer mistook operator's tie for a backup tape.

  reply	other threads:[~2009-06-15 17:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-15 16:59 workaround for no DROP in table nat ? David Madore
2009-06-15 17:24 ` Vincent Bernat [this message]
2009-06-16  4:29   ` Amos Jeffries
2009-06-16  7:08     ` Покотиленко Костик

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=m33aa1v29x.fsf@neo.luffy.cx \
    --to=bernat@luffy.cx \
    --cc=david+ml@madore.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox