Advanced Port redirection Windows Firewall

I need to redirect some ports on Windows. What i want is to messure the traffic on a specific port (445, SMB).

My proxy runs on the same machine. The problem is i cant change the port 445. So my proxy can listen on it and redirect it to the windows SMB server.

[Server, SMB]:445 -> [RROXY]:8445 -> [Windows FW]:445 -> [CLIENT]

My client must connect on port 445

I need some firewall magic.

  • Windows FW redirects port/interface 10.0.0.1:445 to 127.0.0.1:8445 (befor the SMB service)
  • My proxy listen on 127.0.0.1:8445
  • redirect traffic to 127.0.0.1:445

is this possible, if yes, then how ?


Solution 1:

You might be looking for Port Forwarding in Windows.

Since Windows XP there is a built-in ability in Microsoft Windows to set up network ports forwarding. With it, any incoming TCP connection (IPv4 or IPv6) to local port can be redirected to another local port or even to port on the remote computer, without the need for a service that listens on this port.

To set it up, use the netsh command.

The syntax is :

netsh interface portproxy add v4tov4 listenaddress=localaddress listenport=localport connectaddress=destaddress connectport=destport

where

  • listenaddress – is a local IP address waiting for a connection.
  • listenport – local listening TCP port (the connection is waited on it).
  • connectaddress – is a local or remote IP address (or DNS name) to which the incoming connection will be redirected.
  • connectport – is a TCP port to which the connection from listenport is forwarded to.

For more information see :

  • Port Forwarding in Windows
  • Windows Netsh Interface Portproxy