netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: netfilter machine in between 2 servers
Date: Sun, 14 Mar 2004 09:44:51 +0000	[thread overview]
Message-ID: <200403140944.51622.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <20040314092812.74659.qmail@web60006.mail.yahoo.com>

On Sunday 14 March 2004 9:28 am, Sandy C wrote:

> Hi there,
>    I have 3 Linux machines. One configured as a server, the second as a
> client, and the third sniffing packets transferring between the 2. All 3
> machines are hooked up to each other over a hub, and all are running
> 100MB/s
>
>    Using ethereal I can see the packets going between the server and the
> client.

All sounds good so far.

> I would like the third, sniffing machine to be able to filter
> packets going between the client and the server. This doesn't seem to work
> though.

No, the third machine cannot filter anything, because nothing passes through 
it.   The third machine is simply seeing the packets as they appear on all 
the sockets of the hub, quite independently of the fact that the client and 
server are talking directly to each other through that hub.

> So I have the following rule on the third machine:
> iptables -A INPUT -p 80 -j LOG
>
> meaning just log all http requests. It doesn't work, but if I have this
> rule on either the client or the server, it works as expected.

Indeed.   The INPUT chain is for packets addressed to the machine with the 
rule running on it - so therefore it works as expected if you put the rule on 
the client or server, because they are actually sending and receiving 
packets.

It doesn't work if you look for packets in the INPUT chain of a machine which 
simply happens to be running ethereal (or tcpdump, or any other sniffer), 
because those packets are not addressed to the machine itself, and therefore 
never make they way up the TCP/IP stack and enter netfilter.   Packet 
sniffers grab the packets much closer to the interface than this, and will 
see stuff which netfilter does not.

> I get the feeling I'm missing something very basic. Can anyone help?

You should think of netfilter as an add-on to Linux's routing capabilties.   
Normal routing allows a machine to pass packets between interfaces.   
Netfilter allows those packets to be blocked, or logged, or redirected to 
another address.   If you are not routing packets through a machine, and it 
is not one of the endpoints taking part in the communication, then you cannot 
filter them with netfilter.

Your setup is not routing packet through machine 3 because client and server 
are on the same subnet, happily talking to each other directly, without any 
need to route through something else.   If you were using a switch instead of 
a hub, machine 3 wouldn't even see the packets in the first place using 
ethereal :)

Hope this helps,

Antony.

-- 
How I want a drink, alcoholic of course, after the heavy chapters involving 
quantum mechanics.

 - 3.14159265358979

                                                     Please reply to the list;
                                                           please don't CC me.



  reply	other threads:[~2004-03-14  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-14  9:28 netfilter machine in between 2 servers Sandy C
2004-03-14  9:44 ` Antony Stone [this message]
2004-03-14 18:27   ` Sandy C
2004-03-14 18:41     ` Antony Stone
2004-03-14 19:47       ` Sandy C
2004-03-14 19:57         ` Antony Stone

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=200403140944.51622.Antony@Soft-Solutions.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;
as well as URLs for NNTP newsgroup(s).