Wednesday, April 1, 2009

Lesson 2: OSI Reference Model

This lesson covers the OSI reference model. It is sometimes also called ISO or 7 layer reference model. The model was developed by the International Standards Organization in the early 1980's. It describes the principles for interconnection of computer systems in an Open System Interconnection environment.

The Agenda

- The Layered Model

- Layers 1 & 2: Physical & Data Link Layers

- Layer 3: Network Layer

- Layers 4–7: Transport, Session, Presentation, and Application Layers

The Layered Model

The concept of layered communication is essential to ensuring interoperability of all the pieces of a network. To introduce the process of layered communication, let’s take a look at a simple example.

In this image, the goal is to get a message from Location A to Location B. The sender doesn’t know what language the receiver speaks – so the sender passes the message on to a translator.
The translator, while not concerned with the content of the message, will translate it into a language that may be globally understood by most, if not all translators – thus it doesn’t matter what language the final recipient speaks. In this example, the language is Dutch. The translator also indicates what the language type is, and then passes the message to an administrative assistant.
The administrative assistant, while not concerned with the language, or the message, will work to ensure the reliable delivery of the message to the destination. In this example, she will attach the fax number, and then fax the document to the destination – Location B.

The document is received by an administrative assistant at Location B. The assistant at Location B may even call the assistant at Location A to let her know the fax was properly received.
The assistant at Location B will then pass the message to the translator at her office. The translator will see that the message is in Dutch. The translator, knowing that the person to whom the message is addressed only speaks French, will translate the message so the recipient can properly read the message. This completes the process of moving information from one location to another.

Upon closer study of the process employed to communicate, you will notice that communication took place at different layers. At layer 1, the administrative assistants communicated with each other. At layer 2, the translators communicated with each other. And, at layer 3 the sender was able to communicate with the recipient.

Why a Layered Network Model.........?

That’s essentially the same thing that goes in networking with the OSI model. This image illustrates the model.


So, why use a layered network model in the first place? Well, a layered network model does a number of things. It reduces the complexity of the problems from one large one to seven smaller ones. It allows the standardization of interfaces among devices. It also facilitates modular engineering so engineers can work on one layer of the network model without being concerned with what happens at another layer. This modularity both accelerates evolution of technology and finally teaching and learning by dividing the complexity of internetworking into discrete, more easily learned operation subsets.
Note that a layered model does not define or constrain an implementation; it provides a framework. Implementations, therefore, do not conform to the OSI reference model, but they do conform to the standards developed from the OSI reference model principles.

Devices Function at Layers

Let’s put this in some context. You are already familiar with different networking devices such as hubs, switches, and routers. Each of these devices operate at a different level of the OSI Model.
NIC cards receive information from upper level applications and properly package data for transmission on to the network media. Essentially, NIC cards live at the lower four layers of the OSI Model.
Hubs, whether Ethernet, or FDDI, live at the physical layer. They are only concerned with passing bits from one station to other connected stations on the network. They do not filter any traffic.
Bridges and switches on the other hand, will filter traffic and build bridging and switching tables in order to keep track of what device is connected to what port.
Routers, or the technology of routing, lives at layer 3.
These are the layers people are referring to when they speak of “layer 2” or “layer 3” devices.
Let’s take a closer look at the model.

Host Layers & Media Layers

Host Layers :-

The upper four layers, Application, Presentation, Session, and Transport, are responsible for accurate data delivery between computers. The tasks or functions of these upper four layers must “interoperate” with the upper four layers in the system being communicated with.

Media Layers :-

The lower three layers – Network, Data Link and Physical -- are called the media layers. The media layers are responsible for seeing that the information does indeed arrive at the destination for which it was intended.

Peer-to-Peer Communications

Let’s see how these layers work in a Peer to Peer Communications Network. In this exercise we will package information and move it from Host A, across network lines to Host B.
Each layer uses its own layer protocol to communicate with its peer layer in the other system. Each layer’s protocol exchanges information, called protocol data units (PDUs), between peer layers.
This peer-layer protocol communication is achieved by using the services of the layers below it. The layer below any current or active layer provides its services to the current layer.
The transport layer will insure that data is kept segmented or separated from one other data. At the network layer we get packets that begin to be assembled. At the data link layer those packets become frames and then at the physical layer those frames go out on the wires from one host to the other host as bits

Data Encapsulation

This whole process of moving data from host A to host B is known as data encapsulation – the data is being wrapped in the appropriate protocol header so it can be properly received.
Let’s say we compose an email that we wish to send from system A to system B. The application we are using is Eudora. We write the letter and then hit send. Now, the computer translates the numbers into ASCII and then into binary (1s and 0s). If the email is a long one, then it is broken up and mailed in pieces. This all happens by the time the data reaches the Transport layer.

At the network layer, a network header is added to the data. This header contains information required to complete the transfer, such as source and destination logical addresses.

The packet from the network layer is then passed to the data link layer where a frame header and a frame trailer are added thus creating a data link frame.

Finally, the physical layer provides a service to the data link layer. This service includes encoding the data link frame into a pattern of 1s and 0s for transmission on the medium (usually a wire).

Layers 1 & 2: Physical & Data Link Layers

Now let’s take a look at each of the layers in a bit more detail and with some context. For Layers 1 and 2, we’re going to look at physical device addressing, and the resolution of such addresses when they are unknown.

Physical and Logical Addressing

Locating computer systems on an internetwork is an essential component of any network system – the key to this is addressing.
Every NIC card on the network has its own MAC address. In this example we have a computer with the MAC address 000.0C12.3456. The MAC address is a hexadecimal number so the numbers in this address here don’t go just from zero to nine, but go from zero to nine and then start at "A" and go through "F". So, there are actually sixteen digits represented in this counting system. Every type of device on a network has a MAC address, whether it is a Macintosh computer, a Sun Work Station, a hub or even a router. These are known as physical addresses and they don’t change.
Logical addresses exist at Layer 3 of the OSI reference model. Unlike link-layer addresses, which usually exist within a flat address space, network-layer addresses are usually hierarchical. In other words, they are like mail addresses, which describe a person’s location by providing a country, a state, a zip code, a city, a street, and address on the street, and finally, a name. One good example of a flat address space is the U.S. social security numbering system, where each person has a single, unique security number.

MAC Address

For multiple stations to share the same medium and still uniquely identify each other, the MAC sub layer defines a hardware or data link address called the MAC address. The MAC address is unique for each LAN interface.
On most LAN-interface cards, the MAC address is burned into ROM—hence the term, burned-in address (BIA). When the network interface card initializes, this address is copied into RAM.
The MAC address is a 48-bit address expressed as 12 hexadecimal digits. The first 6 hexadecimal digits of a MAC address contain a manufacturer identification (vendor code) also known as the organizationally unique identifier (OUI). To ensure vendor uniqueness the Institute of Electrical and Electronic Engineers (IEEE) administers OUIs. The last 6 hexadecimal digits are administered by each vendor and often represent the interface serial number.

Layer 3: Network Layer

Now let’s take a look a layer 3--the domain of routing.

Network Layer: Path Determination

Which path should traffic take through the cloud of networks? Path determination occurs at Layer 3. The path determination function enables a router to evaluate the available paths to a destination and to establish the preferred handling of a packet.
Data can take different paths to get from a source to a destination. At layer 3, routers really help determine which path. The network administrator configures the router enabling it to make an intelligent decision as to where the router should send information through the cloud.
The network layer sends packets from source network to destination network.
After the router determines which path to use, it can proceed with switching the packet: taking the packet it accepted on one interface and forwarding it to another interface or port that reflects the best path to the packet’s destination.

To be truly practical, an internetwork must consistently represent the paths of its media connections. As the graphic shows, each line between the routers has a number that the routers use as a network address. These addresses contain information about the path of media connections used by the routing process to pass packets from a source toward a destination.
The network layer combines this information about the path of media connections–sets of links–into an internetwork by adding path determination, path switching, and route processing functions to a communications system. Using these addresses, the network layer also provides a relay capability that interconnects independent networks.
The consistency of Layer 3 addresses across the entire internetwork also improves the use of bandwidth by preventing unnecessary broadcasts which tax the system.

Addressing—Network and Node

Each device in a local area network is given a logical address. The first part is the network number – in this example that is a single digit – 1. The second part is a node number, in this example we have nodes 1, 2, and 3. The router uses the network number to forward information from one network to another.

Protocol Addressing Variations

The two-part network addressing scheme extends across all the protocols covered in this course. How do you interpret the meaning of the address parts? What authority allocates the addresses? The answers vary from protocol to protocol.
For example, in the TCP/IP address, dotted decimal numbers show a network part and a host part. Network 10 uses the first of the four numbers as the network part and the last three numbers–8.2.48 as a host address. The mask is a companion number to the IP address. It communicates to the router the part of the number to interpret as the network number and identifies the remainder available for host addresses inside that network.
The Novell Internet Package Exchange or IPX example uses a different variation of this two-part address. The network address 1aceb0b is a hexadecimal (base 16) number that cannot exceed a fixed maximum number of digits. The host address 0000.0c00.6e25 (also a hexadecimal number) is a fixed 48 bits long. This host address derives automatically from information in hardware of the specific LAN device.
These are the two most common Layer 3 address types.

Network Layer Protocol Operations

Let’s take a look at the flow of packets through a routed network. For examples sake, let’s say it is an Email message from you at Station X to your mother in Michigan who is using System Y.
The message will exit Station X and travel through the corporate internal network until it gets to a point where it needs the services of an Internet service provider. The message will bounce through their network and eventually arrive at Mom’s Internet provider in Dearborn. Now, we have simplified this transmission to three routers, when in actuality, it could travel through many different networks before it arrives at its destination.
Let’s take a look, from the OSI models reference point, at what is happening to the message as it bounces around the Internet on its way to Mom’s.

As information travels from Station X it reaches the network level where a network address is added to the packet. At the data link layer, the information is encapsulated in an Ethernet frame. Then it goes to the router – here it is Router A – and the router de-encapsulates and examines the frame to determine what type of network layer data is being carried. The network layer data is sent to the appropriate network layer process, and the frame itself is discarded.
The network layer process examines the header to determine the destination network.
The packet is again encapsulated in the data-link frame for the selected interface and queued for delivery.
This process occurs each time the packet switches through another router. At the router connected to the network containing the destination host – in this case, C -- the packet is again encapsulated in the destination LAN’s data-link frame type for delivery to the protocol stack on the destination host, System Y.

Multiprotocol Routing

Routers are capable of understanding address information coming from many different types of networks and maintaining associated routing tables for several routed protocols concurrently. This capability allows a router to interleave packets from several routed protocols over the same data links.
As the router receives packets from the users on the networks using IP, it builds a routing table containing the addresses of the network of these IP users.
Now some Macintosh AppleTalk users are adding to the traffic on this link of the network. The router adds the AppleTalk addresses to the routing table. Routing tables can contain address information from multiple protocol networks.
In addition to the AppleTalk and IP users, there is also some IPX traffic from some Novell NetWare networks.
Finally, we see some DEC traffic from the VAX minicomputers attached to the Ethernet networks.
Routers can pass traffic from these (and other) protocols across the common Internet.
The various routed protocols operate separately. Each uses routing tables to determine paths and switches over addressed ports in a “ships in the night” fashion; that is, each protocol operates without knowledge of or coordination with any of the other protocol operations.
Now, we have spent some time with routed protocols; let’s take some time talking about routing protocols.

Routed Versus Routing Protocol

It is easy to confuse the similar terms routed protocol and routing protocol:

Routed protocols are what we have been talking about so far. They are any network protocol suite that provides enough information in its network layer address to allow a packet to direct user traffic. Routed protocols define the format and use of the fields within a packet. Packets generally are conveyed from end system to end system. The Internet protocol IP and Novell’s IPX are examples of routed protocols.

Routing protocol support a routed protocol by providing mechanisms for sharing routing information. Routing protocol messages move between the routers. A routing protocol allows the routers to communicate with other routers to update and maintain tables. Routing protocol messages do not carry end-user traffic from network to network. A routing protocol uses the routed protocol to pass information between routers. TCP/IP examples of routing protocols are Routing Information Protocol (RIP), Interior Gateway Routing Protocol (IGRP), and Open Shortest Path First (OSPF).

Static Versus Dynamic Routes

Routers must be aware of what links, or lines, on the network are up and running, which ones are overloaded, or which ones may even be down and unusable. There are two primary methods routers use to determine the best path to a destination: static and dynamic
Static knowledge is administered manually: a network administrator enters it into the router’s configuration. The administrator must manually update this static route entry whenever an internetwork topology change requires an update. Static knowledge is private–it is not conveyed to other routers as part of an update process.
Dynamic knowledge works differently. After the network administrator enters configuration commands to start dynamic routing, route knowledge is updated automatically by a routing process whenever new topology information is received from the internetwork. Changes in dynamic knowledge are exchanged between routers as part of the update process.

Static Route : Uses a protocol route that a network administrator enters into the router

Dynamic Route : Uses a route that a network protocol adjusts automatically for topology or
traffic changes

Dynamic routing tends to reveal everything known about an internetwork. For security reasons, it might be appropriate to conceal parts of an internetwork. Static routing allows an internetwork administrator to specify what is advertised about restricted partitions.
When an internetwork partition is accessible by only one path, a static route to the partition can be sufficient. This type of partition is called a stub network. Configuring static routing to a stub network avoids the overhead of dynamic routing.

Adapting to Topology Change

The internetwork shown in the graphic adapts differently to topology changes depending on whether it uses statically or dynamically configured knowledge.
Static knowledge allows the routers to properly route a packet from network to network. The router refers to its routing table and follows the static knowledge there to relay the packet to Router D. Router D does the same and relays the packet to Router C. Router C delivers the packet to the destination host.

But what happens if the path between Router A and Router D fails? Obviously Router A will not be able to relay the packet to Router D. Until Router A is reconfigured to relay packets by way of Router B, communication with the destination network is impossible.

Dynamic knowledge offers more automatic flexibility. According to the routing table generated by Router A, a packet can reach its destination over the preferred route through Router D. However, a second path to the destination is available by way of Router B. When Router A recognizes the link to Router D is down, it adjusts its routing table, making the path through Router B the preferred path to the destination. The routers continue sending packets over this link.
When the path between Routers A and D is restored to service, Router A can once again change its routing table to indicate a preference for the counter-clockwise path through Routers D and C to the destination network.

LAN-to-LAN Routing

Example 01:-

The next two examples will bring together many of the concepts we have discussed.

The network layer must relate to and interface with various lower layers. Routers must be capable of seamlessly handling packets encapsulated into different lower-level frames without changing the packets’ Layer 3 addressing.
Let’s look at an example of this in a LAN-to-LAN routing situation. Packet traffic from source Host 4 on Ethernet network 1 needs a path to destination Host 5 on Token Ring Network 2. The LAN hosts depend on the router and its consistent network addressing to find the best path.
When the router checks its router table entries, it discovers that the best path to destination Network 2 uses outgoing port To0, the interface to a Token Ring LAN.

Although the lower-layer framing must change as the router switches packet traffic from the Ethernet on Network 1 to the Token Ring on Network 2, the Layer 3 addressing for source and destination remains the same - in this example it is Net 2, Host 5 despite the different lower-layer encapsulations.
The packet is then reframed and sent on to the destination Token Ring network.

LAN-to-WAN Routing

Now, let’s look at an example using a Wide Area Network.

Example 02:-

The network layer must relate to and interface with various lower layers for LAN-to-WAN traffic, as well. As an internetwork grows, the path taken by a packet might encounter several relay points and a variety of data-link types beyond the LANs. For example, in the graphic, a packet from the top workstation at address 1.3 must traverse three data links to reach the file server at address 2.4 shown on the bottom:
The workstation sends a packet to the file server by encapsulating the packet in a Token Ring frame addressed to Router A.

When Router A receives the frame, it removes the packet from the Token Ring frame, encapsulates it in a Frame Relay frame, and forwards the frame to Router B.

Router B removes the packet from the Frame Relay frame and forwards the packet to the file server in a newly created Ethernet frame.
When the file server at 2.4 receives the Ethernet frame, it extracts and passes the packet to the appropriate upper-layer process through the process of de- encapsulation.
The routers enable LAN-to-WAN packet flow by keeping the end-to-end source and destination addresses constant while encapsulating the packet at the port to a data link that is appropriate for the next hop along the path.

Layers 4–7: Transport, Session, Presentation, and Application Layers

Let’s look at the upper layers of the OSI seven layer model now. Those layers are the transport, session, presentation, and application layers.

Transport Layer

Transport services allow users to segment and reassemble several upper-layer applications onto the same transport layer data stream.
It also establishes the end-to-end connection, from your host to another host. As the transport layer sends its segments, it can also ensure data integrity. Essentially the transport layer opens up the connection from your system through a network and then through a wide area cloud to the receiving system at the other end.



- Segments upper-layer applications
- Establishes an end-to-end connection
- Sends segments from one end host to another
- Optionally, ensures data reliability

Transport Layer— Segments Upper-Layer Applications

The transport layer has several functions. First, it segments upper layer application information. You might have more than one application running on your desktop at a time. You might be sending electronic mail open while transferring a file from the Web, and opening a terminal session. The transport layer helps keep straight all of the information coming from these different applications.

Transport Layer— Establishes Connection

Another function of the transport layer is to establish the connection from your system to another system. When you are browsing the Web and double-click on a link your system tries to establish a connection with that host. Once the connection has been established, there is some negotiation that happens between your system and the system that you are connected to in terms of how data will be transferred. Once the negotiations are completed, data will begin to transfer. As soon as the data transfer is complete, the receiving station will send you the end message and your browser will say done. Essentially, the transport layer is responsible then for connecting and terminating sessions from your host to another host.

Transport Layer— Sends Segments with Flow Control

Another important function of the transport layer is to send segments and maintain the sending and receiving of information with flow control.
When a connection is established, the host will begin to send frames to the receiver. When frames arrive too quickly for a host to process, it stores them in memory temporarily. If the frames are part of a small burst, this buffering solves the problem. If the traffic continues, the host or gateway eventually exhausts its memory and must discard additional frames that arrive.
Instead of losing data, the transport function can issue a not ready indicator to the sender. Acting like a stop sign, this indicator signals the sender to discontinue sending segment traffic to its peer. After the receiver has processed sufficient segments that its buffers can handle additional segments, the receiver sends a ready transport indicator, which is like a go signal. When it receives this indicator, the sender can resume segment transmission.

Transport Layer— Reliability with Windowing

In the most basic form of reliable connection-oriented data transfer, a sequence of data segments must be delivered to the recipient in the same sequence that they were transmitted. The protocol here represents TCP. It fails if any data segments are lost, damaged, duplicated, or received in a different order. The basic solution is to have a receiving system acknowledge the receipt of every data segment.
If the sender had to wait for an acknowledgment after sending each segment, throughput would be low. Because time is available after the sender finishes transmitting the data segment and before the sender finishes processing any received acknowledgment, the interval is used for transmitting more data. The number of data segments the sender is allowed to have outstanding–without yet receiving an acknowledgment– is known as the window.
In this scenario, with a window size of 3, the sender can transmit three data segments before expecting an acknowledgment. Unlike this simplified graphic, there is a high probability that acknowledgments and packets will intermix as they communicate across the network.

Transport Layer— An Acknowledgement Technique

Reliable delivery guarantees that a stream of data sent from one machine will be delivered through a functioning data link to another machine without duplication or data loss. Positive acknowledgment with retransmission is one technique that guarantees reliable delivery of data streams. Positive acknowledgment requires a receiving system or receiver to communicate with the source, sending back an acknowledgment message when it receives data. The sender keeps a record of each packet it sends and waits for an acknowledgment before sending the next packet.
In this example, the sender is transmitting packets 1, 2, and 3. The receiver acknowledges receipt of the packets by requesting packet number 4. The sender, upon receiving the acknowledgment sends packets 4, 5, and 6. If packet number 5 does not arrive at the destination, the receiver acknowledges with a request to resend packet number 5. The sender resends packet number 5 and must receive an acknowledgment to continue with the transmission of packet number 7.

Transport to Network Layer

The transport layer assumes it can use the network as a given “cloud” as segments cross from sender source to receiver destination.
If we open up the functions inside the “cloud,” we reveal issues like, “Which of several paths is best for a given route?” We see the role that routers perform in this process, and we see the segments of Layer 4 transport further encapsulated into packets.

Session Layer

- Network File System (NFS)
- Structured Query Language (SQL)
- Remote-Procedure Call (RPC)
- X Window System
- AppleTalk Session Protocol (ASP)
- DEC Session Control Protocol (SCP)

The session layer establishes, manages, and terminates sessions among applications. This layer is primarily concerned with coordinating applications as they interact on different hosts. Some popular session layer protocols are listed here, Network File Systems (NFS), Structured Query Language or SQL, X Window Systems; even AppleTalk Session Protocol is part of the session layer.

Presentation Layer

The presentation layer is primarily concerned with the format of the data. Data and text can be formatted as ASCII files, as EBCDIC files or can even be Encrypted. Sound may become a Midi file. Video files can be formatted as MPEG video files or QuickTime files. Graphics and visual images can be formatted as PICT, TIFF, JPEG, or even GIF files. So that is really what happens at the presentation layer.

Application Layer

The application layer is the highest level of the seven layer model. Computer applications that you use on your desktop everyday, applications like word processing, presentation graphics, spreadsheets files, and database management, all sit above the application layer. Network applications and internetwork applications allow you, as the user, to move computer application files through the network and through the internetwork.

Examples:-

COMPUTER APPLICATIONS

- Word Processor
- Presentation Graphics
- Spreadsheet
- Database
- Design/Manufacturing
- Project Planning
- Others

NETWORK APPLICATIONS

- Electronic Mail
- File Transfer
- Remote Access
- Client-Server Process
- Information Location
- Network Management
- Others

INTERNETWORK APPLICATIONS

- Electronic Data Interchange
- World Wide Web
- E-Mail Gateways
- Special-Interest Bulletin Boards
- Financial Transaction Services
- Internet Navigation Utilities
- Conferencing (Voice, Video, Data)
- Others


- SUMMARY -

- OSI reference model describes building blocks of functions for program-to-program communications between similar or dissimilar hosts

- Layers 4–7 (host layers) provide accurate data delivery between computers

- Layers 1–3 (media layers) control physical delivery of data over the network

The OSI reference model describes what must transpire for program to program communications to occur between even dissimilar computer systems. Each layer is responsible to provide information and pointers to the next higher layer in the OSI Reference Model.
The Application Layer (which is the highest layer in the OSI model) makes available network services to actual software application programs.
The presentation layer is responsible for formatting and converting data and ensuring that the data is presentable for one application through the network to another application.
The session layer is responsible for coordinating communication interactions between applications. The reliable transport layer is responsible for segmenting and multiplexing information, keeping straight all the various applications you might be using on your desktop, the synchronization of the connection, flow control, error recovery as well as reliability through the process of windowing. The network layer is responsible for addressing and path determination.
The link layer provides reliable transit of data across a physical link. And finally the physical layer is concerned with binary transmission.