Remote Desktop Connection between PCs -- Must they both be in the same Subnet?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
39 replies · 7K views
Messages
7,822
Reaction score
13,151
TL;DR
Trying to connect desktop-desktop or device-device remotely.
Hi, just looking at RDP connections
https://support.microsoft.com/en-us/help/4028379/windows-10-how-to-use-remote-desktop

It would seem the two devices would have to be within the same LAN, right? Otherwise, how is just the computer name enough information to set up a connection? It seems for a connection string we would need to know more details than just the name (I doubt all the needed information is encoded under the computer name)
 
Physics news on Phys.org
  • Like
Likes   Reactions: WWGD
Wrichik Basu said:
You are right, both computers need to be on the same network. But there are some workarounds too; see this site, for example:
https://www.howtogeek.com/131961/how-to-access-windows-remote-desktop-over-the-internet/

I personally prefer Teamviewer for remote connections compared to Windows remote desktop. The former is easier to set up compared to the latter, especially when the machines are not on the same network.
Thank you, I agree and have tried it but I am following up on a list for a data job interview. Same for using Python Jupyter/Anaconda.

Would a connection string allow you to connect outside of the LAN/Subnet (EDIT: if permissions were granted)?
 
  • Like
Likes   Reactions: WWGD
I am having some strange issues trying to access my SQL Server from within the command line; cannot use ODBC because my SQL Server is connecting through named pipes. Maybe I can go to configuration manager or Control Panel and change the protocols used.
 
Remote desktop is not the way forward here.

WWGD said:
... my SQL Server is connecting through named pipes.
This does not make sense - your SQL Server instance doesn't have to connect to anything. Do you mean you are using named pipes to connect a SQL Studio instance to your SQL Server instance?

Named pipes are only used for connecting locally i.e. on the same machine. Do you already know how to connect from another machine over the LAN? Connecting from a remote network is the same, except you need to let your router know what to let through and where to connect it to - this is called port forwarding. This is a home setup with a direct connection to the internet right? You aren't behind some corporate or other firewall?

What are you actually trying to do?
 
pbuk said:
Remote desktop is not the way forward here.This does not make sense - your SQL Server instance doesn't have to connect to anything. Do you mean you are using named pipes to connect a SQL Studio instance to your SQL Server instance?

Named pipes are only used for connecting locally i.e. on the same machine. Do you already know how to connect from another machine over the LAN? Connecting from a remote network is the same, except you need to let your router know what to let through and where to connect it to - this is called port forwarding. This is a home setup with a direct connection to the internet right? You aren't behind some corporate or other firewall?

What are you actually trying to do?
I was trying to access SQL Server from the command line within the same machine.

Error message was:
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server
 
WWGD said:
I was trying to access SQL Server from the command line within the same machine.
If you can't do that then the last thing you want to do is introduce other variables by trying to connect from outside the LAN.
 
pbuk said:
If you can't do that then the last thing you want to do is introduce other variables by trying to connect from outside the LAN.
I understand, thanks, I was also trying to connect locally; all part of interview skills list. I don't have access to another computer to try remote access. Sorry for my sloppy way of doing things; seems confusing to all but me :).
 
WWGD said:
I started it through MSSM.
What is shown in the Named Pipes Properties dialog box in MSSM SSMS?

Edit: and what connection string are you using:
Code:
\\.\pipe\sql\query
?
 
  • Like
Likes   Reactions: WWGD
pbuk said:
If you can't do that then the last thing you want to do is introduce other variables by trying to connect from outside the LAN.
I understand, thanks, I was also trying to connect locally; all part of interview skills list. I don't have access to another computer to try remote access.
The network protocol is set to <default> and options are not enabled:

1579225147558.png
 
pbuk said:
Hmmm, dunno, sorry :frown:

If you just want to play with a SQL Server instance you could open an Azure account?
Hey, nothing to be sorry about; I've learned more from you in a few weeks than in years. Seriously, thanks so much. Will check out Azure.
 
rbelli1 said:
Use the VPN option in that link. If you use the port forwarding option you will very quickly be hacked.

BoB
True but , it takes $$$ for quality VPN last I checked.
 
Last edited:
WWGD said:
True but , it takes $$$$ for quality VPN last I checked.
Lol. . . what went wrong with your post ?

It should look like this. . . . 🤔

1579246059993.png


.
 
WWGD said:
Did you guess it or how else you figured?
Refresh the page and watch. . . 😉

.
 
  • Like
Likes   Reactions: WWGD
WWGD said:
True but , it takes $$$ for quality VPN last I checked.

I was thinking that you could set up a VPN on your firewall. Use client certificates for the best security.

BoB
 
WWGD said:
Aren't quality VPNs expensive?
pbuk said:
Unless you use it twice of course!
Only if you use it twice. . . . 😛 .
Lol. . . . 🤦‍♂️

.
 
OCR said:
Only if you use it twice. . . . 😛 .
Lol. . . . 🤦‍♂️

.
Actually, any odd numbers will do. I will print dollars signs 1,2,3,4,5,6. Let's see which show up:
1)$
2)$$
3)$$$
4)$$$$
5)$$$$$
 
WWGD said:
How about portforwarding to a VM?
If you can't even access it on the same machine/VM then how are you going to access it remotely? Just to check a couple of things, you are running this console in the same OS instance as the SQL Server, yes? Or are you running the console on a host and the SQL Server instance in a VM - in which case local named pipes won't work? Have you tried accessing via a port i.e. localhost:1433?

Also, I can't see the important setting in the screenshot below:
WWGD said:
... the crucial setting is in the 'Server Properties' dialog box hidden under the 'Connection Properties' box. If you select 'Connections' it should show a list including 'Named Pipes: Enabled', and 'TCP/IP: Enabled' if you want to access via a port (i.e. localhost:1433).
 
In other words, try all of the following in a console on whatever OS instance is running SQL Server.
Code:
sqlcmd
sqlcmd –S tcp:127.0.0.1,1433
sqlcmd –S np:\\127.0.0.1\pipe\sql\query