Skip to contentSkip to conversation

Chain traversal with multiple internal IP subnets.

DISCUSSION Antony Stone 2 participants 2 messages Sep 23, 2002 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 2 lines · Jared Brick

I have (for various reasons) a LAN with two gateways that internally use three different IP subnets (don't ask).

Okay ... :-)

Quoted 8 lines

However the other gateway is a Linux box with two IP addresses (it only acts as a gateway for two of the subnets) using Iptables. The gateway itself has static routes so that it can route between the different subnets, including the subnet for which it has no IP address. My question in which chain will a packet traverse when it is traveling between two different internal subnets. I think it is the FORWARD chain but my colleague feels it would be the OUTPUT chain. I ask because I am having trouble routing between the internal networks.

It is the FORWARD chain. The reasoning is simple:

Only packets which are destined for the machine running netfilter traverse the INPUT chain.

Only packets which are originated on the machine running netfilter traverse the OUTPUT chain.

Packets which originate on another machine and are destined for another machine only traverse the FORWARD chain.

Of course, the above statements are for the filter tables only - all packets coming in to a machine will traverse the PREROUTING chain (nat table) and all packets leaving a machine will traverse the POSTROUTING chain (nat table).

The PREROUTING chain in particular may change the selection about whether the packet terminates on this machine and enters the INPUT chain, or whether it goes on to some other machine and therefore enters the FORWARD chain.

Netfilter does not even care about packets which enter through an interface and then exit by the same interface - they still go through the FORWARD chain.

Hope this helps,

Antony.

Signature · 1 line
Which part of 'apt-get dist-upgrade' do you not understand ???
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Jared Brick

Hello everybody,

However the other gateway is a Linux box with two IP addresses (it only acts as a gateway for two of the subnets) using Iptables.

I'm not sure of your setup. Do you have one network interface per ip, or two ip's for the same interface?

Quoted 7 lines

The gateway
itself has static routes so that it can route between the different subnets, including the subnet for which it has no IP address. My question in which chain will a packet traverse when it is traveling between two different internal subnets. I think it is the FORWARD chain but my colleague feels it would be the OUTPUT chain. I ask because I am having trouble routing between the internal networks.

If you hare only using one network interface, then you will have troubles routing between the two subnets. Please see the recent thread in which this was discussed:
"Internal ip exiting network on firewall external nic despight rule" (http://lists.netfilter.org/pipermail/netfilter/2002-September/038510.html)

Quoted 2 lines

If anyone has any experience with a similar set up, any help would be much appreciated.

It seems to me that you do not need netfilter at all, as netfilter does not route packets. I recommend that you setup your linux router and make it work without netfilter. Then, if you want to restrict communication between the subnets, use netfilter.

Hope it helps.
Anders Fugmann