From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: Howto match only the first connection from an IP
Date: Tue, 18 Nov 2003 16:00:12 +0000 [thread overview]
Message-ID: <200311181600.hAIG0Gj23165@agate.rockstone.co.uk> (raw)
In-Reply-To: <20031118144300.GA5071@legolas.on.net.mk>
On Tuesday 18 November 2003 2:43 pm, Damjan wrote:
> My goal is to set-up an iptables rule that will match and DNAT the
> first HTTP(port 80) connection from a client (IP address).
>
> The first connection is defined as the first established TCP session
> from the time the iptables rule is inserted. No other TCP connection
> should match nor should be DNAT-ed.
>
> Is there any easy way to do this with current Netfilter/Iptables/pom.
I can't think of a way to do this with netfilter on its own.
A slightly convoluted, although probably effective, way to do it might be to
add one rule to LOG the packet you're interested in, and another rule just
after it to perform the NAT. You then pipe the output of syslog into a
script which watches out for the netfilter entry, and then issues a
"netfilter -D ....." command to delete the NAT rule.
The only flaw I can see here (aside from the inefficiency) is that there will
be a certain time delay between the first packet being seen and logged, and
the NAT rule getting deleted by the script, during which time a packet could
get through on a second connection.
Whether that's important to you, and how long the time period might be, I
can't say.
It's an idea, anyway.
Antony.
--
Mahatma Gandhi was once asked what he thought of Western Civilisation.
He replied, "That would be a very good idea."
Please reply to the list;
please don't CC me.
next prev parent reply other threads:[~2003-11-18 16:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-18 14:43 Howto match only the first connection from an IP Damjan
2003-11-18 16:00 ` Antony Stone [this message]
2003-11-18 17:26 ` Damjan
-- strict thread matches above, loose matches on Subject: below --
2003-11-20 21:55 George Vieira
2003-11-19 0:04 Rodre Ghorashi-Zadeh
2003-11-18 5:12 Damjan
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=200311181600.hAIG0Gj23165@agate.rockstone.co.uk \
--to=antony@soft-solutions.co.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox