Skip to contentSkip to conversation

Routing packets with IPTABLES?

DISCUSSION Reginald NALLARATNAM 1 participant 1 message Feb 10, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

Hardware Layout:
Firewall #1: (Linux Box)
I have a linux box with 2 nics.
eth1 @ 192.168.20.1
eth0 @ 192.168.30.2
Gateway: 192.168.30.1

Firewall # 2: (Some other router)
interface 1: 192.168.20.2
interface 2: 192.168.30.2
Gateway: 192.168.30.1

Web server:
192.168.20.100
Gateway: 192.168.20.2 (Firewall # 2)

Gateway - is someother Firewall/Router that allows both firewall #1 and #2 to connect to the internet. 192.168.30.1

Question:
Is there a way to route incomming packets from the gateway to eth0 on firewall #1 based on source IP and destination Port to the web server @ 192.168.20.100?
The only way this will work if Firewall # 1 routes or forwards the packets to web server without connection tracking, since the return answer from web server will go through firewall # 2.

Could some give me an example or the command to do this using iptables, if not how else can this be done?

Thanks in advance.