changing destination address after routing



This is my situation, I have 2 NICs, eth0, and eth1 that are both
connected to the internet.

I want to access eth0 through subnet 192.168.1.0/24 and eth1 through
subnet 192.168.2.0/24. This would allow me to have, say, www.foo.com
available on eth0 through 192.168.1.1 and on eth1 through
192.168.2.1.

To achieve this I wanted to set up a route to eth0 on the
192.168.1.0/24 subnet and to eth1 on the 192.168.2.0/24 subnet in the
routing tables.

However, for it to make sense to the gateway after routing has
occurred, I would have to substitute in the IP of www.foo.com after
the routing has occurred.

I'm wondering if it's possible to have a destination address
translation after routing. The iptables man page seems to indicate
that this is not possible as you can only combine DNAT with PREROUTING
and OUTPUT, and POSTROUTING with SNAT. Why is this?

Is there another way to achieve what I am trying to do?

Thanks in advance.
.



Relevant Pages

  • Re: arping confusion multi-homed private networks
    ... These are DHCP/BOOTP over the servers eth1 device, ... also into a subnet 192.168.2.0/24. ... The eth0 and eth1 ...
    (comp.os.linux.networking)
  • Re: More help needed please
    ... [root@redfish root]# ifconfig eth0 ... # ifconfig eth1 ... That first routing entry should not be there and may be a bug. ...
    (RedHat)
  • Re: Routing
    ... I can ping hosts on the 192.168.3.0/24 network, ... Subject: Routing ...
    (Debian-User)
  • Re: Network Puzzle with 2 NICs
    ... Is that Your routing table? ... into that 192.168.0/24 subnet will be sent via eth1. ... So if one route matches the target, ...
    (comp.os.linux.networking)
  • Re: intermittent cable connection
    ... > Save the routing table at both times and compare them. ... network card fault is that even when network down, ...
    (comp.unix.admin)