We hear the word tunnelling a lot in the networking world.
Tunneling is a very very cool thing but it's not the easiest thing for you to wrap your mind around.
So I want to take a moment and talk about conceptually what tunneling is. Now
I'm the type of person who likes to access my home computer from the office and I use a program called
VNC.
Now VNC is a remote desktop program it's been around for a long time.
It's FREE.
It runs all these different operating systems and I've just gotten used to it and I like it.
So VNC works well. In order for me to use VNC
I have to well on my home machine.
I'll put a VNC server and have it running.
And then on whatever machine I want to access my server from I run a VNC client I make the connection
like this and I can just be typing away on this and it's as though I were literally sitting at my home
computer.
The downside to all this is that well VNC is unencrypted.
So anybody can intercept this data going back and forth between my computers and see what I'm doing.
So I'm not happy about that.
So if I want to encrypt this data I've got two choices.
Number one I can rewrite VNC and I'm such a great programmer I can rewrite VNC and put encryption into
it.
And people do that all the time for example Microsoft's Remote Desktop Protocol actually has its own
built in encryption.
Also you need to remember that
Remote Desktop protocol's a proprietary tool of Microsoft Corporation so they can pretty much do anything they
want.
So I could rewrite VNC and put encryption into it.
But the problem is is that the internet is filled with all of these unencrypted programs. There's zillions
of them out there emails and telnets and games.
It was never really designed to have encryption because it was going to be cool everybody was going
to love each other was going to be great.
It didn't happen that way.
So the onus of having to rewrite all of these programs, not really just the programs, rewrite the protocols
themselves that these programs are based on, to handle encryption is just crazy it's not going to happen.
So what we can do instead is we can take an existing program that's already running encryption like
ssh
in this particular example. And we can run the data through this program.
Now in order to appreciate that I have brought a couple of props.
Do you remember my ssh machines from earlier episodes?
I knew you liked them.
So what I'm going to do is I'm going to fire up ssh. This could be putty or whatever it might be the
popular ssh program and I'm going to make a connection between these two ssh systems now VNC is
not running at this point in the game.
It's not even on yet.
So what I've done is I've made an ssh connection here.
Now here's the part that's a little bit tricky.
Let's look at this end of the ssh connection.
This is let's say we're running putty the very very famous ssh program.
Now if you look at putty you can really kind of separate it into two pieces.
There's the part of putty which is the ssh endpoint that you can't really see it's just running and
it handles all the encryption and decryption and all that stuff.
And then there's also the interface the pretty little terminal screen that comes up when you type in
d i r and whatever it might be.
Normally with putty what we're doing is we're typing with our keyboard and it's taking the data directly
from whatever we're typing now it puts it up on the screen too.
But that's really just to help us as human beings.
It's taking keyboard input and it's sending it right into the ssh.
Equally it's also doing output and putting it up on the screen as necessary.
What I propose we do is that we're going to take ssh, now putty and all of these shh programs are programmed
to do this, and we can tell them hey program forget about this little terminal screen we want you to
take input directly from.
In this case the VNC client.
Pretty cool huh.
Equally it can do output and take it out to the VNC client.
There are settings in putty that you have to go into to configure it so that it will do this stuff.
All right.
Pretty much all ssh programs are designed to do this.
So what's going to take place now.
Oh we'll do it on this end too.
Sorry.
There we go.
All plugged in and ready to go.
So what happens now is anything that I'm typing in my VNC client.
It doesn't just go out on it's own connection to the VNC server it goes directly into my ssh. The
ssh encrypts it, runs it through the Internet,
all nice and encrypted over to this end, which decrypts it, and sends it out to the VNC server and it goes
back and forth like this.
So what we're really doing is we're piggybacking on ssh's ability to handle encrypted data.
So you've really got a program within a program and that my friends is really what a tunnel is. A tunnel
will always first manifest as you first startup some program.
In this case we're using ssh but there's lots of other forms of tunneling out there and in other episodes
we're going to talk about this. At this point
I just want you comfortable with the concept of tunneling. So we can plug them in.
We make the connection and then we take our applications on either end of that connection and we port
them not to talk to each other directly but to go through the tunnel itself.
And that's where the term tunnel came from.
Keep in mind with tunneling the number one reason we do it is to provide encryption where normally there
isn't.