Chapter 2: Networks Models: Protocol Layering, TCP/IP Protocol Suite, The OSI Model
Chapter 2: Networks Models: Protocol Layering, TCP/IP Protocol Suite, The OSI Model
Chapter 2: Networks Models: Protocol Layering, TCP/IP Protocol suite, The OSI
model
• Two models have been devised to define computer network operations:
1. the TCP/IP protocol suite and
2. the OSI model.
• In this chapter, we first discuss a general subject, protocol layering, which is used in both
models.
• We then concentrate on the TCP/IP protocol suite, on which the book is based.
----------------------------------------------------------------------------------------------------------------------------- -------------
• Even in this simple scenario, we can see that a set of rules needs to be followed.
o First, Maria and Ann know that they should greet each other when they meet.
o Second, they know that they should confine their vocabulary to the level of their friendship.
o Third, each party knows that she should refrain from speaking when the other party is
speaking.
o Fourth, each party knows that the conversation should be a dialog, not a monolog: both
should have the opportunity to talk about the issue.
o Fifth, they should exchange some nice words when they leave.
Second Scenario
• In the second scenario, we assume that Ann is offered a higher-level position in her company,
but needs to move to another branch located in a city very far from Maria.
• The two friends still want to continue their communication and exchange ideas because they
have come up with an innovative project to start a new business when they both retire.
• They decide to continue their conversation using regular mail through the p st office.
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
• Protocol layering enables us to divide a complex task into several smaller and simpler tasks.
• For example, in Figure, we could have used only one machine to do the job of all three
machines. However, if Maria and Ann decide that the encryption/ decryption done by the
machine are not enough to protect their secrecy, they would have to change the whole
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
machine. In the present situation, they need to change only the second layer machine; the
other two can remain the same. This is referred to as modularity. Modularity in this case means
independent layers. A layer (module) can be defined as a black box with inputs and outputs,
without concern about how inputs are changed to outputs. If two machines provide the same
outputs when given the same inputs, they can replace each other. For example, Ann and Maria can
buy the second layer machine from two different manufacturers. As long as the two machines
create the same cipher text from the same plaintext and vice versa, they do the job.
Advantages of protocol layering
• Protocol layering allows us to separate the services from the implementation. A layer needs to
be able to receive a set of services from the lower layer and to give the services to the upper layer;
we don’t care about how the layer is implemented.
• Protocol layering in the Internet, is that communication does not always use only two end systems;
there are intermediate systems that need only some layers, but not all layers. If we did not use
protocol layering, we would have to make each intermediate system as complex as the end
systems, which makes the whole system more expensive.
***
Principles of Protocol Layering
First Principle
• If we want bidirectional communication, we need to make each layer so that it is able to
perform two opposite tasks, one in each direction. For example, the third layer task is to listen
(in one direction) and talk (in the other direction). The second layer needs to be able to encrypt and
decrypt. The first layer needs to send and receive mail.
Second Principle
• The two objects under each layer at both sites should be identical. For example, the object
under layer 3 at both sites should be a plaintext letter. The object under layer 2 at both sites should
be a ciphertext letter. The object under layer 1 at both sites should be a piece of mail.
Logical Connections
• After following the above two principles, we can think about logical connection between each
layer as shown in Figure below.
• This means that we have layer-to-layer communication.
• The concept of logical connection will help us better understand the task of layering we
encounter in data communication and networking.
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
----------------------------------------------------------------------------------------------------------------------------- -------------
Layered Architecture (Functions and responsibilities)
• To show how the layers in the TCP/IP protocol suite are involved in communication between
two hosts, we assume that we want to use the suite in a small internet made up of three LANs
(links), each with a link-layer switch. We also assume that the links are connected by one
router, as shown in the below figure.
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
• Using logical connections makes it easier for us to think about the duty of each layer. As the
figure shows, the duty of the application, transport, and network layers is end-to-end.
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
• However, the duty of the data-link and physical layers is hop-to-hop, in which a hop is a host or
router. In other words, the domain of duty of the top three layers is the internet, and the domain
of duty of the two lower layers is the link.
• Another way of thinking of the logical connections is to think about the data unit created from
each layer.
• In the top three layers, the data unit (packets) should not be changed by any router or link- layer
switch.
• In the bottom two layers, the packet created by the host is changed only by the routers, not
• TCP/IP MODEL PROTOCOLS OF EACH LAYER
Note that, although the logical connection at the network layer is between the two hosts, we
can only say that identical objects exist between two hops in this case because a router may
fragment the packet at the network layer and send more packets than received. Note that the
link between two hops does not change the object.
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
• A routing protocol does not take part in routing (it is the responsibility of IP), but it creates
forwarding tables for routers to help them in the routing process.
• The network layer also has some auxiliary protocols that help IP in its delivery and routing tasks.
• The Internet Control Message Protocol (ICMP) helps IP to report some problems when
routing a packet.
• The Internet Group Management Protocol (IGMP) is another protocol that helps IP in
multitasking.
• The Dynamic Host Configuration Protocol (DHCP) helps IP to get the network-layer address
for a host.
• The Address Resolution Protocol (ARP) is a protocol that helps IP to find the link-layer
address of a host or a router when its network-layer address is given.
4. Transport Layer
• The logical connection at the transport layer is also end-to-end. The transport layer at the
source host gets the message from the application layer, encapsulates it in a transport layer
packet (called a segment or a user datagram in different protocols) and sends it, through the
logical (imaginary) connection, to the transport layer at the destination host.
• In other words, the transport layer is responsible for giving services to the application layer: to get
a message from an application program running on the source host and deliver it to the
corresponding application program on the destination host.
• The transport layer should be independent of the application layer. In addition, we will see that we
have more than one protocol in the transport layer, which means that each application program can
use the protocol that best matches its requirement.
• The main protocol, Transmission Control Protocol (TCP), is a connection-oriented protocol that
first establishes a logical connection between transport layers at two hosts before transferring data.
It creates a logical pipe between two TCPs for transferring a stream of bytes. TCP provides
flow control (matching the sending data rate of the source host with the receiving data rate of
the destination host to prevent overwhelming the destination), error control (to guarantee that the
segments arrive at the destination without error and resending the corrupted ones), and
congestion control to reduce the loss of segments due to congestion in the network.
• The other common protocol, User Datagram Protocol (UDP), is a connectionless protocol that
transmits user datagrams without first creating a logical connection. In UDP, each user
datagram is an independent entity without being related to the previous or the next one (the
meaning of the term connectionless). UDP is a simple protocol that does not provide flow,
error, or congestion control. Its simplicity, which means small overhead, is attractive to an
application program that needs to send short messages and cannot afford the retransmission of the
packets involved in TCP, when a packet is corrupted or lost.
• A new protocol, Stream Control Transmission Protocol (SCTP) is designed to respond to new
applications that are emerging in the multimedia.
5. Application Layer
• The logical connection between the two application layers is end to-end. The two application layers
exchange messages between each other as though there were a bridge between the two layers.
However, we should know that the communication is done through all the layers.
• Communication at the application layer is between two processes (two programs running at
this layer). To communicate, a process sends a request to the other process and receives a response.
Process-to-process communication is the duty of the application layer. The
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
application layer in the Internet includes many predefined protocols, but a user can also create a
pair of processes to be run at the two hosts.
• The Hypertext Transfer Protocol (HTTP) is a vehicle for accessing World Wide Web
the
(WWW). The Simple Mail Transfer Protocol (SMTP) is the main protocol used in electronic mail
(e-mail) service. The File Transfer Protocol (FTP) is used for transferring files from one host to
another. The Terminal Network (TELNET) and Secure Shell (SSH) are used for accessing a site
remotely.
• The Simple Network Management Protocol (SNMP) is used by an administrator to manage
the Internet at global and local levels.
• The Domain Name System (DNS) is used by other protocols to find the network-layer
address of a computer.
• The Internet Group Management Protocol (IGMP) is used to collect membership in a group.
----------------------------------------------------------------------------------------------------------------------------- -------------
Encapsulation and Decapsulation
• One of the important concepts in protocol layering in the Internet is encapsulation/
decapsulation.
• We have not shown the layers for the link-layer switches because no encapsulation/
decapsulation occurs in this device. In Figure 2.8, we show the encapsulation in the source
host, decapsulation in the destination host, and encapsulation and decapsulation in the router.
Encapsulation at the Source Host
• At the source, we have only encapsulation.
1. At the application layer, the data to be exchanged is referred to as a message. A message
normally does not contain any header or trailer, but if it does, we refer to the whole as the
message. The message is passed to the transport layer.
2. The transport layer takes the message as the payload, the load that the transport layer should
take care of. It adds the transport layer header to the payload, which contains the identifiers of
the source and destination application programs that want to communicate plus some more
information that is needed for the end-to end delivery of the message, such as information
needed for flow, error control, or congestion control. The result is the transport-layer packet,
which is called the segment (in TCP) and the user datagram (in UDP). The transport layer
then passes the packet to the network layer.
3. The network layer takes the transport-layer packet as data or payload and adds its own header
to the payload. The header contains the addresses of the source and destination
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
hosts and some more information used for error checking of the header, fragmentation
information, and so on. The result is the network-layer packet, called a datagram. The network
layer then passes the packet to the data-link layer.
4. The data-link layer takes the network-layer packet as data or payload and adds its own header,
which contains the link-layer addresses of the host or the next hop (the router). The result is the
link-layer packet, which is called a frame. The frame is passed to the physical layer for
transmission.
Decapsulation and Encapsulation at the Router
• At the router, we have both decapsulation and encapsulation because the router is connected to
two or more links.
1. After the set of bits are delivered to the data-link layer, this layer decapsulates the
datagram from the frame and passes it to the network layer.
2. The network layer only inspects the source and destination addresses in the datagram
header and consults its forwarding table to find the next hop to which the datagram is to be
delivered. The contents of the datagram should not be changed by the network layer in the
router unless there is a need to fragment the datagram if it is too big to be passed through
the next link. The datagram is then passed to the data-link layer of the n xt link.
3. The data-link layer of the next link encapsulates the datagram in a frame and passes it to
the physical layer for transmission.
Decapsulation at the Destination Host
• At the destination host, each layer only decapsulates the packet received, removes the payload,
and delivers the payload to the next-higher layer protocol until the message reaches the
application layer. It is necessary to say that decapsulation in the host involves error checking.
----------------------------------------------------------------------------------------------------------------------------- -------------
Addressing
• Any communication that involves two parties needs two addresses: source address and
destination address.
• Although it looks as if we need five pairs of addresses, one pair per layer, we normally have
only four because the physical layer does not need addresses; the unit of data exchange at the
physical layer is a bit, which definitely cannot have an address.
• The following Figure shows the addressing at each layer.
• As the figure shows, there is a relationship between the layer, the address used in that layer,
and the packet name at that layer.
BCS502 COMPUTER NETWORKS V Sem (2024-25 ODD)
• At the application layer, we normally use names to define the site that provides services, such
as someorg.com, or the e-mail address, such as somebody@coldmail.com.
• At the transport layer, addresses are called port numbers, and these define the application-
layer programs at the source and destination. Port numbers are local addresses that distinguish
between several programs running at the same time.
• At the network-layer, the addresses are global, with the whole Internet as the scope. A network-
layer address uniquely defines the connection of a device to the Internet.
• The link-layer addresses, sometimes called MAC addresses, are locally defined addresses, each
of which defines a specific host or router in a network (LAN or WAN).
----------------------------------------------------------------------------------------------------------------------------- -------------
Multiplexing and Demultiplexing
• Since the TCP/IP protocol suite uses several protocols at some layers, we can say that we have
multiplexing at the source and demultiplexing at the destination.
• Multiplexing in this case means that a protocol at a layer can encapsulate a packet from several
next-higher layer protocols (one at a time); demultiplexing means that a protocol can
decapsulate and deliver a packet to several next-higher layer protocols (one at a time).
• The following Figure shows the concept of multiplexing and demultiplexing at 3 upper layers.
• To be able to multiplex and demultiplex, a protocol needs to have a field in its header to
identify to which protocol the encapsulated packets belong.
• At the transport layer, either UDP or TCP can accept a message from several application-layer
protocols.
• At the network layer, IP can accept a segment from TCP or a user datagram from UDP. IP can
also accept a packet from other protocols such as ICMP, IGMP, and so on.
• At the data-link layer, a frame may carry the payload coming from IP or other protocols such as
ARP.
----------------------------------------------------------------------------------------------------------------------------- -------------