I have a VPN tunnel established between 2 servers: VPS-A and VPS-B having the (fictional) public IP addresses: 66.55.44.33 and 77.88.55.66, and VPN endpoints 10.0.1.1 and 10.0.2.1 respectively.
There is a web server running on VPS-A. I can without a problem SSH to VPS-B and receive a response when issuing an HTTP request to 10.0.1.1 via curl for example:
curl http://10.0.1.1/
I can also open up a browser on any given computer connected to the Internet and successfully open
http://66.55.44.33/
...but I want to also be able to reach the web server at VPS-A by sending a request to VPS-B i.e.
http://77.88.55.66/
Now, I've added the following rule on VPS-B (edited to show the correct rule)
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.0.1.1:80
...and when I'm doing a tcpdump
on port 80, I can clearly see how requests to http://77.88.55.66/
are being properly forwarded to http://10.0.1.1
. However, the web server at VPS-A doesn't seem to acknowledge the TCP request. Here's what tcpdump shows exactly:
2013-04-27 03:45:15.001564 IP 45.248.82.171.51377 > 10.0.1.1.80: S 791893048:791
2013-04-27 03:45:15.252571 IP 45.248.82.171.51378 > 10.0.1.1.80: S 670490211:670
2013-04-27 03:45:18.001526 IP 45.248.82.171.51377 > 10.0.1.1.80: S 791893048:791
2013-04-27 03:45:18.258666 IP 45.248.82.171.51378 > 10.0.1.1.80: S 670490211:670
..while for a request coming through the VPN:
2013-04-27 04:26:57.464859 IP 10.0.2.1.33258 > 10.0.1.1.80: S 2369100373:2369100373(0) win 5744 <mss 1436,sackOK,timestamp 121795122 0,nop,wscale 7>
2013-04-27 04:26:57.464913 IP 10.0.1.1.80 > 10.0.2.1.33258: S 3524730589:3524730589(0) ack 2369100374 win 5744 <mss 1436,nop,nop,sackOK,nop,wscale 7>
2013-04-27 04:26:57.532428 IP 10.0.2.1.33258 > 10.0.1.1.80: . ack 1 win 45
I'm very new to Linux, so I'm sure I'm not doing something right, but I don't know what exactly. I tried searching for similar questions, but I didn't find anything. If someone can point me to a useful resource or give me a practical example - that would be great.
Thanks for your time reading my post!