Networking Forums

Networking Forums > Computer Networking > Linux Networking > changing destination address after routing

Reply
Thread Tools Display Modes

changing destination address after routing

 
 
jois.de.vivre@gmail.com
Guest
Posts: n/a

 
      05-29-2008, 09:06 PM
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.
 
Reply With Quote
 
 
 
 
David Schwartz
Guest
Posts: n/a

 
      05-29-2008, 11:15 PM
On May 29, 2:06*pm, jois.de.vi...@gmail.com wrote:
> 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 ofwww.foo.comafter
> 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.


I have read this three times and I still have absolutely no idea what
you're trying to do.

Do you want to assign the machine two different addresses in two
different networks on two different interfaces? If so, what's the
problem with just configuring each interface for the appropriate IP
address and connecting it to the appropriate network?

DS
 
Reply With Quote
 
Pascal Hambourg
Guest
Posts: n/a

 
      05-29-2008, 11:16 PM
Hello,

(E-Mail Removed) a écrit :
> 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.


Substitute what for what exactly ?

> 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?


Because it would not make much sense. Routing says how to reach a
destination. If you change the destination after the route has been
decided, there is little chance the packet is delivered.

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


Sorry, I don't even understant what you want to achieve.
 
Reply With Quote
 
Unruh
Guest
Posts: n/a

 
      05-30-2008, 12:23 AM
David Schwartz <(E-Mail Removed)> writes:

>On May 29, 2:06=A0pm, jois.de.vi...@gmail.com wrote:
>> 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. =A0This 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 ofwww.foo.comafter
>> the routing has occurred.
>>
>> I'm wondering if it's possible to have a destination address
>> translation after routing. =A0The 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. =A0Why is this?


No. The internet runs on IP addresses not names. The DNS server or
/etc/hosts file is therer to translate names to IP addresses, but once you
have put the stuff onto the net, no names are ever used.


>>
>> Is there another way to achieve what I am trying to do?
>>
>> Thanks in advance.


>I have read this three times and I still have absolutely no idea what
>you're trying to do.


>Do you want to assign the machine two different addresses in two
>different networks on two different interfaces? If so, what's the
>problem with just configuring each interface for the appropriate IP
>address and connecting it to the appropriate network?


>DS

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
routing by destination port kamilnew@gmail.com Linux Networking 1 08-29-2007 07:17 PM
setting destination MAC address Tom V Linux Networking 2 02-20-2007 04:55 PM
multiple ethernet interfaces, routing depending on destination smagister@gmail.com Linux Networking 1 02-04-2007 06:10 PM
Tracing my MAC Address at destination Hufnus Linux Networking 1 05-16-2006 11:23 PM
needs to know destination address from syn packet kosaraju.puneeth@gmail.com Linux Networking 1 03-22-2006 10:57 AM



1 2 3 4 5 6 7 8 9 10 11