First of all, there are some limitations on Windows we need to be aware of:

  • Port of target SMB server must be 445;
  • For SMB server, the only loopback address Windows connects to is 127.0.0.1. Other loopback addresses 127.x.x.x won't work.

With these limitations in mind, we have a solution of following steps:

Disable Windows LanmanServer (Server) Service

Windows has a service named LanmanServer (Dispaly name: Server) running by default which binds to 0.0.0.0:445. We have to disable it first so that we can bind our forwarded SMB server on port 445.

sc.exe config LanmanServer start= disabled
sc.exe stop LanmanServer

If the commands above failed, you will need to disable the dependent service Browser first, and then try again.

sc.exe config Browser start= disabled
sc.exe stop Browser

A restart is requried to release the port 445.

Add Loopback Adapter

To generate more loopback addresses, we can add loopback adapters:

  • Run hdwwiz.exe (Add Hardware Wizard);
  • Choose "Install the hardware that I manually select from a list (Advanced)";
  • Choose "Network adapters" from the list;
  • Select Manufacturer "Microsoft" and Model "Microsoft KM-TEST Loopback Adapter";
  • Finish.

Add Network Adapters Select the device driver

You can now find the newly created network adapter in ncpa.cpl (Network Connections of Control Panel).

Network Connections

Configure the newly added loopback adapter

  • Right click the adapter, choose Properties;
  • Remove all the items except Internet Protocol Version 4 (TCP/IPv4) and the IPv6 one if you need it;
  • Configure to use a IP of your choice with subnet mask 255.255.255.255.

Loopback Adapter - Properties - IPv4 Properties

Forward remote SMB servers

Now you can forward multiple remote SMB servers to your local machine. One for each adapter you added as above using the configured IP, and one more for 127.0.0.1.

You may use ssh -L command, Bitvise SSH Client, putty, or any application of your choice to the actual forward.

Multiple Forwarded SMB Servers

Check your listening ports with resmon.exe (Resource Monitor):

Resource Monitor - Port 445

References