Monday, December 22, 2008

Technology and Magic

Every few months, I am reminded that most people have no idea how the Internet or computers work. It usually occurs when my crescendo of frustration has reached its zenith. I finally lose it and somebody admits that this whole computer-interwebs thingy is like magic to them. And then, as I did today, I dig up an old John C. Dvorak column that I read years ago.

Dvorak:
Readers of this column understand the inner workings of their computer and the Internet. But many people don't understand these and most other modern technologies. The general public considers these technologies magic, although nobody would admit that publicly.

Let's look at it from the perspective of someone with no cultural clues—say, an alien or a hermit. You have a screen, a keyboard, and a mouse. You move the mouse, and a cursor magically moves around the screen. You have a keyboard on which you push buttons in various sequences, commanding something somewhere to produce a visual image on screen. This image may contain information you seek. It may show you a movie. People from other parts of the world can talk to you.

By any traditional definition, this is magic. Real magic, not trickery or stage magic.


How the Internet works shouldn't really be that much of a mystery to people. So, I will endeavor to explain the important parts. I will start at the beginning and end at the end, as best I can.

The foundation of the internet is a thing called an Internet Protocol address, which is more commonly known as an IP address. Think of it as your street address.

It is a set of four numbers between 0 and 255 separated by periods. My IP is currently 192.168.1.10. This IP happens to be in a special IP range because it starts with 192.168., but to keep it simple let's say that everybody on the whole internet has a unique address just like your street address.

Now, you know your address, but what good is that? Well, not much if you want to go somewhere else. So, you need to know how to get where you are going. That's why there is something called a subnet mask and default gateway (sometimes called a default route.)

The subnet mask tells your computer what's in your neighborhood, to continue the street address analogy. Your computer can find it's way around the neighborhood easily. Now, also imagine that your neighborhood happens to be one of those planned developments with a front gate that is the only way in or out onto the main road. Anytime you want to leave the community, whether to go to the grocery store or Alaska, you have to go out the front gate. The default route is like that front gate. Anytime you visit something that is not in your neighborhood, you go to the default route.

There's a person standing outside the front gate that gives directions. He's called a router. You go out the front gate and tell him where you want to go, and he either knows the directions, in which case he sends you in the right direction. Or he doesn't know and instead says, I don't know where you want to go, you need to take my default route.

Let's say that the router does not know the directions to where you want to go, and you take his default route. You then come to another router, tell her where you want to go, and the process repeats itself. Either she knows and she sends you in the right direction. Or she doesn't and you take her default route. Either way, eventually somebody will know how to get where you are going. The best part about all this is that the routers are monitoring the roads, and good ones will send you around traffic jams or roadblocks. Furthermore, the computer takes care of all of this and it happens almost instantaneously. All computers on the internet talk to each other this way.

However, going from one IP to another is not terribly useful to human beings. You as an internet user probably don't know your own IP. How the heck are you going to keep track of everybody else's IPs? Somebody invented a way to solve this problem, and it's called the Domain Name Service (DNS).

At some point either you or whomever configured your computer entered two IP addresses for DNS servers. Whenever you type a domain name into your browser or send an email, your computer connects to one of those DNS servers by the process I just described above with the routers.

Your computer says, "Hey, DNS server, somebody told me you know everybody's street address. Can you tell me Google's?" The DNS server now has to find the IP address for www.google.com so that it can tell your computer where to go.

Well, the DNS server doesn't actually know everybody's street address. It just knows the people to call to get it. There's different people to call for .com, .org, .gov, etc and he has a list. In this case, he's trying to find www.google.com, so he calls the .com guy.

"Hello, .com guy?"

"Oh, hi DNS server. What can I do for you?"

"I'm looking for google.com. Do you know him?"

"Sure, great guy that google.com. Here's his address..."

"Thanks."

Your DNS server then goes and talks to the Google.com DNS server.

"Hello, the .com guy said that you are the google.com server."

"Yep. That's me. How can I help you?"

"I'm looking for www.google.com. Do you know his address?"

"Absolutely. Here it is."

"Great thanks."

After all that your DNS server has www.google.com's IP address and tells your computer. Your computer then connects to www.google.com.

I've used the word server several times, and should probably explain what it is. Imagine servers as stores with customer service windows. A DNS server has the DNS customer service window open. A web server has the web service window open. An email server has the email service window open. In fact, one server could have several windows open and be a DNS, web, and email server simultaneously. It's just a matter of choosing which windows to staff.

Each server has 63 thousand something windows. Each is numbered, and your computer knows which number relates to which type of customer service. So, your computer knows that window number 80 is the one to go to for web pages and 25 is the one to drop off emails. In computer speak these customer service windows are called ports.

So, to recap, when you connect to www.google.com, this is what happens:
  1. Your computer sends a request to your DNS server asking for the IP address of www.google.com.
  2. Your message arrives at a router, where it is either told the directions to the DNS server or where to go to ask for directions, until it eventually finds its way to the DNS server.
  3. Once at your DNS server the message goes to port 53 (the customer service window used for name requests).
  4. Your DNS server then sends a message to customer service window 53 on the .com root DNS server asking for the IP address of google.com's DNS server, and gets an answer back.
  5. Your DNS server then sends a request to window 53 at google.com's DNS server asking for the IP address of www.google.com, and gets an answer back.
  6. Your DNS server tells your computer the address of www.google.com.
  7. Your computer sends a message to customer server window 80 on www.google.com, and gets a webpage in return.
Note: All of this happens almost instantaneously and all of these messages are routed in the exact same way as #2. So, whether it's from a request from one DNS server to another or your computer to www.google.com, they are all sent from router to router until the message finds its way.

Anyway, that's a basic overview of how the internet works. It's not magic. It's just a lot of very tiny steps happening very fast.

3 comments:

Miss Self-Important said...

But where? Where is teh internets? It's not on my screen. It's not on a server. If I took my computer apart, I wouldn't find it inside. If I can't see it, it don't exist.

FLG said...

Smartass.

Anonymous said...

I am going to have my wife read this.

The Maximum Leader

 
Creative Commons License
This work is licensed under a Creative Commons Attribution-No Derivative Works 3.0 United States License.