Rewrite an internal IP destination to an external IP destination
I have a weird "lab" request. I test hardware that is designed to be locally connected to a machine that has a client installed. It will only talk to the server (192.168.0.1:443) if the client ip is in that same subnet.
client ip =192.168.0.100
server ip = 192.168.0.1
This works no problem.
The issue I have is I need the server to reside on another network accessible via public IP. This is so I can test the software against the hardware that exists in a remote lab. What i want to do is redirect all traffic destined for 192.168.0.1 (internal) to 188.8.131.52 (external). The server will accept a connection from any ip address it is the client software that has a problem.
Here is a rough diagram:
Pfsense 192.168.0.254 LAN GW
| 184.108.40.206 (public IP)
remote FW (220.127.116.11)
server 192.168.0.1 (port forwarding setup to forward 18.104.22.168:443 to 192.168.0.1)
I want to have pfsense take traffic destined for 192.168.0.1:443 on the LAN interface and redirect to the external interface re-writing the destination to 22.214.171.124:443
*caveat: the client software requires that the configured server address (192.168.0.1) be a member of the local subnet on the machine. in other words the client local adapter cannot be 172.16.0.100 and the server be 192.168.0.1.
At first you have to add the fictive server address 192.168.0.1 to the pfSense LAN interface as an IP alias. Firewall > Virtual IP.
Then add a port forwarding rule:
Protocol: <set it="" to="" match="" your="" needs="">source: 192.168.0.100
Destination port range: HTTPS
Redirect target IP: 126.96.36.199
Redirect target port: HTTPS
That should work for you.</set>