patience       tranquility
  
NBTSWikiWiki

How The Internet Works

Linking from GeekingConversation and expanding on Rael's explanation of how networks work I'm writing this. Platty thought I'd be a good one to ask, I figured I'd jump the gun and compose it now, since I'll enjoy it-- I loved David MacAulay's TheWayThingsWork books as a kid. I still think simple, correct explanations of things are very valuable.

It's surprisingly complex, like HowWikiWorks, but the steps can be numbered just the same to keep things in order.

First, we'll need some characters for the story: Marina, a happy computer user; paradoxical.nbtsc.org, a server (or just "paradoxical" for short); "At Home Cable", Marina's internet service, and a few other helpful people, daemons and computers along the way.

So, Marina wants to browse Wiki. Her computer has to connect to Wiki somehow, so this is what happens:

1. Marina turns on her computer and gets it in it's usual relatively working state. Since her computer is on a cable company's network, she's already connected to the internet, at least in theory.

2. She opens up a web browser, and types in "http://www.nbtsc.org/wiki/RecentChanges".

3. The browser program reads this URL and parses it, parsing being a nice process of cutting into pieces and trying to really understand what the URL means.

First, it sees "something:" and says, aha, this is a URL! Piece of cake!

Next, it looks closer, "what sort of URL?" "http". Aha! We're connecting to a webserver. That's pretty simple.

After that, it looks after the ":" and looks for which webserver to connect to -- in this case, "www.nbtsc.org".

Next, since it's already dealing with the URL, it looks to see what it's looking for on that server: "/wiki/RecentChanges".

4. The browser then starts it's network connection. It tells the network connection software to start a connection to "www.nbtsc.org". The computer has very little idea where this "www.nbtsc.org" thing is, just as little about "nbtsc.org", and so it runs a function (a short piece of program that's not big enough to get it's own program name) to see where to connect to.

5. This function looks in the computer's settings and sees that there is a "DNS server" setting, which is the address of a computer to talk to about getting the addresses of other computers. DNS stands for "Domain Name System". Domains are the parts of the names like "org" and "nbtsc.org", and they're set up so that all the information isn't stored in one place, but spread out, so that nbtsc.org takes care of all the information about nbtsc.org, and a few computers in charge of ".org" only know a bit about nbtsc.org, but they know a bit about all ".org" computers.

The function starts a network connection to the DNS server, which doesn't have a nice human-readable name like "dnsserver.home.com", it just has a number: "24.58.112.7", or similar. Marina's computer, too, has an address, one like "24.7.14.6". Since the computers have similar addresses -- they both start with 24, Marina's computer knows that the DNS server is close by. Not that close -- there's still 3 other parts that are different, but it's near.

6. Marina's computer has a vague feeling that "the internet is this way!", out her cable modem. All it knows for sure is that there's a computer with an address much like it's own on the other side of that wire, and Marina's computer has explicit instructions to send that computer (who's address is something like "24.7.14.1", very much like Marina's computer's) everything that it wants relayed out to "the internet". ("the internet" is defined as "any of the other computers out there past the one I'm talking to directly")

7. Marina's computer packages up a little message, that if it were email, would look like this:

 From: marina'scomputer (24.7.14.6)
 To: 24.58.112.7
 Subject: Could you look up a name for me? Thanks.
 I'm looking for www.nbtsc.org's address.  Can you help?
 -- 24.7.14.6

And it hands the message to it's neighbor over the cable (Think tin can on string), 24.7.14.1, who happens to be the neighborhood postal delivery agent, or "router". If it weren't a router, Marina's computer would either get a very quick, rude "What do you think I am, your slave?" from the other computer, or no reply at all. Thankfully, the nice At Home cable man set up the computer with the right address, so it's not a problem.

7. 24.7.14.1, the router, looks at the envelope of the message (and since it's an At Home computer, it probably opened it and read the contents, too.) It sees that it's not addressed to itself, and so it looks at all the tin cans on wires it has at it's house. It sees one labelled "The 24.58.112 network", which is as close as it can get to "24.58.112.7", picks up the can, and sends the message on.

8. A computer much like the last router, only with a different address, does much the same thing. The difference is, instead of just getting close, it realizes "Oh, that's my friend Dnsserver! He lives right below me!", and passes the message right through the mail slot in his floor, right into Dnsserver's hands.

9. Since Dnsserver is busy, it only looks at messages with a subject like the one Marina's computer sent -- thankfully, Marina's computer did it right and didn't get ignored. Dnsserver looks at it's list of names ... "hmm, www.nbtsc.org... nope... nbtsc.org ... nope... .org... yeah... okay, ask the .org computer about that... can do, can do...", and while muttering about it's job, fires off a message to one of the .org computers, very similar to the one from Marina's computer:

 From: At-Home Networks (24.58.112.7)
 To: the .org computer (12.68.97.3)
 Subject: Could you look up a name for me? Thanks.
 
 I'm looking for www.nbtsc.org's address.  Can you help?
 -- 24.58.112.7

It goes router to router to router (all messages are sort-of the same, I'll go into detail in a moment, when we send messages to nbtsc.org), until it gets to the .org computer. The .org computer is so busy (it also handles .com, .net, and all the other top level domains) that it just sends back a mumbled reply "I dunno, ask 193.57.33.5. They know all about nbtsc.org."

10. Dnsserver asks 193.57.33.5 about www.nbtsc.org. 193.57.33.5 responds like this:

 From: Name.Space, nbtsc.org's DNS server (193.57.33.5)
 To: At-Home's dnsserver (24.58.112.7)
 Subject: Re: Could you look up a name for me?
 Here's what you want to know about nbtsc.org:
    www.nbtsc.org's -real- name is paradoxical.nbtsc.org(isn't that cute!)
	paradoxical.nbtsc.org is at 64.255.211.149
    nbtsc.org's DNS is handled by me (Honest!), so just ask me next time
    the address might change soon, so ask me for the latest info if it's
been
    more than 6 hours since you last checked.
	--193.57.33.5

11. Dnsserver passes this back to Marina's computer, and there was great rejoicing.

12. Marina's computer forms a new message, and hands it to the At-Home router.

 From: Marina's Computer (24.14.7.6)
 To: paradoxical.nbtsc.org (64.255.211.149)
 Subject: Connect me to the webserver program, please.
 Message#: 1
 

13. The router looks at the address, realizes it's definately not in town, so it sends it to it's router that talks to Sprint's high-speed, long-distance network. The router there looks at the address and says "Aha! the 64.255 network! Seattle!"

14. The router in seattle says "Aha! the 64.255.211 network! Not Seattle, but Port Townsend! Excellent!" and sends it over the Sprint network to Port Townsend.

15. The router in Port Townsend says "Yup, this is ours. Goes to Port Townsend At-Home, actually!" and sends it off.

16. The At-Home Port Townsend router sees that it's for 64.255.211.149, and realizes that it's out in Cape George, and sends it to paradoxical, way out in rural Washington state. This entire trip from Santa Barbara At-Home to Port Townsend At-Home took about a fifteenth of a second.

It's so fast and so many people have worked to make it a reality, that most people never know this is happening, and even those involved don't really think about it unless it doesn't work and they need to figure out why. The way that you can ignore all the routing unless it breaks is called "protocol layering", and makes things ever so much simpler. Imagine how simple this would be if you didn't have to read anything but 7, 9, 10 and 12 in this list? Those are the next layer up, and what I'll show you from now on, and we can pretend that the computers in Port Townsend (paradoxical) and Santa Barbara (Marina's Computer) can just talk any time they want, and the message will be passed so fast that it might as well be instantaneous.

17. Paradoxical responds with this:

 From: paradoxical.nbtsc.org (64.255.211.149)
 To: Marina's Computer (24.14.7.6)
 Subject: Re: connect me to the webserver program, please.
 Message#: 1
 Okay.  Let's change the subject, though, so we can tell which messages are
 about which connection, eh?  I suggest this: "Re: web connection #60"

19. Marina's computer replies:

 From: Marina's Computer (24.14.7.6)
 To: paradoxical.nbtsc.org (64.255.211.149)
 Subject: Re: webserver connection #60
 Message#: 2
 Can you send me /wiki/RecentChanges please?

In real situations, it says something like this:

 GET /wiki/RecentChanges HTTP/1.1
 Host: www.nbtsc.org           (remember, that's what Marina typed)
 Accept-types: text/html image/jpeg image/gif text/plain

20. paradoxical's webserver program does all the figuring out what to send, and then sends it back in the reply:

 From: paradoxical.nbtsc.org (64.255.211.149)
 To: Marina's Computer (24.14.7.6)
 Subject: Re: webserver connection #60
 Message#: 2
 HTTP/1.1 200 (Ok, here you go!)
 Content-type: text/html
 
 .... and then the rest of the RecentChanges page
 

Which, since Marina's computer doesn't ask any other pages very soon after, is followed by this message:

 From: paradoxical.nbtsc.org (64.255.211.149)
 To: Marina's Computer (24.14.7.6)
 Subject: Re: webserver connection #60
 Message#: 2
 Guess we're done.  Bye!  If you want to talk to me, start a new
connection.

21. Marina's computer displays the page, and she clicks a link. Her computer does all the above steps for getting a page, except skips the whole DNS part, since it already knows that paradoxical is at 64.255.211.149, and will be for six hours (or if not, too damn bad. Thankfully, the address won't change unless the computer gets moved to another location, like Seattle)

 
NBTSWikiWiki | Recent Changes
Edited 1 times, last edited on December 4, 2001 by aredridel@nbtsc.org.
© 2000 NBTSC Webmasters
  
     
     
     
     
     
wisdom      clarity