Skip to contentSkip to conversation

(no subject)

netfilter-core Harald Welte 3 participants 3 messages Mar 28, 2003 – Mar 31, 2003 1 message not in the archive netfilter

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 3 lines · On Fri, Mar 28, 2003 at 04:18:02PM +0800, Dec0y wrote:

Hi!

Can REDIRECT be realized in FORWARD?!

Pleae read http://www.netfilter.org/contact.html

you seem to be misunderstanding about everything in netfilter architecture.

FORWARD is a chain of the 'filter' table.
REDIRECT is a target in the 'nat' table.

So the answer is: no way.

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#2 lore raw

Can some body help me?

I want to Redirect all the packet through my Linux machine in the FORWARD of filter table by write a target, and I have realized it . But there is a little wrong with it.

The packets that will be processed(SNAT) in the POSTROUTING can be redirected correctly , But the packets that have been processed(DNAT) in the PREROUTING can't be redirected correctly.

My Network As follow:

+------------+                    192.168.0.1
|192.168.0.2 |---------------------|
+------------+            +--------+---------+192.168.2.1    +---------------+
                          |   Linux Machine  |---------------| 192.168.2.2   |
                          +--------+---------+               +---------------+
+------------+                     |192.168.1.1
|192.168.1.2 |---------------------+
+------------+

I have add the follwing rules:

iptables -t nat -A POSTROUTING -s 192.168.0.2 -d 0/0 -j SNAT --to 192.168.2.1 iptables -t nat -A PREROUTING -s 192.168.2.2 -d 192.168.2.1 -j DNAT --to 192.168.1.2

iptables -A FORWARD -s 192.168.0.2 -d 0/0 -j MY_TARGET iptables -A FORWARD -s 192.168.2.2 -d 192.168.1.2 -j MY_TARGET

I want to Redirect all the packet through my Linux machine in the FORWARD of filter table by MY_TARGET.

The packets that will be processed(SNAT) in the POSTROUTING can be redirected correctly , But the packets that have been processed(DNAT) in the PREROUTING can't be redirected correctly.

                         +-----------------------------------+
      src=192.168.0.2    |                  REDIRECT         |
SNAT: ------------------>|PREROUTING------->FORWARD---->...--|------->........
      dst=0/0            |                   dst=192.168.2.1 |      
                         +-----------------------------------+

the dst only change once from dst to 192.168.2.1

                         +--------------------------------------+
      src=192.168.2.2    |      dst=192.168.1.2  REDIRECT       |
DNAT: ------------------>|PREROUTING----------->FORWARD----->..-|------->........
      dst=192.168.2.1    |                       dst=192.168.2.1|            |      
                         +--------------------------------------+

the dst need to change twice !

Can some body help me?
__________________________________________________________

----- Original Message -----
From: Harald Welte
To: Dec0y
Cc: Netfilter Development Mailinglist
Sent: Friday, March 28, 2003 7:58 PM
Subject: Re: [netfilter-core] (no subject)

#3 lore raw
Quoted 3 lines

Can some body help me?

I want to Redirect all the packet through my Linux machine in the FORWARD of filter table by write a target, and I have realized it . But there is a little wrong with it.

Of course you can fit a second gear box in the middle of your car. Just don't ask the car manufacturer whether they could add it as an option, and how they would best integrate it. They'll answer that there's already a fully operational gear box in the place where it should be, and you are on your own fitting the second one.

I doubt that you will get more useful replies than the replies you got from Harald Welte, and now from me. If you do, unlikely as that is, please don't feel encouraged in any way.

best regards
Patrick