While the method below is not a best practice on proper IP forwarding, it was a method I had to revert to in order to work around a limitation of an old legacy application that offered no other way to connect to an end point that was on a different IP than the one that was hardcoded within the app itself.
The idea here is to change or route the IP to a different one than the app wants to connect to. Both IPs are external and the redirection needs to happen on the client (Windows) machine itself.
For instance, the app wants to connect to 3.4.5.6, but the real endpoint is at 9.8.7.6. With no means to change the hardcoded IP, routing or mapping it is a way to get around it.
On Windows, this can be done in 3 steps:
- Create a new loopback interface on the Windows machine:
pnputil /add-driver %windir%\inf\netloop.inf /installdevmgmt.msc- Action → Add legacy hardware
- Install the hardware that I manually select from a list
- Category: Network adapters → Microsoft (left) → Microsoft KM-TEST Loopback Adapter (right)
- Finish
- You should now see a new adapter (e.g., “Ethernet 2”)
- Assign the IP to the loopback interface, for instance 3.4.5.6. In Powershell:
$loop = (Get-NetAdapter | Where-Object {$_.InterfaceDescription -like 'Loopback'}).NameNew-NetIPAddress -InterfaceAlias $loop -IPAddress 3.4.5.6 -PrefixLength 32 -SkipAsSource $trueSet-NetIPAddress -InterfaceAlias $loop -IPAddress 3.4.5.6 -SkipAsSource $false
- Use a utility such as nmap to set up a redirection from 3.4.5.6 to 9.8.7.6
ncat -vv -4 -l 3.4.5.6 8080 -k -e "ncat -vv -4 9.8.7.6 8080"
