Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables redirect question.

Reply
Thread Tools Display Modes

iptables redirect question.

 
 
yozhang@gmail.com
Guest
Posts: n/a

 
      12-08-2005, 11:04 PM
Hi,

I have a question on the use of iptables. If I run the following
command:

iptables -t nat -A OUTPUT --dport 80 -j REDIRECT --to-port 3333

How the packet will be processed by the iptables?

-->PREROUTING------->FORWRD------------>POSTROUTING
| |
| |
| |
INPUT OUTPUT
| |
| |
local process

According to man page:
REDIRECT
This target is only valid in the nat table, in the PREROUTING and
OUTPUT chains, and user-defined chains which are only called from those
chains. It alters the destination IP address to send the packet to the
machine itself (locally-generated packets are mapped to the 127.0.0.1
address).


Does the packet still have destination's Address after it pass the
OUTPUT block? If the packet received by port 3333 does not have the
destination IP address, how the server behind the port 3333 to get the
dst ip to communicates with the real destination?

Does this packet need to first pass the POSTROUTING, then come in
through PREROUTING, INPUT block to reach port 3333? Or it has some
shortcut?


Thanks!

Yong

 
Reply With Quote
 
 
 
 
Robert
Guest
Posts: n/a

 
      12-09-2005, 09:22 PM
On Thu, 08 Dec 2005 16:04:47 -0800, yozhang wrote:

> Hi,
>
> I have a question on the use of iptables. If I run the following
> command:
>
> iptables -t nat -A OUTPUT --dport 80 -j REDIRECT --to-port 3333
>
> Does the packet still have destination's Address after it pass the
> OUTPUT block?


Yes, the only thing you have changed is the destination port that the
packet was heading to.


--

Regards
Robert

Smile... it increases your face value!


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ip address redirect with iptables adam Linux Networking 2 09-09-2005 02:02 AM
iptables? redirect? M3ntos Linux Networking 3 05-20-2005 08:16 AM
Iptables {DNAT,REDIRECT} Akede Linux Networking 1 10-07-2004 03:06 AM
Iptables SSL redirect Fritz Bayer Linux Networking 6 07-20-2004 06:08 AM
iptables redirect = ! ipsec0 DaemonB Linux Networking 0 09-02-2003 07:23 AM



1 2 3 4 5 6 7 8 9 10 11