The suggested masquerade NAT rule is incorrect.
I'd like to disagree.
You should specify src-address of CUSTOMERIP instead of dst-address.
The only packets with src-address=CUSTOMERIP coming to router will be already part of established connections. They don't need any extra rules.
Additionally, if there are multiple public IPs on this router, you will need to specify which one to appear as using the src-nat action instead of masquerade.
It doesn't really matter, it can be any address that will lead the reply packets back to router.
Last, the web server will reply on a random high port, so it will not be coming FROM 4343 back out the router, so we drop those matchers.
It's TCP, once the connection is established, the ports don't change.
-
So, are we really talking about the same thing?
With just this:
/ip firewall nat
add action=dst-nat chain=dstnat disabled=no dst-address=PublicIP dst-port=443 \
protocol=tcp to-addresses=CustomerIP to-ports=4343
It will be like this:
1.) User tries to connect to PublicIP:443 (way 1)
2.) Router will forward the packet to CustomerIP:4343 (way 3)
3.) Server will see packet from UserIP (assuming something does not block it on the way for having seemingly spoofed source)
4.) Server will send reply directly to UserIP (way 2)
5.) User will discard the reply, because it does not expect anything from CustomerIP (more likely the firewall on User's router will drop it as invalid)
With additional rule:
/ip firewall nat
add action=masquerade chain=srcnat dst-address=CustomerIP \
dst-port=4343 protocol=tcp
It will be like this:
1.) User tries to connect to PublicIP:443 (way 1)
2.) Router will forward the packet to CustomerIP:4343 (way 3)
3.) New rule will catch the outgoing packet to CustomerIP:4343 and change source to PublicIP (* or any other IP on Router)
4.) Server will see packet from PublicIP (*)
5.) Server sends the reply to PublicIP (*) (way 3)
6.) Thanks to connection tracking, Router will know where the reply packet belongs to, it will automatically rewrite its source address from CustomerIP to PublicIP and send it back to UserIP (way 1)
7.) User will get reply from PublicIP as expected
8.) User is happy, because it works
It's poor man's reverse proxy. It kind of sucks (e.g. there's no way for Server to know User's address), but it works. Try it. I did.
You do not have the required permissions to view the files attached to this post.