Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm a networking noob, so sorry for the very generic title. I have the network setup in the following way:

image

A few details about the network:

  • eth0 on all the devices have an in IP in 10.10.10.0 subnet, which is accessible from our intranet
  • eth1 on machine 1 is connected via a private network to eth1 on machine 2
  • eth1 on machine 3 is connected via a private network to eth2 on machine 2
  • eth1 and eth2 on machine 2 are bridged
  • eth1 and eth2 on machine 2 don't have IPs

Machine 1 has to communicate with machine 3 via the bridge on machine 2. I have the routes setup on all the machines for this. That is, when traffic is sent from eth1 on machine 1, it reaches at eth1 on machine 2, and sent out from eth2 on machine 2 to eth1 on machine 3. This works perfectly fine.

The problem that I have is when machine 2 does NATing (which is NOT done using iptables, but by a program that I don't have control over). What the program does is assigns an IP of eth0 on machine 2 as the source IP when it forwards the packets to machine 3. So when machine 3 has to reply back, it sees the source on the 10.10.0.0 subnet, and routes the packet from eth0 on machine 3 to eth0 on machine 2.

My question: How can I route the packet from machine 3 to arrive on eth2 on machine 2?

The only control I have over that program that does the NATing is telling it what source IP to use when NATing. eth1 and eth2 on machine 2 don't have IPs, so the only IPs that I can use are the aliases I have for eth0 on machine 2.

share|improve this question
1  
Confusing to me that a bridge (a layer 2 function) is performing NAT (a layer 3 function). –  SpacemanSpiff Dec 7 '11 at 8:21
    
@SpacemanSpiff: The bridge isn't performing NAT. The software that I'm running on the machine where the bridge is located is performing NAT. –  Networking Noob Dec 7 '11 at 9:02
    
The diagram also shows two cables into eth0 of M2? A little confusing. Do you mean to say eth0 on all 3 devices are connected to the same switch? As for the NAT, I can't be sure without the configuration, but the easiest way to do this would be a static NAT 1-to-1 relationship with M1, and another with M3. –  SpacemanSpiff Dec 7 '11 at 10:48
add comment

1 Answer

up vote 2 down vote accepted

Having pondered, I think you can set the route on M3 to ( the eth0 address of M1 ) via ( eth1 on M3 ), where M1=machine1, and so on. Where 10.10.10.x is M1's eth0 address, try

M3% route add -host 10.10.10.x dev eth1

You should be able to verify that, on M3, responses to packets from M1's address are going out eth1 not eth0, by using tcpdump. Note that this in no way guarantees that M2 will do the correct thing with them; it should only send them back the way they came in, and hopefully M2 will de-NAT them and send them on to M1.

share|improve this answer
    
You're the man. M2 did the correct thing. Even though I wasn't able to ping the 10.10.10.x address, the traffic was processed by the program running on M2 and everything went as expected. –  Networking Noob Dec 12 '11 at 10:58
    
Glad you got it working, and thanks for letting us know. –  MadHatter Dec 12 '11 at 13:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.