Need help with a proxy setup

Hi,

I have a problem on hand that I can't solve myself and if anybody could help that'd be great.

I have 2 machines, the first one (lets call M1) sits on 2 networks (therefore has 2 network cards) and the second one (lets call M2) only sits on one.

I want to use M1 to setup a proxy such that:

All the traffic coming in from eth1 on M1 would be redirected out of eth0 to M2 and M2 will respond with the packets through M1. The packets from M2 will go to eth0 on M1 and be redirected again out of eth1 to the client.

All the traffic coming in from eth0 on M1 would still go out of eth0 to M2 and M2 will respond with the packets through M1 like before. The packets from M2 will go to eth0 on M1 and go out of eth0 on M1 to the client.

As an additional complication. I have another machine M3 that M2 replicates its mysql data to. So any proxy setup can't affect the replication. M2 also has two network cards but only 1 is public that's the one M2 is using to communicate to M1.

I'm not sure what to do to achieve the above. Any help would be greatly apprecipated. I have root access on both machines so installing things shouldn't be a problem. Although M2 is a production machine so i'd like to avoid running any kernel recompilation or anything. All the machines are running Debian Sarge.

I currently have the following rules in iproute2 on M1 to ensure what comes in on eth0 goes out on eth0 and what comes in on eth1 goes out of eth1.

debian:~# cat /home/bitziz/ip_route
ip route add 221.238.129.0/24 dev eth1 src 221.238.129.165 table Telecom
ip route add default via 221.238.129.161 table Telecom
ip route add 127.0.0.0/8 dev lo table Telecom

ip route add 60.28.128.0/24 dev eth0 src 60.28.128.34 table CNC
ip route add default via 60.28.128.33 table CNC
ip route add 127.0.0.0/8 dev lo table CNC

ip route add 221.238.129.0/24 dev eth1 src 221.238.129.165
ip route add 60.28.128.0/24 dev eth0 src 60.28.128.34

ip route add default via 221.238.129.165

ip rule add from 221.238.129.165 table Telecom
ip rule add from 60.28.128.34 table CNC

 

 

 

 

Top