Jul 212012
 
 July 21, 2012  Posted by at 11:09 am Not So Stupid Questions  Add comments

[To celebrate my first year of programming I will ask a ‘stupid’ questions daily on my blog for a year, to make sure I learn at least 365 new things during my second year as a developer]

So, how does remote desktop work?


So we set up a server yesterday, and I started thinking- how does this really work? I’ll be setting up several virtual environments and labs so I can have a fast and stable learning environment. I have quite a few things on my I-would-love-to-learn-list, and setting up a server will make it easier for me. But, anyways- to the question! How does this work? My computer, remote desktop client and a server at home. What is the magic?

It goes something like this:
On your phone, tablet or computer when you aren’t connected on the same network as at home but you want to access for example a server (or a computer) at home (and it has to be turned on), then you can use a program called Remote Desktop. This program will allow you to connect to another computer first through a router where you are, then the router at hom (not on the drawing for simplicity, it’s actually severeal routers involved),- in this case my server at home. The gatekeeper is my router, it decides what goes in and what goes out. Like the door to my house.

The adress to the house is my public IP-adress. I said public, because there are private IP-adresses as well and I’ll soon explain the importance of them. The door has several ports, or entrance codes if you like. So to get in you need the IP adress and a port. If you don’t give the program a port it will use the default port :3389. But you still can’t get in. I will have to tell my router to allow access through the port and which local IP it should send yout to. I will have to activate the code so it will open the door for you/me. Once you get through the door you will go through a routingtable, this will match you to the local IP adress.

A little illustration I made

Inside the house I have several devices, and they all have their own adresses, local IP’s. And how do the devices get their local IP’s ? This is done through a service that is attached to the router, called DHCP, Dynamic Host Configuration Protocol- or through a static adress. But then what happens when different local IP’s want to get out just one public IP? Another service called NAT , Network Adress Translator, converts the local IP to that one public IP.
So you’ve opened the remote desktop program, and entered the adress to where you want to go. Once you get to the door you get sent to the correct device/host. The server (in this case) will do all the work, and the the result will be sent back through the router to your program on your device and the result will be displayed on a graphical interface (what you see- the ‘images’)- all this in a few milliseconds.

– note: you go through several routers not just one, but for simplicity I’ve talked mostly about the router at home- as most routers work kind of the same way. But this is more complex than this, but for me this explanation (if it is right haha) will do for now 🙂

EDIT:
Here is how it may look when you log on to the router. You can see my laptop and the server. To access a device you need the name or the local IP (local IP is shown next to the name, but I’ve cut it out of the picture 😉 )

My router interface

  6 Responses to “‘Stupid’ Question 4: How does remote desktop work with private servers?”

  1. Hi Iris, I happen to be working to connect my Windows 7 Pro machine directly (via ethernet cable) to a server. (The server doesn’t have a monitor, it’s designed to be adminisstered remotely.) I got the server a VERY long time ago and have not used it. The problem is that I don’t know the server’s computer name. It’s running Windows Server 2008 64-bit. Do you know if there is a way to connect without the server’s computer name???? (Now who has the stupid question?)

  2. Hi Bob!
    Not a stupid question 🙂 Make sure the server is connected to the network and log into the router and look which devices are connected, you should find the server there. Use the name or the IP-adress, I’ve added an image of my routers interface to the blog post.
    In case you don’t see it there, then it is not connected. Connect to a monitor, mouse and keyboard and connect the server to the network. Use the command prompt to get the IP and name by writing ipconfig and hit enter.
    Was this what you meant?

  3. Yes, exactly! Thanks Iris! 🙂

  4. If you use a network scanner to scan the subnet range it will return all active hosts on the subnet. This will give you the IP address.

  5. Generally RDP is quite unsecure, for a bit of fun try tunnelling the remote desktop connection through an SSH connection for a secure, encrypted connection, from seeing your blog it seems like the kind of geeky thing you’re into.
    Basically the setup is as in the diagram above except the external connection between machines is SSH rather than RDP, usually using port 22 rather than 3389. You have a SSH server on your server machine and something like puTTY on your client which authenticates the secure connection using either a password based login or a certificate, then at either end you forward the traffic to/from the listening RDP port (3389) which is closed off to the outside world, so internally the remote desktop client just sees RDP as normal. Most routers allow port forwarding to be set up pretty easily.
    Nice blog btw I’m in the process of setting up a software dev blog with some Android tutorials and stuff which should be live in the next week or so and have been checking out other people’s blogs for a bit of inspiration. Keep up the stupid questions, stupidest questions are the ones you don’t ask.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

What is 15 + 3 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)