Networking 101: The lowdown on how Networks really work (Part 1 of 2)

Have you wondered exactly how your computer can communicate with another computer half way around the world?  Maybe you’ve read my guide on how Wi-Fi works but you still want to go deeper.

How do networks really work?

Most of us flip open our laptops or whip out our smartphones and are instantly connected to the interwebs.  It’s like magic.  We don’t think about all the digital alchemy going on behind the scenes.

In this guide I wanted to pull the curtain back to allow you to peer into how networks really work.  It’s a two part series.  In this first part you’ll learn:

  • How computers “think” about network communication
  • The OSI model, the TCP/IP model and why no one cares

Then in the second part you’ll get your feet wet swimming through:

  • Encapsulation and De-encapsulation
  • Analyzing a real packet capture to understand networking
  • A networking secret that almost no one knows about

Let’s dive in!

Getting inside the “Mind” of your computer

Your computer doesn’t really have a mind but it certainly has a method of doing things doesn’t it?  Today I want to investigate what really happens when your computer attempts to communicate with another device on your network.

Basic Networking

First we’re going to talk about a few models.

No, I’m not talking about Gisele Bündchen.  I’m talking about the less glamorous Open System Interconnect (OSI) and TCP/IP models.

In the context of network communication, a model is just a set of standards.  It’s a collection of rules that devices subscribe to.

Think about your job for a moment.

If you work in an office you probably have a Director who reports to a Senior VP who reports to an Executive VP who reports to the head honcho who sits in his aerie eating grapes while being fanned by Gisele Bündchen.

When the Director has a question he typically doesn’t go directly to the CEO.  He has to follow policies and procedures for escalations.  There’s a structured process of communication with different people.  Similarly, there’s a structured method of communicating with other protocols on your computer.Ask the CEO

You are the CEO

Imagine yourself as that CEO sitting at the top of a colossal bureaucratic company.  You need to schedule a lunch meeting with the CEO of another large bureaucratic company called Giant Company Co.

Since you have hundreds of thousands of minions working for you – there’s no need to stretch over to get the phone and dial the CEO of Giant Company Co.  All you need to do is to ask your Secretary for a little help.

So you tell your Secretary:

Hey Gisele, can you schedule a lunch meeting with the CEO of Giant Company Co?

She smiles and starts riffling through a bunch of calendars to check availability.  Normally she would send an email but there’s a global network outage currently preventing anyone from using digital communication.

Once she finds a good time, she prints it out and hands her request to a guy in the company known as the Translator.

Please note that the message she hands to the Translator is a little different than your original request.  She injected a few things like her personality and sense of humor in the message.  But the bottom line is that she provides a service to you, the CEO.

When the Translator gets the message, he starts formatting and sprucing it up so that it looks good to the CEO of Giant Company Co.  He may also scramble the message (encrypt it) so that only the Giant Company Co CEO can understand it.

Once the Translator finishes his job, he adds his personal comments to the message and sends it down to the Lawyer.

Remember, these are two bureaucratic companies with copious red tape so you can’t just send something directly to the destination.  There’s a process you have to follow.

The Lawyer needs to setup a deal between both parties.  He negotiates the terms of agreement that will be used to transfer the message.  Once he finishes the legalese, he sends the message down to the Operations Manager.

So far, keep in mind that everyone from the Secretary, Translator, and Lawyer took your original message and added a little bit of information to it before sending it on to the next person.  This is a really important thing to keep in mind as you consider how network devices communicate.

So what happens now?

The Operations Manager has to figure out how to deliver the message.  There are really two options: He can either send the message with confirmation via the United States Postal Service (USPS) or he can send it on a postcard without caring about acknowledgment.

He can use a tracking number for confirmation. Furthermore, if the message is too big he can segment the message into parts. Then he can label each segment and assign a unique tracking number to it.  After doing this, he would walk over to the Mail Room and hand it to the Mail Clerk.

The Mail Clerk’s job is to take all the message segments and slap on an address.  She starts sticking labels on each segment which has a from and to address.  The from address is the address of your corporate headquarters and the to address is the street  address of the Giant Company Co.

You could call this a logical address and it’s nothing more than the numerical street address of the business.

Alright so where were we?  Oh yes, so the Mail Clerk finishes and hands the message down to a Mail Stuffer.

The Mail Stuffer, takes all the message segments with address labels and stuffs them in individual envelopes.  Then he puts the envelope in the correct Box number.  Since these are big companies with hundreds of thousands of employees and departments, each department gets its own mailbox.

When the delivery truck hauls the message to Giant Company Co’s headquarters, it needs to know which physical box to put the message in so it can know which department gets the message.

So the Mail Stuffer adds the physical addresses.  This is his chief duty.

Next he gives it to the freight truck driver who is responsible for physically transporting the message to the destination.

Oh wait, the freight truck is tantamount to dial-up connection so let’s change the analogy a little.  Let’s have the Stuffer hand the message to a spoiled college student with the Nissan GTR NISMO.

The affluent kid races across the country to get your message to the final destination. (this is analogous to a broadband cable modem connection)

What happens at the destination?

What happens when the message arrives at Giant Company Co?  Does the college student just get out of his sports car with the message, strut into the CEO’s office and hand it to him?

Nope.  He has to follow the rules.  First, he puts it in the correct physical mailbox.  Everyone at the destination also has a Mail Stuffer, Mail Clerk, Operations Manager, Lawyer, Translator and Secretary.

So the Mail Stuffer opens the message and throws away the wrapping before giving it to the Mail Clerk.  Next, the Mail Clerk opens each of the envelopes and hands each message segment up to to the Operations Manager.

Since you sent the message with confirmation (think: certified mail), the Operations’s Manager sends an acknowledgement back to your company confirming that he received the message.  Next he strips away all the tracking numbers and gives the message to his Lawyer.

The Lawyer says:

We’re on good speaking terms with that company.  We can pass this on to the Translator.

The Translator decrypts the message and verifies the format is good for the CEO.  Then he passes it on to the Secretary.

The Secretary reads the message and then delivers it to the CEO.

This is a really good way to think about what happens when a computer needs to communicate with another device on a network.

Let me show you what I’m talking about.  First let’s enumerate the cast of characters here.

We had:

  1. You, the CEO of your company.
  2. Your Secretary
  3. The Translator
  4. A Lawyer
  5. Operations Manager
  6. Mail Clerk
  7. Mail Stuffer
  8. Crazy college kid in a Nissan GTR

We had the same roles for the people at the destination.

These are 8 layers which roughly correspond to the 8 layers of the OSI model.  The 8th layer, which is often forgotten, is the People Layer.  It’s the person interacting with the computer.  In our analogy this is you, the CEO.  The end user is always at the 8th layer.

The 7th layer is the Application Layer.  It’s responsible for providing a service to the user in the 8th layer.  It isn’t the application itself.

In other words, the 7th layer isn’t Internet Explorer or Microsoft Exchange or Skype.  The Application Layer just makes services available to the people who use them.  For example, it’s not the printer but the printer spooler that lives in the Application Layer.  It’s not your Chrome web browser but the protocol that provides a service to the web browser: HTTP.

Got it?

Alright, so let’s keep moving down the chain.

The Translator in our little story is analogous to the Presentation Layer.  Layer 6 is responsible for compressing, formatting and encrypting data to make it presentable to the destination computer.

Layer 5 is the Session Layer.  Just as the Lawyer sets up the deal and negotiates the communication paths, so the Session Layer negotiates and manages all the communication paths between both machines.

Layer 4 is the Transport Layer.  Remember, the Operations Manager needed to figure out how to transport the message: reliably or unreliably.  In the same way, the Transport layer can use TCP (Transmission Control Protocol) which is the reliable way to transmit data because it uses acknowledgements.  Or the Transport layer can use an unreliable transport mechanism (UDP User Datagram Protocol).

TCP is slower and a more cumbersome but it guarantees that the recipient will receive the data.  UDP is faster but there’s no guarantee that the destination will get your message segment.  Also if there’s a huge block of data, the Transport layer might chop up the message into segments to ease the delivery burden.

Let’s continue our walk down the OSI Layer Stack

Layer 3 is the Network Layer: It’s the Mail Clerk.

The logical address is nothing more than a street name and house number. That’s what an IP address is.

The first part of the IP address designates the network (the street) that the second part, the host (house number), lives on.  An IP address is just bunch of numbers with a network portion and an host portion (a street name and house number).  This information is added at Layer 3.

Routers live here and can be thought of as street intersections.

A router as a cartoon

An intersection of two streets is a router.

An intersection of two networks always converges at a router because each interface (network jack) on a router is its own distinct network.  The router receives the packet of information and looks up which street (which network) it should forward the message to.

Then the Network layer sticks its own information to the message and sends it down to Layer 2.

Do you remember who did all the work at layer 2?

Yup, Layer 2 is the Mail Stuffer.  In technical terms, the Mail Stuffer is responsible for framing the packet.  She has to figure out the correct envelope to put the packet into.  For example, if I’m using the fixedByVonnie frame, the destination also needs to be using the fixedByVonnie frame.   Furthermore, to make this work you need to put the physical address in the message (the PO box)

Each computer on a network has a network interface card (NIC) which has a permanent, unique, burned-in Address (BIA). When a frame is being sent at Layer 2, it needs to include both the physical address of the sender and the physical address of the next device in the chain of devices responsible for delivering the frame to its final destination.

So if your computer is connected to a router, which is connected to the internet, and you’re trying to open, your computer is going to send the frame to the physical address of your default router.

The source address will be the physical address of your computer and the destination address will be the physical address of your default router.  When the router gets the frame, it strips off the framing and looks up where it should forward the packet.  Then it adds new framing using its physical address as the new source physical address and the next router as the destination physical address.

This stripping and adding of frames continues until the message ends up at the destination.  The IP address never changes but the physical address (also known as the Media Access Control address or MAC for short) is always being stripped and reframed as the message moves along to its ultimate destination.

Incidentally, this is why we need both IP addresses and MAC addresses.

Layer 2 passes the frame to the Physical Layer.

Now we’re talking about the physical bits that we send across the network.  Since a bit can only have two states: on or off, you need a way to represent that.

You can change the voltage on copper wire to represent 1’s and 0’s or on wireless networks, you can modulate the radio frequency to represent 1’s and 0’s.  You could even use light to represents on and off patterns.

Think of it like the Morse Code. You can use dots and dashes to send information.  Sending data is just a collection of billions of ones and zeros racing through copper, glass or air.

Bits are sent one at a time and both devices are programmed to understand the same rules which makes communication possible.

The OSI Model

The Bottom Line

What’s the reason for this model?  The OSI model is important because it helps us understand how computers think about network communication.  The TCP/IP model is more important because it’s what we actually use in networks today.

Remember what each layer does.

Before you finish this guide I have a challenge for you:

Find a co-worker, friend, relative, wife haha, anyone willing to listen to 10 minutes of geekdom and tell them how computers communicate.  If you can explain everything I just shared with you in your own words then you understand the rudimentary concepts of how computers talk to one another.

Now obviously, there are a billion details that we didn’t discuss but I just wanted you to get a broad overview of computer communication so that when we move into more advanced topics you won’t be confounded.

In the next article we’ll explore real packet captures so you can see how the layers match up in real life.

Let’s do this man!


Connect with Vonnie on Twitter

Posted in Hardware, What Is Tagged with: ,