NAT & Forwarding issue
Hello there,
I have a quite interesting issue which I can't seem to be able to crack down myself. I have 2 machines A and B A has 3 public ip addresses: 123.123.123.123 (eth0) 124.124.124.124 (eth0:0) 125.125.125.125 (eth0:1) B has 1 ip address: 233.233.233.233 (eth0) i have several services on both machines, each service runs on a different port: machine A: Service1 port 27015 bound to 123.123.123.123 Service2 port 27025 bound to 123.123.123.123 Service3 port 27035 bound to 123.123.123.123 Service4 port 27045 bound to 124.124.124.124 ... machine B Service 1 port 27055 Service 2 port 27065 ... Due to reasons I am trying to forward the traffic in machine A within the machine itself and outside to machine B as following: 123.123.123.123:27045 -> 124.124.124.124:27045 123.123.123.123:27055 -> 233.233.233.233:27055 However it's not quite clear how I should do that using iptables. my current iptables configuration is as follows (on machine A): Quote:
The issue is that with that specific set of rules, the incoming traffic is correctly forwarded, however, when I try to bind my Service2 on machine A to ip 124.124.124.124 it sees it as internal IP and uses 123.123.123.123 for outbound communications instead. Obviously I'm trying to get the service to bind to 124.124.124.124. I can successfully bind to the right IP if i don't add this rule: Quote:
Do you guys know what i should do in order for this to work? Greetings, Nikooo777 |
If you have a static IP, you should use SNAT instead of MASQUERADE and specify the interface where you want source nat to apply.
|
All times are GMT -5. The time now is 07:01 AM. |