How-to DNAT-forward all IP traffic on Windows 10 from IP1 to IP2?

Solution 1:

This may be an old one but there's no answers and 2k views.

The reason why netsh interface portproxy add v4tov4 listenaddress=65.55.44.109 listenport=80 connectaddress=127.0.0.1 connectport=80 doesn't work is because you don't actually have an interface 65.55.44.109.

But you can add it, as long as you're happy for all your traffic to go to it regardless of port.

  1. Press Win+R -> ncpa.cpl.

  2. Right click your LAN / WAN network adapter and select properties.

  3. I the list of items/protocols, select Internet Protocol Version 4 (TCP/IPv4) and click Properties.

  4. Make sure DHCP is switched off. If you need to determine what static settings to enter, then from a command prompt run ipconfig /all and note the IP address, subnet mask, gateway and DNS server(s) for the interface. Populate these settings in the dialogue.

  5. Click the Advanced button.

  6. Under the IP Addresses list, click the Add button.

  7. Enter the IP address required, eg 65.55.44.109.

  8. Enter the Subnet Mask 255.255.255.255.

  9. Click OK and Apply etc. Now you have bound the IP address to your interface, and your route tables will have been updated accordingly so traffic to this address does not get sent straight to the gateway.

After these steps, you have 2 options. You can either have your App bind to all addresses (0.0.0.0:0), or you can bind it to 65.55.44.109. These options mean you don't need to use netsh portproxy. Otherwise, if your application binding is strictly on the loopback interface with address 127.0.0.1:80 then just run original netsh portproxy command you quoted above and it will work.

Happy spoofing.