Skip to contentSkip to conversation

FORWARD Chain Question

DISCUSSION Gene Dellinger 3 participants 4 messages Dec 12, 2005 – Dec 13, 2005 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

To All:
I got some helpful information, thanks to those who responded, I am still a bit fuzzy though.
A packet coming in ETH0 destined for a system connected to ETH1, will that packet begin in the PREROUTING
chain on ETH1(sample 1) and then out or go to the FORWARD chain(sample 2) and then out.

ETH0:PREROUTING---->FORWARD---->POSTROUTING---->OUT

         |	           |            |
       INPUT  	     |         OUTPUT
         |	          \|/	      |
      Local Process    |         Local Process
		           |
	   ----<---<-----|
	   |
        \|/
ETH1:PREROUTING---->FORWARD---->POSTROUTING---->OUT
         |			            |
       INPUT  		          OUTPUT
         |			            |
      Local Process		   Local Process

sample 1
_________________________________________________________

ETH0:PREROUTING---->FORWARD---->POSTROUTING---->OUT

         |	           |            |
       INPUT  	     |  	   OUTPUT
         |	          \|/	      |
     Local Process     |         Local Process
		           |
		           |
		           |
		          \|/
ETH1:PREROUTING---->FORWARD---->POSTROUTING---->OUT
         |			            |
       INPUT  		          OUTPUT
         |			            |

Local Process Local Process

sample 2
_________________________________________________________

Thanks Again
Gene D.

-----Original Message-----
From: Gene Dellinger [mailto:[email protected]]
Sent: Friday, December 09, 2005 2:40 PM
To: [email protected]
Subject: FORWARD Chain Question

On a multi-homed machine being used as a firewall, if a packet is forward'd from one interface to another. Does the packet enter the in at PRE-ROUTING portion of iptables chain again for that interface? It may seem obvious but I just want to make sure I am clear on that aspect of the chain traversal.

Thanks
Gene D.

#2 lore raw

Re: FORWARD Chain Question (nfcan: addressed to exclusive sender for this address)

Quoted 7 lines · On 2005.12.12 16:46, Gene Dellinger - [email protected] wrote:

To All:
I got some helpful information, thanks to those who responded, I am still a bit fuzzy though.
A packet coming in ETH0 destined for a system connected to ETH1, will that packet begin in the PREROUTING
chain on ETH1(sample 1) and then out or go to the FORWARD chain(sample 2) and then out.

Neither example matches the structure of netfilter. There is only one each of prerouting, forward, postrouting. There is not one chain per interface.
If you need to specify the interface in a rule,
you must use the -i and -o fields in that rule.
One or the other of these fields may not be useable in some chains.

Quoted 61 lines

ETH0:PREROUTING---->FORWARD---->POSTROUTING---->OUT

         |	           |            |
       INPUT  	     |         OUTPUT
         |	          \|/	      |
      Local Process    |         Local Process
		           |
	   ----<---<-----|
	   |
        \|/
ETH1:PREROUTING---->FORWARD---->POSTROUTING---->OUT
         |			            |
       INPUT  		          OUTPUT
         |			            |
      Local Process		   Local Process

sample 1
_________________________________________________________

ETH0:PREROUTING---->FORWARD---->POSTROUTING---->OUT

         |	           |          |
       INPUT  	   |  	    OUTPUT
         |	          \|/	      |
     Local Process       |      Local Process
		           |
		           |
		           |
		          \|/
ETH1:PREROUTING---->FORWARD---->POSTROUTING---->OUT
         |			            |
       INPUT  		          OUTPUT
         |			            |

Local Process Local Process

sample 2
_________________________________________________________

Thanks Again
Gene D.

-----Original Message-----
From: Gene Dellinger [mailto:[email protected]]
Sent: Friday, December 09, 2005 2:40 PM
To: [email protected]
Subject: FORWARD Chain Question

On a multi-homed machine being used as a firewall, if a packet is forward'd from one interface to another. Does the packet enter the in at PRE-ROUTING portion of iptables chain again for that interface? It may seem obvious but I just want to make sure I am clear on that aspect of the chain traversal.

Thanks
Gene D.

Signature · 4 lines
Jim Laurino
[email protected]
Please reply to the list.
Only mail from the listserver reaches this address.
#3 lore raw
In reply to Gene Dellinger
Quoted 8 lines · Gene Dellinger

To All:
I got some helpful information, thanks to those who responded, I am still a bit fuzzy though.
A packet coming in ETH0 destined for a system connected to ETH1, will that packet begin in the PREROUTING
chain on ETH1(sample 1) and then out or go to the FORWARD chain(sample 2) and then out.

Quoted 5 lines

ETH0:PREROUTING---->FORWARD---->POSTROUTING---->OUT

         |	           |            |
       INPUT  	     |         OUTPUT
         |	          \|/	      |
      Local Process    |         Local Process

As Jim already said, chain traversal isn't bound to interfaces by itself, but you can write rules that are related to a certain interface. If you take this picture (stolen from you and a little bit modified):

IN-->PREROUTING---->FORWARD---->POSTROUTING---->OUT

          |	                        |
        INPUT  	                      OUTPUT
          |                             |
          +------->Local Process------->+

then you have a simplified picture of what's going on (amongst others, nat and mangle table are missing and the optional raw table as well). Packets go through the above picture regardless of the interface (unless as Jim also said, you specify -i or -o).

HTH,

Joerg

#4 lore raw

Thanks to all,
All the information provided cleared things up for me.

Gene D.

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Jörg Harmuth
Sent: Tuesday, December 13, 2005 12:31 AM
To: [email protected]
Subject: Re: FORWARD Chain Question

Quoted 2 lines · Gene Dellinger

To All:
I got some helpful information, thanks to those who responded, I am still

a

Quoted 11 lines

bit fuzzy though.
A packet coming in ETH0 destined for a system connected to ETH1, will that packet begin in the PREROUTING
chain on ETH1(sample 1) and then out or go to the FORWARD chain(sample 2) and then out.

ETH0:PREROUTING---->FORWARD---->POSTROUTING---->OUT

         |	           |            |
       INPUT  	     |         OUTPUT
         |	          \|/	      |
      Local Process    |         Local Process

As Jim already said, chain traversal isn't bound to interfaces by itself, but you can write rules that are related to a certain interface. If you take this picture (stolen from you and a little bit modified):

IN-->PREROUTING---->FORWARD---->POSTROUTING---->OUT

          |	                        |
        INPUT  	                      OUTPUT
          |                             |
          +------->Local Process------->+

then you have a simplified picture of what's going on (amongst others, nat and mangle table are missing and the optional raw table as well). Packets go through the above picture regardless of the interface (unless as Jim also said, you specify -i or -o).

HTH,

Joerg