Windows Server 2012 Port Forward for Specifc Host

I am trying to have a specific host be redirected to another port when trying to access a service on port 80.

So, when the client (192.168.1.22) requests a connection to the server (192.168.1.10) on port 80 I would like the server to redirect the request to another port (9080).

Is this something that can be done? I can do it with a custom firewall rule in Linux (iptables) but I need to do this with Windows.

So, client connects to port 80 on the server and is redirected to port 9080. All other clients connect per usual (port 80).


Solution 1:

You'll need to use the console:

netsh interface portproxy add v4tov4 listenport={number outside} connectport={port inside} connectaddress={127.0.0.1/destination IP}

Sources:

https://social.technet.microsoft.com/Forums/windows/en-US/417fcbcd-169d-4f7a-8f3a-7a00a91bad66/windows-2012-firewall-port-forwarding?forum=winservercore

https://technet.microsoft.com/en-us/library/cc731068(v=ws.10).aspx

Solution 2:

Yes. Yes you can. Take a look at the rule scope, specifically look for the section titled: "Which remote IP address does this rule match"

DO IT! DO IT NOW!

From there it's trivial to make the firewall action do what you want by forwarding that client to another port.