Skip to contentSkip to conversation

How does iptables redirect a packet that is not addressed to its local machi

DISCUSSION Grace Li 2 participants 2 messages Apr 8, 2004 netfilter

lore
Share & tools
lore

Grace Li

author
#0 lore raw

[root@localhost grace]# iptables-save -t nat
# Generated by iptables-save v1.2.7a on Thu Apr 8 11:07:44 2004 *nat
:PREROUTING ACCEPT [1:229]
:POSTROUTING ACCEPT [4:240]
:OUTPUT ACCEPT [4:240]
-A PREROUTING -i eth0 -p tcp -m tcp --dport 1888 -j REDIRECT --to-ports 2000 COMMIT

Quoted 34 lines

From: Henrik Nordstrom <[email protected]>
To: Grace Li <[email protected]>
CC: [email protected]
Subject: Re: How does iptables redirect a packet that is not addressed to its local machine
Date: Thu, 8 Apr 2004 00:48:33 +0200 (CEST)

Quoted 3 lines · Grace Li

Hi,

I am just wondering if anybody could explain what happened in the

following experiments:

Quoted 3 lines

Client (192.168.1.134) tries to connect to port 1888 of Server (192.168.1.115) through Gateway (192.168.1.1). In the Gateway, the

iptables

Quoted 1 line

has been instructed to redirect traffic on port 1888 to 2000 (iptables

-t

Quoted 1 line

nat -A PREROUTING -i eth0 -p tcp --dport 1888 -j REDIRECT -to-port 2000

).

Works here...

Quoted 1 line

The results of my experiments is that the application on Gateway who

listens

Quoted 2 lines

to port 2000 could not get anything, while Server receives everything expected on its port 1888. So my question is that did iptables do

anything

Quoted 1 line

here?

No idea. This is a kind of thing which has always worked for me, but you are the second person in a few days reporting this is not working..

Quoted 7 lines

Exacly what kernel and iptables version are you using on the gateway?

What does "iptables-save -t nat" give?

Regards
Henrik

_________________________________________________________________
Add photos to your e-mail with MSN Premium. Get 2 months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines

#1 lore raw
Quoted 8 lines · Grace Li

[root@localhost grace]# iptables-save -t nat
# Generated by iptables-save v1.2.7a on Thu Apr 8 11:07:44 2004 *nat
:PREROUTING ACCEPT [1:229]
:POSTROUTING ACCEPT [4:240]
:OUTPUT ACCEPT [4:240]
-A PREROUTING -i eth0 -p tcp -m tcp --dport 1888 -j REDIRECT --to-ports 2000 COMMIT

Ok, and which kernel version?

Regards
Henrik