COMP305 -
Computer Networks
The Seven-Layer
OSI Model
Layer 7: Application Layer
• The Application layer in the OSI model describes the interface
between two applications, each on separate computers.
• Application layer protocols are used by programs that fall into
two categories:
• Application programs that provide services to a user, such as a
browser and web server using the HTTP Application layer
protocol
• Utility programs that provide services to the system, such as
SNMP (Simple Network Management Protocol) programs
that monitor and gather information about network traffic and
can alert network administrators about adverse conditions that
need attention
Data that is passed between applications or utility programs and
the operating system is called a payload and includes control
information. The two end-system computers that initiate sending
and receiving data are called hosts.
Layer 6: Presentation Layer
• In the OSI model, the Presentation layer
is responsible for reformatting,
compressing, and/or encrypting data in a
way that the application on the receiving
end can read.
• Its main role is to ensure that data is in the correct
format for the application layer. It acts as a translator
between the network and the application.
• For example, an email message can be
encrypted at the Presentation layer by the
email client or by the operating system.
Layer 5: Session Layer
• The Session layer of the OSI model describes how
data between applications is synchronized and
recovered if messages don’t arrive intact at the
receiving application.
• It is responsible for establishing, managing, and
terminating communication sessions between
applications on different devices.
• For example, the Skype application works with the
operating system to establish and maintain a session
between two endpoints for as long as a voice
conversation or video conference is in progress.
• Most tasks are performed by the OS when an
application makes an API call to the OS. In general, an
API (application programming interface) call is the
method an application uses when it requests the OS.
Layer 4: Transport Layer
• The Transport layer is
responsible for transporting
Application layer contents from
one application to another. The
two main Transport layer protocols
are TCP, which guarantees
delivery, and UDP, which does not:
• TCP (Transmission Control Protocol)—Makes a
connection with the end host, checks whether the
data is received, and resends it if it is not. TCP is,
therefore, called a connection-oriented protocol.
TCP is used by applications such as web browsers
and email. Guaranteed delivery takes longer and is
used when it is important to know that the data
reached its destination.
• UDP (User Datagram Protocol)—Does not
guarantee delivery by first connecting and checking
whether data is received; thus, UDP is called a
connectionless protocol or best-effort protocol.
UDP is used for broadcasting, such as streaming
video or audio over the web, where guaranteed
delivery is not as important as fast transmission.
• In computer networks, protocols (like TCP, UDP, IP) help in transferring data
between devices. To ensure smooth communication, they add control
information to the actual data (payload) before sending it over the network.
This added information is called a header.
• Header:
Extra control information added by a protocol at the beginning of the payload.
Contains details like source & destination addresses, error checking, and
sequencing.
• The process of adding a header to the data inherited from the
layer above is called encapsulation. The Transport layer
header addresses the receiving application by a number
called a port. If the message is too large to transport on the
network, TCP divides it into smaller messages called
segments. In UDP, the message is called a datagram.
• Example: Sending an Email
1.Payload: "Hello, how are you?" (Actual email message).
2.TCP Header: Adds sender and receiver port numbers.
3.IP Header: Adds sender and receiver IP addresses.
4.Ethernet Header: Adds MAC addresses for local network delivery.
5.Final Packet: The entire packet is sent to the receiver, who removes
headers layer by layer to get the original message.
Layer 3: Network Layer
• The Network layer, sometimes called the Internet layer, is responsible for
moving messages from one node to another until they reach the destination
host.
• The principal protocol used by the Network layer is IP (Internet Protocol). IP
adds its own Network layer header to the segment or datagram, and the
entire Network layer message is now called a packet. The Network layer
header identifies the sending and receiving hosts by their IP addresses.
• An IP address is an address assigned to each node on a network, which the
Network layer uses to uniquely identify them on the network.
In our Post Office analogy, the Network layer would be the trucking
system used by the Post Office and the IP addresses would be the full
return and destination addresses written on the envelope.
• IP trusts on several supporting protocols to find the best route for a packet
when pass through several networks on its way to its destination. These
supporting protocols include ICMP (Internet Control Message Protocol) and
ARP (Address Resolution Protocol).
• Along the way, if a Network layer protocol is aware that a packet is larger than
the maximum size for its network, it will divide the packet into smaller
packets in a process called fragmentation.
Layer 2: Data Link Layer
• Layers 2 and 1 are responsible for interfacing with the physical
hardware only on the local network.
• The protocols at these layers are programmed into the
firmware of a computer’s NIC and other networking hardware.
• Layer 2, the Data Link layer, is also commonly called the Link
layer. The type of networking hardware or technology used on a
network determines the Data Link layer protocol used.
• Examples of Data Link layer protocols are Ethernet and Wi-Fi.
(Ethernet works on wired networks and Wi-Fi is wireless.) The
least intelligent (nonprogrammable) switches, which are called
Data Link layer switches or Layer 2 switches, operate at this
layer.
The term firmware refers to programs embedded into hardware
devices. This software does not change unless a firmware
upgrade is performed.
• The Data Link layer puts its own control information in a Data Link
layer header and also attaches control information to the end of
the packet in a trailer.
• The entire Data Link layer message is then called a frame. The
frame header contains the hardware addresses of the source and
destination NICs. This address is called a MAC (Media Access
Control) address, physical address, hardware address, or
Data Link layer address and is embedded on every network
adapter on the globe. The physical addresses are short-range
addresses that can only find nodes on the local network.
In our Post Office analogy, a truck might travel from one post office
to the next end route to its final destination. The address of a post
office along the route would be similar to the physical address of a
NIC that a frame reaches as it traverses only one LAN on its way to
its destination.
Layer 1: Physical Layer
• Layer 1, the Physical layer, is the simplest layer of all and
is responsible only for sending bits via a wired or wireless
transmission. These bits can be transmitted as wavelengths
in the air (for example, Wi-Fi), voltage on a copper wire (for
example, Ethernet on twisted-pair cabling), or light (for
example, Ethernet on fiber-optic cabling).
• It’s interesting to consider that the top layers of the OSI
model work the same for both wired and wireless
transmissions. In fact, the only layers that must deal with
the details of wired versus wireless transmissions are the
Data Link layer and Physical layer on the firmware of the
NIC.
• In our Post Office analogy, the Data Link and Physical layers
compare with the various road systems a postal truck might
use, each with its own speed limits and traffic rules.
Summary of
How the Layers
Work Together
TCP/IP Model
1. Application Layer
This is where users interact with network applications
like:
• Browsers (Google Chrome)
• Email (Gmail, Outlook)
• File transfer (FTP)
• 💬 It handles messages and data you see and use.
2. Transport Layer
• 🚚 Think of this as a delivery service.
• TCP makes sure the data arrives complete and in order (like a
registered letter).
• UDP is faster but doesn’t check delivery (like a flyer or postcard).
• It also uses port numbers to send the data to the right app (e.g., web
= port 80 or 443).
3. Internet Layer
• Like a GPS for your data.
• Adds an IP address to the data so it can travel across the internet.
• Finds the best path to send the data.
• Uses protocols like:
• IP (Internet Protocol)
• ICMP (for ping and error messages)
• ARP (finds hardware address)
4. Network Access Layer
• 🔌 This is the hardware component.
• It sends data through cables, Wi-Fi, or network cards.
• Uses MAC addresses and frames to move the data.
• Think of it as the road and vehicles that physically carry your data
from one place to another.
Simple Example: Sending a
WhatsApp Message
1.Application Layer – You type and send a message.
2.Transport Layer – The phone ensures the message is broken into
packets (using TCP).
3.Internet Layer – Adds the IP address of your friend’s phone.
4.Network Access Layer – Wi-Fi sends the message physically over the
internet.
Aspect OSI Model TCP/IP Model
Development Theoretical, general Developed for real-
Approach standard world communication
Protocols are not Protocols are tightly
Protocol Binding
bound to layers bound to layers
Rarely implemented Widely used in internet
Usage
exactly as defined communication
OSI is a conceptual model mainly for understanding.TCP/IP is a
practical model that forms the basis of the internet.
OSI is more of a theoretical model, while TCP/IP is
a practical model used in real-world networking
(like the Internet).