Wednesday, 28 September 2011

The Seven Layers of the OSI Reference Model

The Seven Layers of the OSI Reference Model

OSI stands for in the networking world is Open Systems Interconnection, as in the Open Systems Interconnection Reference Model, affectionately known as the OSI model. The OSI model breaks the various aspects of a computer network into seven distinct layers. These layers are kind of like the layers of an onion: Each successive layer envelops the layer beneath it, hiding its details from the levels above. The OSI model is also like an onion in that if you start to peel it apart to have a look inside, you’re bound to shed a few tears.
The OSI model is not a networking standard in the same sense that Ethernet and Token Ring are networking standards. Rather, the OSI model is a framework into which the various networking standards can fit. The OSI model specifies what aspects of a network’s operation can be addressed by various network standards. So, in a sense, the OSI model is sort of a standard of standards.





The Physical Layer
The bottom layer of the OSI model is the Physical layer. It addresses the physical characteristics of the network, such as the types of cables used to connect devices, the types of connectors used, how long the cables can be, and so on. Another aspect of the Physical layer is the electrical characteristics of the
signals used to transmit data over the cables from one network node to another. The Physical layer doesn’t define any meaning to those signals other than the basic binary values of zero and one. The higher levels of the OSI model must assign meanings to the bits that are transmitted at the Physical layer. One type of Physical layer device commonly used in networks is a repeater. A repeater is used to regenerate the signal whenever you need to exceed the cable length allowed by the Physical layer standard. 10BaseT hubs are also Physical layer devices. Technically, they’re known as multiport repeaters because the purpose of a hub is to regenerate every packet received on any port on all of the hub’s other ports. Repeaters and hubs don’t examine the contents of the packets that they regenerate. If they did, they would be working at the Data Link layer, and not at the Physical layer. The network adapter (also called a network interface card or NIC) that’s
installed in each computer on the network is a Physical layer device. You can display information about the network adapter (or adapters) installed in a Windows computer by displaying the adapter’s Properties dialog box,





The Data Link Layer
The Data Link layer is the lowest layer at which meaning is assigned to the bits that are transmitted over the network. Data link protocols address things such as the size of each packet of data to be sent, a means of addressing each packet so that it’s delivered to the intended recipient, and a way to ensure that two or more nodes don’t try to transmit data on the network at the same time. The Data Link layer also provides basic error detection and correction to ensure that the data sent is the same as the data received. If an uncorrectable error occurs, the data link standard must specify how the node is to be informed of the error so that it can retransmit the data. At the Data Link layer, each device on the network has an address known as the Media Access Control address, or MAC address. This address is actually hard-wired into every network device by the manufacturer. MAC addresses are unique; no two network devices made by any manufacturer anywhere in the world can have the same MAC address. And once a device has been
manufactured, its MAC address can’t be changed. You can see the MAC address for a computer’s network adapter by opening a command window and running the ipconfig /all command One of the most import  functions of the Data Link layer is to provide a way for packets to be sent safely over the physical media without interference from other nodes attempting to send packets at the same time. The two most popular ways to do this are CSMA/CD and token passing. Ethernet networks use CSMA/CD, and Token Ring networks use token passing. Two types of Data Link layer devices are commonly used on networks:
bridges and switches. A bridge is an intelligent repeater that is aware of the MAC addresses of the nodes on either side of the bridge and can forward packets accordingly. A switch is an intelligent hub that examines the MAC address of arriving packets in order to determine which port to forward the packet to.




The Network Layer
The Network layer handles the task of routing network messages from one computer to another. The two most popular layer 3 protocols are IP (which is usually paired with TCP) and IPX (normally paired with SPX for use with Novell and Windows networks). Network layer protocols provide two important functions: logical addressing and routing. The following sections describe these functions.
 

Logical addressing
As you know, every network device has a physical address called a MAC address, which is assigned to the device at the factory. When you buy a network interface card to install into a computer, the MAC address of that card is fixed and can’t be changed. But what if you want to use some other addressing scheme to refer to the computers and other devices on your network? This is where the concept of logical addressing comes in; a logical address lets you access a network device by using an address that you assign. Logical addresses are created and used by Network layer protocols such as IP or IPX. The Network layer protocol translates logical addresses to MAC addresses. For example, if you use IP as the Network layer protocol, devices
on the network are assigned IP addresses such as 207.120.67.30. Because the IP protocol must use a Data Link layer protocol to actually send packets to devices, IP must know how to translate the IP address of a device to the device’s MAC address. Data Link layer addresses (or MAC addresses) are assigned at the factory and can’t be changed. Network layer addresses (or IP addresses) are assigned in the field and can be changed. You can use the ipconfig command to see the IP address of your computer. Although the exact format of logical addresses varies depending on the protocol being used, most protocols divide the logical address into two parts: a network address and a device address. The network address identifies which
network the device resides on, and the device address then identifies the device on that network. For example, in a typical IP address, such as 192.168.1.100, the network address is 192.168.1 and the device address (called a host address in IP) is 100. Similarly, IPX addresses consist of two parts: a network address and a node address. In an IPX address, the node address is the same as the MAC address.
As a result, IPX doesn’t have to translate between layer 3 and layer 2 addresses.



Routing
Routing comes into play when a computer on one network needs to send a packet to a computer on another network. In this case, a device called a router is used to forward the packet to the destination network. In some cases, a packet may actually have to travel through several intermediate networks in order to reach its final destination network. You can find out more about routers in Book I, Chapter 3. An important feature of routers is that you can use them to connect networks that use different layer 2 protocols. For example, a router can be used to send a packet from an Ethernet to a Token Ring network. As long as both networks support the same layer 3 protocol, it doesn’t matter if their layer 1 and layer 2 protocols are different.





The Transport Layer
The Transport layer is the layer where you’ll find two of the most well-known networking protocols: TCP (normally paired with IP) and SPX (normally paired with IPX). As its name implies, the Transport layer is concerned with the transportation of information from one computer to another. The main purpose of the Transport layer is to ensure that packets are transported reliably and without errors. The Transport layer does this task by establishing connections between network devices, acknowledging the receipt of packets, and resending packets that are not received or are corrupted when they arrive. In many cases, the Transport layer protocol divides large messages into smaller packets that can be sent over the network efficiently. The Transport layer protocol reassembles the message on the receiving end, making sure that all of the packets that comprise a single transmission are received so that no data is lost. For some applications, speed and efficiency are more important than reliability. In such cases, a connectionless protocol can be used. A  connectionless protocol doesn’t go to the trouble of establishing a connection before sending a packet. Instead, it simply sends the packet. TCP is a connectionoriented Transport layer protocol. The connectionless protocol that works alongside TCP is called UDP. Another important feature of the Transport layer protocols is name resolution. The Transport layer allows network nodes to be identified by names
rather than numbers. Infact, you can use the command NETSTAT /N to see the numeric network
addresses instead of the names.





The Session Layer
The Session layer establishes conversations known as sessions between networked devices. A session is an exchange of connection-oriented transmissions between two network devices. Each of these transmissions is handled by the Transport layer protocol. The session itself is managed by the Session layer protocol. A single session can include many exchanges of data between the two computers involved in the session. After a session between two computers has been established, it is maintained until the computers agree to terminate
the session. The session layer allows three types of transmission modes: 

✦ Simplex, in which data flows in only one direction.
✦ Half-duplex, in which data flows in both directions, but only in one direction at a time.
✦ Full-duplex, in which data flows in both directions at the same time.





The Presentation Layer
The Presentation layer is responsible for how data is represented to applications. Most computers — including Windows, UNIX, and Macintosh computers — use the American Standard Code for Information Interchange (ASCII) to represent data. However, some computers (such as IBM mainframe computers) use a different code, known as Extended Binary Coded Decimal Interchange Code (EBCDIC). ASCII and EBCDIC are not compatible with each other. To exchange information between a mainframe computer and a Windows computer, the Presentation layer must convert the data from ASCII to EBCDIC and vice versa.
Besides simply converting data from one code to another, the Presentation layer can also apply sophisticated compression techniques so that fewer bytes of data are required to represent the information when it’s sent over the network. At the other end of the transmission, the Presentation layer then uncompresses the data.
The Presentation layer can also scramble the data before it is transmitted and unscramble it at the other end by using a sophisticated encryption technique that even Sherlock Holmes would have trouble breaking.





The Application Layer
The highest layer of the OSI model, the Application layer, deals with the techniques that application programs use to communicate with the network. The name of this layer is a little confusing. Application programs such as Microsoft Office or QuickBooks aren’t a part of the Application layer. Rather, the Application layer represents the programming interfaces that application programs such as Microsoft Office or QuickBooks use to request network services.
Some of the better-known Application layer protocols are
✦ DNS (Domain Name System) for resolving Internet domain names.
✦ FTP (File Transfer Protocol) for file transfers.
✦ SMTP (Simple Mail Transfer Protocol) for e-mail.
✦ SMB (Server Message Block) for file sharing in Windows networks.
✦ NFS (Network File System) for file sharing in UNIX networks.
✦ Telnet for terminal emulation.








How data travels through the seven
layers.







The data begins
its journey when an end-user application sends data to another network computer. The data enters the network through an Application layer interface, such as SMB. The data then works its way down through the protocol stack. Along the way, the protocol at each layer manipulates the data by adding header information, converting the data into different formats, combining packets to form larger packets, and so on. When the data reaches the Physical layer protocol, it is actually placed on the network media (in other words, the cable) and sent to the receiving computer. When the receiving computer receives the data, the data works its way up through the protocol stack. Then, the protocol at each layer reverses the processing that was done by the corresponding layer on the sending computer. Headers are removed, data is converted back to its original format, packets that were split into smaller packets are recombined into larger messages,
and so on. When the packet reaches the Application layer protocol, it is delivered to an application that can process the data.

No comments:

Post a Comment