5

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).

2 Answers 2

2

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

1
  • This doesn't work for me either. Apr 13, 2017 at 7:51
1

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.

3
  • That doesn't actualyy appear to work. If you specify a different external and internal port they don't forward. Unless you managed to get it to work?
    – jjross
    Dec 31, 2014 at 3:12
  • @jjross Yep, it's just a basic port forwarding rule. Something else must be messed up somewhere. You might want to use NetworkMonitor to track down where the packets are going.
    – Wesley
    Dec 31, 2014 at 3:15
  • 2
    Can you elaborate on what "trivial" is to configure actions in windows based off a fw block/allow? I can't think of anyway to do what the OP is asking. Unfortunately win fw < iptables when it comes to that kind of flexibility.
    – Jacob
    Jan 30, 2015 at 8:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .