Friday, October 2, 2009

The OSI model

You may be thinking..."Ahh gosh who needs to know the OSI Model? Its so simple! Its just seven little layers that I memorize using some sort of odd phrase such as 'Please do not throw sausage pizza away' or something similar"

The answer is simple...you need to know the foundation...even if it means re-learning something so trivial.

Remember small steps and eventually everything will become clear and you will obtain the most in depth of details.

So let us begin....

The model is as follows:

7. Application
6. Presentation
5. Session
4. Transport
3. Network
2. Data Link
1. Physical

And as I mentioned above, some commons ways to memorize the layers is using phrases such as "Please do not throw sausage pizza away" or "All people seem to need data processing". You'll likely never actually need to know or memorize these, unless you come across someone who has a lot of free time and happens to ask you for some odd reason or another.

Now one may say "Gosh this is very simple, I can memorize this, but why are you spending time on this?".

The answer is pretty simple:
1. The OSI model helps 'break down' network functions. Think of the foundation of a house. You can't build much of the house without setting up the foundation.
2. The OSI model creates a standard for equipment manufacturing....This way we can buy Cisco, Nortel and Juniper equipment and still have a functioning network.
3. The OSI model allows vendors to focus in on specialized areas of the networks.

I hope you're not bored yet....and if you are, take a breather and realize your motivations again. Remember you must 'Love Thy Network'!

Continuing onto the details of the OSI model....Let us go layer by layer starting from the top:

1. Application layer:
  • This layer interfaces with the application itself....Forgive the fairly obvious comment :)
  • This layer is able to provide network access to the application....think web browser, email, World of Warcraft, etc...
2. Presentation Layer:
  • "Generi-fies" the data that is to be presented to the layer above....Think of HTML, JPEG, etc...
  • This layer also provides Generic Encryption Services. This is useful, for example, when a client and webserver want to know how to speak
  • In general this layer is used to make data generic, compliant and standard
3. Session Layer:
  • Starts and ends sessions......Forgive me for the obvious again
  • Also logically keeps sessions separate
  • Issues requests to the layer below (Well isn't that a bit obvious?)

THIS IS WHERE I DRAW THE LINE....Why do you ask do I draw the line here? It's because the layers above (for all practical purposes) are not that important. In terms of pure networking knowledge the layers above all take place within the confines of a single machine....we're trying to re-aaquire our networking knowledge....so don't worry too much about what's above....lets move onto the important stuff....

4. Transport Layer:
  • I can't begin to tell you how important this layer is. This point alone is important enough to earn its own bullet point.
  • It really is that important....I'll give it another bullet point.
  • This layer dictates 'how' the data is sent....this is a high level description
  • It is at this layer we define well known services which run on ports. For example, how can a server know that incoming traffic is for its local web server as opposed to its local email server?
  • The decision of reliable vs un-reliable traffic is also decided here. Real time apps such as Voice over IP or Video usually use unreliable transport (who care's if you see a missing pixel here and there?) while everything else uses reliable transport. More details later....
5. Network Layer:
  • Provides "logical" addressing....this is where IP addresses are assigned
  • The Network layer has the job of finding the best/shortest path to the destination
6. Data Link Layer:
  • Provides "physical" addressing....we'll get into "physical" vs "logical" in more detail later on
  • Ensures that data is error-free
7. Physical layer:
  • Provides access to the cable
  • Electrical signals and one's and zero's go out here....
  • You don't need to worry 'too much' about this layer

Visuals always help so lets give you a before and after picture....here is the before:


Now lets go into some detail....about what happens when you use the internet!

Remember we are going from the top down on the left and then bottom up on the right. Also, it goes without saying, that as the packet goes from top to bottom on the left side it adds headers and information as it goes down the model. By the time we get to the bottom, everyone has added their 2 cents worth of information. What a democratic system indeed!

  • Let us assume there is a client on the left side (perhaps your pc) and they want to access cisco.com. We will assume for the moment that our IP address is 10.1.1.5.
  • The first thing that happens is that our request goes to a local DNS server, which translates cisco.com into an IP address....more on this later....just remember computers understand IP and not words like we do....that's why we need the IP address as opposed to the letters
  • DNS comes back and tells us that cisco.com is at 200.1.1.1...This is great news as we know how to reach the webserver that is hosting cisco.com!
  • So now we go down the OSI model....the Application layer requests a web page
  • The Presentation layer packages a request into an HTTP request, it then passes it down to the Session layer
  • The Session layer creates its own 'session'...we might have other things going on....online radio, itunes, etc...
  • Now we are in the most important layer....here we decide between reliable vs un-reliable or TCP(reliable) vs UDP(unreliable). In our example since we are using a web browser, we will choose to use the reliable TCP at this layer.....This will require an acknowledgment from the opposing side....more details on this later....
Now for some good stuff...just making sure you're still paying attention!
  • The session layer will team up with the transport layer to assign source and destination ports....why may you ask? Well the destination port number is necessary so that our message ends up at the correction location when it reaches its destination!
  • Wouldn't it be odd if you had to visit a friend in an apartment building but you didn't know his apartment number inside the building? That would be most odd indeed!
  • Since we are trying to communicate with the web server in our example here, the well known port number 80 is chosen here for HTTP traffic going to a web server.
  • Now the million dollar question....what is the source port number here? The answer is that it is dynamically assigned. Why do we need a source port number to begin with? So the webserver knows who to respond to when it comes back! Otherwise how will it know to send the homepage of cisco.com back to your specific web browser window? In our case here the source port number is 1098.
You're still there I hope! Insert snazzy comment here to keep you interested! Now, what happens next?
  • Moving onto the network layer....Here is where we will assign the source and destination IP address. In our example we have the source as 10.1.1.5 and the destination as 200.1.1.1. As a 'general' rule the IP addresses will never change as the packet progresses through the internet.
  • Now we come to the data link layer, where the source and destination mac addresses are added onto the packet.....You may now be asking "Why do we need both the source and destination mac addresses?"....Patience grasshopper, and all will come to you....
  • The source mac address is easy....if you don't know by now the mac address is the hard coded hex string that is burned onto your network card....so your machine will simply copy that value into the source mac address....In our example our mac address is 00-A0-15-11-B9-F2.
  • The destination mac address is a little tough....In our example we don't know the hard coded hex string that is burned onto the network card of the web server that is hosting cisco.com....so we simply add the mac address of our default gateway (our local router) and have him figure out the rest....way more detail on this later....For now, the mac address of our default gateway is 00-B9-11-11-22-22.
Many people ask....Why do we need an IP address AND a mac address....well the IP address is for end to end communication....think of it as a phone number to call your buddy....

The mac address is for local communication....think of it has the extension you may call (x4567) if you were in your office and wanted to speak to your neighboring cube.

One is for local and the other is for the end to end picture.

Here is the final picture.....with all the numbers mentioned above...






1 comment:

Followers