On my local machine, I want to setup a (web-)server that receives data that is sent (via http/https) to IP 65.55.44.109 (vortex.data.micorosoft.com).
In order to do that, I need to forward all IP traffic on 65.55.44.109
to 127.0.0.1
on MY machine, so that I can make the hosts-file-entry
65.55.44.109 somedomain.com
and then open the browser on that machine and enter http://somedomain.com
and get the webpage from the webserver at 127.0.0.1.
Now of course that will only work on the machine with the hosts-file entry (my machine).
On Linux, I can do this with
iptables -t nat -A OUTPUT -d 65.55.44.109 -j DNAT --to-destination 127.0.0.1
(need to re-add on restart)
On Windows, I haven't been able to figure out how to do this. The closest thing I've come accross is
netsh interface portproxy add v4tov4 listenaddress=65.55.44.109 listenport=80 connectaddress=127.0.0.1 connectport=80
but that doesn't work, and I have no idea why.
Is there anything I do wrong ? Or is there anything else I can do ?
I also read this:
http://www.itprotoday.com/virtualization/nat-forwarding-switch-windows-10-and-windows-server-2016
and so I thought the following might work
Add-NetNatStaticMapping -NatName NATnetwork -Protocol TCP -ExternalIPAddress 65.55.44.109 -InternalIPAddress 127.0.0.1 -InternalPort 80 -ExternalPort 80
but I only get an error (invalid classname), with no further information to be found via google.
Can this be done somehow on Windows (Windows 10) ?
Note:
It's sufficient to forward only port 80, but all ports would be nicer.
NO loopback or non-loopback-interface with IP 65.55.44.109 may be created on the host-machine.
It must absolutely be done via DNAT-only.
The host-machine does not have a network-interface with IP 65.55.44.109, only 192.168.x.x.
Just setting the hosts-file to
127.0.0.1 somedomain.com
is also insufficient, because then any call for dns-address-resolution of somedomain.com will yield the IP 127.0.0.1 instead of 65.55.44.109