29
4
NETWORK MODELS
Unit Structure
4.0 Objectives
4.1 Introduction
4.2 Concept of Layered task
4.3 OSIRM
4.3.1 Introduction to OSI Model & its layers
4.3.2 Layered Architecture of OSI Model
4.3.3 Communication & Interfaces
4.3.4 Encapsulation of Data
4.3.5 Description of Layers in the OSI Model
4.4 Summary
4.5 Review Questions
4.6 References & Further Reading
4.0 OBJECTIVES
Understand concept of dividing a job into layered tasks
Get introduced to the OSIRM
Understand the functions of the various layers of the OSI
Mode.
4.1 INTRODUCTION
In the study of computer networks it is essential to study the
way our networks work. Computer networks are operated by
network models; most prominently the OSIRM and the TCP/ IP
Model. This chapter gives the understanding of the OSI reference
model.
4.2 CONCEPT OF LAYERED TASK
i. The main objective of a computer network is to be able to
transfer the data from sender to receiver. This task can be
done by breaking it into small sub tasks, each of which are
well defined.
30
ii. Each subtask will have its own process or processes to do
and will take specific inputs and give specific outputs to the
subtask before or after it. In more technical terms we can call
these sub tasks as layers.
iii. In general, every task or job can be done by dividing it into
sub task or layers. Consider the example of sending a letter
where the sender is in City A and receiver is in city B.
iv. The process of sending letter is shown below:
Fig: Concept of layer task: sending a letter
v. The above figure shows
a. Sender, Receiver & Carrier
b. Hierarchy of layers
vi. At the sender site, the activities take place in the following
descending order:
a. Higher Layer: The sender writes the letter along with the
sender and receivers address and put it in an envelope
and drop it in the mailbox.
b. Middle Layer: The letter is picked up by the post man and
delivered to the post office
c. Lower Layer: The letters at the post office are sorted and
are ready to be transported through a carrier.
31
vii. During transition the letter may be carried by truck, plane or
ship or a combination of transport modes before it reaches
the destination post office.
viii. At the Receiver site, the activities take place in the following
ascending order:
a. Lower Layer: The carrier delivers the letter to the
destination post office
b. Middle Layer: After sorting, the letter is delivered to the
receivers mail box
c. Higher Layer: The receiver picks up the letter, opens the
envelope and reads it.
ix. Hierarchy of layers: The activities in the entire task are
organized into three layers. Each activity at the sender or
receiver side occurs in a particular order at the hierarchy.
x. The important and complex activities are organized into the
Higher Layer and the simpler ones into middle and lower
layer.
4.3 OPEN SYSTEMS INTER CONNECTION
REFERENCE MODEL (OSIRM )
4.3.1 Introduction to OSI Model & its layers
The Open Systems Interconnection (OSI) Model was
developed by International Organization for
Standardization (ISO).
ISO is the organization, OSI is the model
It was developed to allow systems with different platforms
to communicate with each other. Platform could mean
hardware, software or operating system.
It is a network model that defines the protocols for
network communications.
It is a hierarchical model that groups its processes into
layers. It has 7 layers as follows: (Top to Bottom)
1. Application Layer
2. Presentation Layer
3. Session Layer
4. Transport Layer
5. Network Layer
6. Data Link Layer
7. Physical Layer
Each layer has specific duties to perform and has to co-
operate with the layers above and below it.
32
4.3.2 Layered Architecture of OSI Model
The OSI model has 7 layers each with its own dedicated
task.
A message sent from Device A to Device B passes has to
pass through all layers at A from top to bottom then all layers
at B from bottom to top as shown in the figure below.
At Device A, the message is sent from the top layer i.e
Application Layer A then all the layers till it reaches its
physical layer and then it is transmitted through the
transmission medium.
At Device B, the message received by the physical layer
passes through all its other layers and moves upwards till it
reaches its Application Layer.
Fig: Flow of Data from Device A to Device B through various
layers
As the message travels from device A to device B, it may
pass through many intermediate nodes. These intermediate
nodes usually involve only the first three layers of the OSI
model as shown below.
33
Fig: Data Transfer through Intermediate nodes
The Data Link layer determines the next node where the
message is supposed to be forwarded and the network layer
determines the final recipient.
4.3.3 Communication & Interfaces
For communication to occur, each layer in the sending
device adds its own information to the message it receives
from the layer just above it and passes the whole package to
the layer just below it. Each layer in the receiving device
removes the information added at the corresponding layer
and sends the obtained data to the layer above it.
Every Layer has its own dedicated function or services and
is different from the function of the other layers.
On every sending device, each layer calls upon the service
offered by the layer below it.
On every receiving device, each layer calls upon the service
offered by the layer above it.
Between two devices, the layers at corresponding levels
communicate with each other .i.e layer 2 at receiving end
can communicate and understand data from layer 2 of
sending end. This is called peer –to – peer communication.
For this communication to be possible between every two
adjacent layers there is an interface. An interface defines the
service that a layer must provide. Every layer has an
interface to the layer above and below it as shown in the
figure below
34
Fig: Communication & Interfaces in the OSI model
4.3.4 Encapsulation of Data
Fig: Encapsulation
35
As shown in the figure above the data at layer 7 i.e the
Application layer along with the header added at layer 7 is
given to layer 6, the Presentation layer. This layer adds Its
header and passed the whole package to the layer below.
The corresponding layers at the receiving side removes the
corresponding header added at that layer and sends the
remaining data to the above layer.
The above process is called encapsulation
4.3.5 Description of Layers in the OSI Model
4.3.5.1 Physical Layer
I. The Physical Layer provides a standardized interface to
physical transmission media, including :
a. Mechanical specification of electrical connectors
and cables, for example maximum cable length
b. Electrical specification of transmission line
c. Bit-by-bit or symbol-by-symbol delivery
II. On the sender side, the physical layer receives the data from
Data Link Layer and encodes it into signals to be transmitted
onto the medium. On the receiver side, the physical layer
receives the signals from the transmission medium decodes
it back into data and sends it to the Data Link Layer as
shown in the figure below:
Fig: Transmission of data to and from Physical Layer
III. Interface
The Physical Layer defines the characteristics of interfaces
between the devices & transmission medium.
36
IV. Representation of bits
The physical layer is concerned with transmission of signals
from one device to another which involves converting data
(1‘s & 0‘s) into signals and vice versa. It is not concerned
with the meaning or interpretation of bits.
V. Data rate
The physical layer defines the data transmission rate i.e.
number of bits sent per second. It is the responsibility of the
physical layer to maintain the defined data rate.
VI. Synchronization of bits
To interpret correct and accurate data the sender and
receiver have to maintain the same bit rate and also have
synchronized clocks.
VII. Line configuration
The physical layer defines the nature of the connection .i.e. a
point to point link, or a multi point link.
VIII. Physical Topology
The physical layer defines the type of topology in which the
device is connected to the network. In a mesh topology it
uses a multipoint connection and other topologies it uses a
point to point connection to send data.
IX. Transmission mode
The physical layer defines the direction of data transfer
between the sender and receiver. Two devices can transfer
the data in simplex, half duplex or full duplex mode
X. Main responsibility of the physical layer
Transmission of bits from one hop to the next.
4.3.5.2 Data Link Layer
I. The Data Link layer adds reliability to the physical layer by
providing error detection and correction mechanisms.
II. On the sender side, the Data Link layer receives the data
from Network Layer and divides the stream of bits into
fixed size manageable units called as Frames and sends
it to the physical layer. On the receiver side, the data link
layer receives the stream of bits from the physical layer
and regroups them into frames and sends them to the
Network layer. This process is called Framing. It is
shown in the figure below:
37
Fig: Data Link Layer: The process of Framing
III. Physical Addressing (inside / outside senders
network)
a. The Data link layer appends the physical address in
the header of the frame before sending it to physical
layer.
b. The physical address contains the address of the
sender and receiver.
c. In case the receiver happens to be on the same
physical network as the sender; the receiver is at only
one hop from the sender and the receiver address
contains the receiver‘s physical address.
d. In case the receiver is not directly connected to the
sender, the physical address is the address of the
next node where the data is supposed to be
delivered.
IV. Flow control
a. The data link layer makes sure that the sender
sends the data at a speed at which the receiver can
receive it else if there is an overflow at the receiver
side the data will be lost.
b. The data link layer imposes flow control mechanism
over the sender and receiver to avoid overwhelming
of the receiver.
V. Error control
a. The data link layer imposes error control mechanism
to identify lost or damaged frames, duplicate frames
and then retransmit them.
b. Error control information is present in the trailer of a
frame.
38
VI. Access Control
a. The data link layer imposes access control
mechanism to determine which device has right to
send data in an multipoint connection scenario.
VII. Main Responsibility
i. The main responsibility of the data link layer is hop to
hop transmission of frames.
4.3.5.3 Network Layer
I. The network layer makes sure that the data is delivered to
the receiver despite multiple intermediate devices.
II. The network layer at the sending side accepts data from the
transport layer, divides it into packets, adds addressing
information in the header and passes it to the data link layer.
At the receiving end the network layer receives the frames
sent by data link layer, converts them back into packets,
verifies the physical address (verifies if the receiver address
matches with its own address) and the send the packets to
the transport layer.
Fig: Network Layer
III. The network layer is responsible for source to destination of
delivery of data. Hence it may have to route the data through
multiple networks via multiple intermediate devices. In order
to achieve this the network layer relies on two things:
a. Logical Addressing
b. Routing
IV. Logical Addressing
The network layer uses logical address commonly known
as IP address to recognize devices on the network.
39
An IP address is a universally unique address which
enables the network layer to identify devices outside the
sender‘s network.
The header appended by the network layer contains the
actual sender and receiver IP address.
At every hop the network layer of the intermediate node
check the IP address in the header, if its own IP address
does not match with the IP address of the receiver found
in the header, the intermediate node concludes that it is
not the final node but an intermediate node and passes
the packet to the data link layer where the data is
forwarded to the next node.
V. Routing
VI. The network layer divides data into units called
packets of equal size and bears a sequence number for
rearranging on the receiving end.
Each packet is independent of the other and may travel
using different routes to reach the receiver hence may
arrive out of turn at the receiver.
Hence every intermediate node which encounters a
packet tries to compute the best possible path for the
packet. The best possible path may depend on several
factors such as congestion, number of hops, etc
This process of finding the best path is called as Routing.
It is done using routing algorithms.
VI. The Network layer does not perform any flow control or error
control
VII. Main Responsibility
The main responsibility of Network Layer is
transmission of packets from source to destination
4.3.5.4 Transport Layer
I. A logical address at network layer facilitates the
transmission of data from source to destination device.
But the source and the destination both may be having
multiple processes communicating with each other.
Hence it is important to deliver the data not only from
the sender to the receiver but from the correct process
on the sender to the correct process on the receiver.
The transport layer takes care of process to process
delivery of data and makes sure that it is intact and in
order.
40
II. At the sending side, the transport layer receives data
from the session layer, divides it into units called
segments and sends it to the network layer. At the
receiving side, the transport layer receives packets
from the network layer, converts and arranges into
proper sequence of segments and sends it to the
session layer.
Fig: Transport Layer
III. To ensure process to process delivery the transport
layer makes use of port address to identify the data
from the sending and receiving process. A Port
Address is the name or label given to a process. It is a
16 bit address. Ex. TELNET uses port address 23,
HTTP uses port address 80. Port address is also
called as Service Point Address
IV. The data can be transported in a connection oriented
or connectionless manner. If the connection is
connection oriented then all segments are received in
order else they are independent of each other and are
received out of order and have to be rearranged.
V. The Transport layer is responsible for segmentation
and reassembly of the message into segments which
bear sequence numbers. This numbering enables the
receiving transport layer to rearrange the segments in
proper order.
VI. Flow Control & Error control: the transport layer also
carries out flow control and error control functions; but
unlike data link layer these are end to end rather than
node to node.
41
VII. Main Responsibility
The main responsibility of the transport layer is
process to process delivery of the entire message.
4.3.5.5 Session Layer
I. The session layer establishes a session between the
communicating devices called dialog and
synchronizes their interaction. It is the responsibility of
the session layer to establish and synchronize the
dialogs. It is also called the network dialog controller.
II. The session layer at the sending side accepts data
from the presentation layer adds checkpoints to it
called syn bits and passes the data to the transport
layer. At the receiving end the session layer receives
data from the transport layer removes the checkpoints
inserted previously and passes the data to the
presentation layer.
III. The checkpoints or synchronization points is a way of
informing the status of the data transfer. Ex. A
checkpoint after first 500 bits of data will ensure that
those 500 bits are not sent again in case of
retransmission at 650th bit.
IV. Main responsibility of session layer is dialog
control and synchronizatoin
4.3.5.6 Presentation Layer
I. The communicating devices may be having different
platforms. The presentation layer performs translation,
encryption and compression of data.
42
II. The presentation layer at sending side receives the data
from the application layer adds header which contains
information related to encryption and compression and
sends it to the session layer. At the receiving side, the
presentation layer receives data from the session layer
decompresses and decrypts the data as required and
translates it back as per the encoding scheme used at the
receiver.
Fig : Presentation Layer
III. Translation
The sending and receiving devices may run on different
platforms (hardware, software and operating system). Hence
it is important that they understand the messages that are
used for communicating. Hence a translation service may be
required which is provided by the Presentation layers
IV. Compression
Compression ensures faster data transfer. The data
compressed at sender has to be decompressed at the
receiving end, both performed by the Presentation layer.
V. Encryption
It is the process of transforming the original message to
change its meaning before sending it. The reverse process
called decryption has to be performed at the receiving end to
recover the original message from the encrypted message.
VI. Main responsibility
The main responsibility of the Presentation layer is
translation, compression and encryption.
4.3.5.7Application Layer
I. The application layer enables the user to
communicate its data to the receiver by providing
43
certain services. For ex. Email is sent using X.400
service.
Fig : Application Layer
II. X500 is a directory service used to provide
information and access to distributed objects
III. X400 is services that provides basis for mail storage
and forwarding
IV. FTAM (File transfer, access and management)
provides access to files stored on remote computers
and mechanism for transfer and manage them locally.
V. Main Responsibility
Main Responsibility of Application layer is to provide
access to network resources.
4.4 SUMMARY
The responsibilities of the 7 layers of OSI model can be
summarized as follows:
1. Application Layer : To provide the users access to network
resources
2. Presentation Layer: To provide the functions of translation,
encryption and compression.
3. Session Layer: To establish, manage and terminate sessions
44
4. Transport Layer: To provide process to process delivery of
message
5. Network Layer: To provide source to destination delivery of
packets.
6. Datalink Layer: To provide hop to hop delivery of frames
7. Physical Layer: To transmit data over a bit stream from one hop
to the next and provide electrical and mechanical
specification.
4.5 REVIEW QUESTIONS
1. Explain the concept of layered task.
2. What is the OSI model? List its layers and explain their
responsibility in exactly one line.
3. Explain how the communication takes place between layers
of OSI model.
4. Write a short note on encapsulation of data in OSI model.
5. Differentiate between the working of Data link layer, Network
layer and Transport layer.
4.6 REFERENCE & FURTHER READING
Data Communication & Networking – Behrouz Forouzan
45
5
TCP/IP MODEL, ADDRESSING IN
TCP/IP – IPV4
Unit Structure
5.0 Objectives
5.1 Introduction
5.2 TCP/IP Model,
5.3 Addressing In TCP/IP
5.4 IPv4
5.4.1 IP addresses
5.4.2 Address Space
5.4.3 Notations used to express IP address
5.4.4 Classfull Addressing
5.4.5 Subnetting
5.4.6 CIDR
5.4.7 NAT
5.4.8 IPv4 Header Format
5.5 Summary
5.6 Review Questions
5.7 References & Further Reading
5.0 OBJECTIVES
Understand the basics of TCP/IP model
Understand the functions of the different layers and
protocols involved
Understand the Addressing mechanisms used under the
TCP/IP
Understand IPv4 and importantly IP address and IP
header format
5.1 INTRODUCTION
After an understand of the concept of layered task and then
understanding the OSI model we introduce the TCP/IP model. This
model is currently being used on our systems. TCP/IP model is a
collection of protocols often called a protocol suite. It offers a rich
variety of protocols from which we can choose from.
46
5.2 TCP/IP MODEL
It is also called as the TCP/IP protocol suite. It is a collection
of protocols.
IT is a hierarchical model, ie. There are multiple layers and
higher layer protocols are supported by lower layer
protocols.
It existed even before the OSI model was developed.
Originally had four layers (bottom to top):
1. Host to Network Layer
2. Internet Layer
3. Transport Layer
4. Application Layer
The figure for TCP/IP model is as follows:
Application
Transport
Network or IP
Host to Network
Fig: Layers of TCP/IP Reference Model
The structure TCP/IP model is very similar to the structure of
the OSI reference model. The OSI model has seven layers
where the TCP/IP model has four layers.
The Application layer of TCP/IP model corresponds to the
Application Layer of Session, Presentation & Application
Layer of OSI model.
The Transport layer of TCP/IP model corresponds to the
Transport Layer of OSI model
The Network layer of TCP/IP model corresponds to the
Network Layer of OSI model
The Host to network layer of TCP/IP model corresponds to
the Physical and Datalink Layer of OSI model.
The diagram showing the comparison of OSI model and
TCP/IP model along with the protocols is as shown below:
47
Fig: Comparison of OSI model and TCP/IP model
Functions of the Layers of TCP/IP model:
A. Host to Network Layer
This layer is a combination of protocols at the physical and
data link layers.
It supports all standard protocols used at these layers.
B. Network Layer or IP
Also called as the Internetwork Layer (IP). It holds the IP
protocol which is a network layer protocol and is
responsible for source to destination transmission of
data.
The Internetworking Protocol (IP) is an connection-less
& unreliable protocol.
48
It is a best effort delivery service. i.e. there is no error
checking in IP, it simply sends the data and relies on its
underlying layers to get the data transmitted to the
destination.
IP transports data by dividing it into packets or
datagrams of same size. Each packet is independent of
the other and can be transported across different routes
and can arrive out of order at the receiver.
In other words, since there is no connection set up
between the sender and the receiver the packets find the
best possible path and reach the destination. Hence, the
word connection-less.
The packets may get dropped during transmission along
various routes. Since IP does not make any guarantee
about the delivery of the data its call an unreliable
protocol.
Even if it is unreliable IP cannot be considered weak and
useless; since it provides only the functionality that is
required for transmitting data thereby giving maximum
efficiency. Since there is no mechanism of error detection
or correction in IP, there will be no delay introduced on a
medium where there is no error at all.
IP is a combination of four protocols:
1. ARP
2. RARP
3. ICMP
4. IGMP
1. ARP – Address Resolution Protocol
I. It is used to resolve the physical address of a device
on a network, where its logical address is known.
II. Physical address is the 48 bit address that is
imprinted on the NIC or LAN card, Logical address is
the Internet Address or commonly known as IP
address that is used to uniquely & universally identify
a device.
2. RARP– Reverse Address Resolution Protocol
I. It is used by a device on the network to find its
Internet address when it knows its physical address.
3. ICMP- Internet Control Message Protocol
I. It is a signaling mechanism used to inform the sender
about datagram problems that occur during transit.
49
II. It is used by intermediate devices.
III. In case and intermediate device like a gateway
encounters any problem like a corrupt datagram it
may use ICMP to send a message to the sender of
the datagram.
4. IGMP- Internet Group Message Protocol
I. It is a mechanism that allows to send the same
message to a group of recipients.
C. Transport Layer
Transport layer protocols are responsible for
transmission of data running on a process of one
machine to the correct process running on another
machine.
The transport layer contains three protocols:
1. TCP
2. UDP
3. SCTP
1. TCP – Transmission Control Protocol
I. TCP is a reliable connection-oriented, reliable
protocol. i.e. a connection is established between the
sender and receiver before the data can be
transmitted.
II. It divides the data it receives from the upper layer into
segments and tags a sequence number to each
segment which is used at the receiving end for
reordering of data.
2. UDP – User Datagram Protocol
I. UDP is a simple protocol used for process to process
transmission.
II. It is an unreliable, connectionless protocol for
applications that do not require flow control or error
control.
III. It simply adds port address, checksum and length
information to the data it receives from the upper
layer.
3. SCTP – Stream Control Transmission Protocol
I. SCTP is a relatively new protocol added to the
transport layer of TCP/IP protocol suite.
II. It combines the features of TCP and UDP.
III. It is used in applications like voice over Internet and
has a much broader range of applications
50
D. Application Layer
I. The Application Layer is a combination of Session,
Presentation & Application Layers of OSI models and
define high level protocols like File Transfer (FTP),
Electronic Mail (SMTP), Virtual Terminal (TELNET),
Domain Name Service (DNS), etc.
5.3 ADDRESSING IN TCP/IP
The TCP/IP protocol suited involves 4 different types of
addressing:
1. Physical Address
2. Logical Address
3. Port Address
4. Specific Address
APPLICATION SPECIFIC
Processes
LAYER ADDRESS
TRANSPORT PORT
TCP UDP SCTP
LAYER ADDRESS
NETWORK IP and other LOGICAL
LAYER associated ADDRESS
protocols
HOST TO
Protocols of underlying network used PHYSICAL
NETWORK
at physical & data link layer ADDRESS
LAYER
Fig: Addressing in TCP/IP model
51
Each of these addresses are described below:
1. Physical Address
i. Physical Address is the lowest level of addressing, also
known as link address.
ii. It is local to the network to which the device is connected
and unique inside it.
iii. The physical address is usually included in the frame and is
used at the data link layer.
iv. MAC is a type of physical address that is 6 byte (48 bit) in
size and is imprinted on the Network Interface Card (NIC) of
the device.
v. The size of physical address may change depending on the
type of network. Ex. An Ethernet network uses a 6 byte MAC
address.
2. Logical Address
i. Logical Addresses are used for universal communication.
ii. Most of the times the data has to pass through different
networks; since physical addresses are local to the network
there is a possibility that they may be duplicated across
multiples networks also the type of physical address being
used may change with the type of network encountered. For
ex: Ethernet to wireless to fiber optic. Hence physical
addresses are inadequate for source to destination delivery
of data in an internetwork environment.
iii. Logical Address is also called as IP Address (Internet
Protocol address).
iv. At the network layer, device i.e. computers and routers are
identified universally by their IP Address.
v. IP addresses are universally unique.
vi. Currently there are two versions of IP addresses being used:
a. IPv4: 32 bit address, capable of supporting 232 nodes
b. IPv6: 128 bit address, capable of supporting 2128
nodes
3. Port Address
VIII. A logical address facilitates the transmission of data
from source to destination device. But the source and
the destination both may be having multiple processes
communicating with each other.
52
Ex. Users A & B are chatting with each other using
Google Talk, Users B & C are exchanging emails
using Hotmail. The IP address will enable transmitting
data from A to B, but still the data needs to be
delivered to the correct process. The data from A
cannot be given to B on yahoo messenger since A & B
are communicating using Google Talk.
IX. Since the responsibility of the IP address is over here
there is a need of addressing that helps identify the
source and destination processes. In other words, data
needs to be delivered not only on the correct device
but also on the correct process on the correct device.
X. A Port Address is the name or label given to a
process. It is a 16 bit address.
XI. Ex. TELNET uses port address 23, HTTP uses port
address 80
4. Specific Address
i. Port addresses address facilitates the transmission of data
from process to process but still there may be a problem with
data delivery.
For Ex: Consider users A, B & C chatting with each other
using Google Talk. Every user has two windows open, user
A has two chat windows for B & C, user B has two chat
windows for A & C and so on for user C
Now a port address will enable delivery of data from user A
to the correct process ( in this case Google Talk) on user B
but now there are two windows of Google Talk for user A &
C available on B where the data can be delivered.
ii. Again the responsibility of the port address is over here and
there is a need of addressing that helps identify the different
instances of the same process.
iii. Such address are user friendly addresses and are called
specific addresses.
iv. Other Examples: Multiple Tabs or windows of a web browser
work under the same process that is HTTP but are identified
using Uniform Resource Locators (URL), Email
addresses.