Daily Hacker

Monday 7 July 2014

How to Enable Remote Desktop Connection for Multiple Computers on a Network

Remote Desktop is great for connecting to a Windows computer from another part of the network. You can get access to local drives, printers, files, etc. as if you were sitting in front of it. While this is great, an issue arises when you have multiple computers on a network that you want access to from outside the network. Access from the inside is granted to every client with RDP enabled, but when you are outside the network and operating through a router, for example, connecting via RDP is only natively available for one computer. This is because all the computers in the network are using the same RDP port.

Consider this: Your desktop is set up for remote connections via the default RDP port. You’re at a friends house and you need access to your desktop. You would connect as usual, implicitly defining the default 3389 port. Your router at home is set up to forward these remote requests to your desktop. All is well until you need access to your laptop. The natural idea would be to define another rule in the router to forward another RDP request to the laptop. This is impossible, however, to have the router forward RDP requests to two computers without defining a different port between the two.

This is why we have to then explicitly create a new RDP port on the laptop, make the changes necessary for the router, and then you’ll be able to connect to either the laptop or desktop without issue.

Let’s see how that’s done.

Change the RDP Port Number in the Registry
Step 1. Find Regedit from the Start menu to open the Registry Editor.

Navigate through the folders on the left to find the RDP-Tcp folder in this path:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\WinStations\RDP-Tcp

We’re looking to change the DWORD (32-bit) Value for PortNumber.

It’s best to save yourself from possible future issues by backing up your registry. See how to backup your registry here.

Step 2. Double click PortNumber in the right pane and then select Decimal for the Base type. Selecting Hexadecimal would require you to know the equivalent hex value of the common decimal value.

The default value is 3389 but you can change it to anything you like. I find it useful to modify the digits up or down by only one value at a time for easy recall.

Note: If your ultimate plan is to make RDP port number changes to multiple computers on your network, it’s best to write down the computer and port number for later reference. These steps are the same for every computer you need to modify.

Allow the Port Through the Firewall
The port has been set so now we need to let the Windows Firewall know it’s a safe port to communicate through. By default, 3389 is allowed but since we’ve changed it, we need to make this firewall change as well.

Step 1. Search for Windows Firewall in the Start menu and click on Windows Firewall with Advanced Security.

Step 2. Right-click Inbound Rules and choose New Rule.

Step 3. We need to go through this wizard to finish the addition of this rule.  Select Port on the first step, then continue to the Protocols and Ports page.

Choose TCP and then enter the port you chose in the registry next to Specific local ports.

Click Next and choose Allow the connection in the Action window. The next page is for selecting the profiles in which this port should be allowed on. These will change according to your desire and necessity. I’ve kept all of these checked for myself.

The final step is to name the new rule. It’s helpful to indicate what this rule is for if you ever need to modify it in the future.

Follow these same steps on every machine that is undergoing the RDP port change.

Assign the Port Through the Router
Now that the port is set up and allowed through the firewall, the next task is to point the new port number to the specific internal IP address so that outside requests are understood properly.

Step 1. Open your router’s configuration page. Ours is http://192.168.1.2.

Step 2. Look for a Single Port Forwarding section like we did when setting up an FTP server.

Step 3. Enter a descriptive name for identifying the computer as well as the port number from the registry change.

For example, we’ve entered Desktop to indicate my computer and the External Port and Internal Port sections are filled in with the port number we changed above: 3388.

The local IP address is required for the destination address on the right, as seen in the above image. Find your local IP address by opening Command Prompt from the Start menu and entering ipconfig. Find the IPv4 Address of each computer and assign it to the port number and description in the router accordingly.

Connecting With the New Port
When the port is changed, connecting to the remote computer via Remote Desktop is a tad different. By default, the port 3389 is used and therefore no extra text is required when connecting. Because we’ve changed this port, however, we also have to change the way we connect.

With Remote Desktop open, you’ll need to enter the computer name in this format:

COMPUTER:PORT

Here are some examples from the port numbers we have changed and reflected in the router:

REMOTESERVER:3388
SERVERNAME:3387
COMPUTER:3386

REMOTESERVER, SERVERNAME, and COMPUTER will be the name of the computer you’re connecting to.

Conclusion
These instructions are vital for anyone wanting to access their computer on a network with other RDP clients already configured. Set these up and you’ll be able to access all your home laptops and other computers remotely, from anyone’s network.

No comments:

Post a Comment