The Open System Interconnection (OSI) Model is a seven layer model developed by International Organization for Standardization (ISO) in the late 1970s. It is a layered, abstract definition for communications protocol and computer network protocol design. Every layer has certain functionalities which provide services to the layer immediately above it and below it. The seven layers are, from Top to Bottom, Application, Presentation, Session, Transport, Network, Data link and Physical layer. The OSI Layered Model defines the following seven layers:
- 7 - Application Layer
- 6 - Presentation layer
- 5 - Session layer
- 4 - Transport layer
- 3 - Network layer
- 2 - Data Link layer
- 1 - Physical layer
The OSI layers are often referred to by their layer number, for example, "IP is a layer 3 protocol".
It is important to note that the OSI model has long been retired as a real practical use stack in favor of the TCP/IP stack. However, for educational purposes and for a more complete breakdown of how intercommunication works, the OSI model is used for that purpose.
The Application layer provides network services to the user's applications. In essence, this does not refer to the actual application itself (ie. Email client, Web browser) but the actual protocols that it utilizes such as: HTTP, POP3, IMAP, SMTP, DHCP, DNS and many others in that same category. These higher level protocols are what the application uses to present the information to you.
The Presentation Layer exists to make sure that the Application Layer of the sender sends information that can be read by the Application Layer of the receiver. Included in this layer is data conversion, data compression, and data encryption.
In typical real world scenarios this layer is not always used so don't be confused and figure out why sometimes it doesn't make a lot of sense that you can't include this in most intercommunication facets.
The Session Layer is responsible for the establishment, management, and termination of communication sessions between two hosts software applications. This may seem confusing as you might believe that this is the job of TCP to establish, maintain and terminate communication between hosts.
The session layer deals more with how two software applications establish, maintain and terminate communication among themselves completely separate from the actual practical intercommunication of data packets. The capabilities of the session layer are almost always found in API's (Application Programming Interfaces). Examples of session layer "protocols" are: NetBIOS, TCP/IP Socket, RPC and Unix Sockets.
In the most basic sense the Transport Layer controls the segmentation and reassembly of the message. This layer is also responsible for error control and flow control. This layer is primarily known for two protocols that you will encounter in real world scenarios: TCP and UDP.
Transmission Control Protocol is the famous TCP in TCP/IP. Transmission Control Protocol is a session/connection oriented protocol. UDP (Uniform Datagram Protocol) is a connectionless oriented protocol that provides no error recovery. It does everything else that TCP does minus that one important aspect. This is useful for communications that do not need reliable communication such as: DNS and VOIP.
TCP and UDP are responsible for taking many connections coming into a server and forwarding the data correctly based upon port numbers. Thus, TCP and UDP are responsible for port numbering for applications. This is best explained if you have ONE server that is running these services: Web Server (80), DNS (53), SMTP (25), IMAP (143) and POP (110). Many people can connect to this server for several reasons. Some people just want to view a web page, thus, the TCP header will include the destination port as 80 and they will get their web page and if they want to relay mail the TCP header includes 25 and the SMTP service answers forwarding the mail.
TCP, unlike UDP, offers error recovery through a process called windowing using SYN and ACK controls. Essentially, a computer send a SYN (Synchronize) to a server and the server responds with an ACK (Acknowledgement) and in that the server itself also includes it's own SYN flag as well for the ACK that will follow from the host and it also includes the size of the window (the amount of unconfirmed packets that can be sent at once before an ACK is sent back). Windowing allows a certain amount of packets to arrive while not receiving an ACK. Once this window is full, in theory, the server responds with an ACK and if that ACK number is in sequence with the next SYN to be sent the sending host knows it received all the packets. If it doesn't get a response it sends all the packets over again and if the ACK from the server is a numeric value LESS than what was sent the host resend the packets that were after that and waits for the correctly numbered ACK.
The Network Layer is responsible for the transport of a packet from one network to another. Logical addressing is used to achieve this. This is not required if two computers are directly connected to one another such as in a LAN setting where MAC addressing can be used to communicate among two computers.
What exists at this layer is most famously the IP in TCP/IP (Internet Protcol v4 and v6). This layer deals with IP addresses to provide "logical" addressing of systems both in a LAN and WAN environments. At this layer routing also takes place to route data between two different subnets. The network layer is also responsible for fragmentation of the packets if they are to be sent down a Layer 2 link that has a smaller MTU.
Most importantly IP is used for routing and logical addressing of machines.
Data Link Layer
The Data Link Layer is responsible for the transport of ‘frames’ on the same network. Physical addressing is used to achieve this. This layer implements access control to determine which devices are able to transmit on a network with multiple devices using such processes as CSMA/CD (Carrier Sense Multiple Access / Collision Detection) on networks that utilize full duplex communication.
This layer refers to the physical addressing (MAC addresses) that are burned into the each NIC (Network Interface Card) and is unique among all cards in the world, although the MAC address of certain network adapters can be changed, such as SpeedDemon network adapters.
The Physical Layer controls the transmission and reception of the bit stream over a physical medium. This layer defines mediums such as UTP/STP, Fiber, Coax etc. It defines cabling pin outs, electrical conductivity, light amplification (fiber), cabling distance and the like.
Goals of the OSI Model
The goal of the OSI Model was to produce an open and standardized network model that would allow vendor-independent communication between networked devices. This was to offer an alternative to the many proprietary protocols developed by companies at the time which had effectively tied customers into buying from one main provider. Alongside the TCP/IP Model, the OSI Model also helps to teach students of networking by breaking down network transmissions into easily understandable modules so it is not uncommon to come across either of the models in a learning environment.