DNATing from two ISP's into a single server
Jake L. Wegman
Fri, 25 Jan 2002 15:57:12 -0600
[forwarding tcp port 1327 from two ISP's into local LAN]
This is not appearing to be as easy as it first seemed.
> eth0 -> 10.0.0.139 (tcp port 1327)
With the linux box's default route going through eth1, I can connect to
eth1's IP and successfully DNAT into 10.0.0.139. However if I attempt to
connect with eth2's IP, I see the traffic arriving (tcpdump on eth2), but no
replies. When monitoring eth0 I see no traffic sent to 10.0.0.139 as there
If I swap the default route to eth2 I can then connect with eth2's IP and
DNAT into 10.0.0.139. However I now experience the problem when attempting
to connect with eth1's IP - I see no traffic forwarded onto 10.0.0.139.
In short, DNAT is only working when the traffic arrives on the default
Would someone be able to offer some assistance to the router challenged?
From: Sumit Pandya [mailto:email@example.com]
Sent: Friday, January 25, 2002 8:10 AM
Subject: RE: DNATing from two ISP's into a single server
From: "Jake L. Wegman" <firstname.lastname@example.org>
> My goal is to DNAT into an internal server from either of the two ISP's...
> Linux box with three interfaces;
> eth0 - Internal interface
> eth1 - SDSL ISP
> eth2 - Cable ISP
> Linux box has default route through eth1
> I would like all tcp port 1327 traffic sent to eth1's IP or eth2 IP to be
> DNATed into 10.0.0.193 on eth0.
iptables -t nat -I PREROUTING -i eth1 --protocol tcp \
--destination-port 1327 -j DNAT --to-destination 10.0.0.193
Apply same rule for eth2 and udp if you requires.
> I would like the responding traffic to
> traverse back on the interfaces that it originated from.
No need to worry about back route it is taken care by "conntrack" part.