I have a test setup:
- server1:1.1.1.1
- server2:2.2.2.2
- client: 3.3.3.3
I'm trying to have client IP 3.3.3.3 do a HTTP request from the 1.1.1.1 server. However I want the 1.1.1.1 server to pass this request onto the real HTTPD server 2.2.2.2.
I would like 2.2.2.2 to directly talk to client 3.3.3.3 with the HTTP response.
I think however I require 1.1.1.1 to accept the HTTP request and then have it forward the request to 2.2.2.2 and have 2.2.2.2 respond then forward back to 3.3.3.3 with the resolution for this to work? Otherwise the client 3.3.3.3 will be getting a response back from 2.2.2.2 and not know why 2.2.2.2 is responding instead of 1.1.1.1 and ignore it?
Either way, this is what I tried via iptables
on 1.1.1.1:
iptables -t nat -A POSTROUTING -o venet0:0 -j SNAT --to-source 2.2.2.2
iptables -t nat -A PREROUTING -i venet0:0 -j DNAT --to-destination 2.2.2.2
iptables -t nat -A PREROUTING -d 3.3.3.3 -j DNAT --to-destination 2.2.2.2
iptables -t nat -A POSTROUTING -s 2.2.2.2 -j SNAT --to-source 3.3.3.3
This appeared to do no change.