CSC413 - Computer Networks and Communication - BOSU
CSC413 - Computer Networks and Communication - BOSU
Faculty of Science
Borno State University, Maiduguri
Course Content
The main objective of data communication and networking is to enable seamless exchange
of data between any two points in the world. This exchange of data takes place over a
computer network.
Data refers to the raw facts that are collected while information refers to processed data that
enables us to take decisions. Ex. When result of a particular test is declared it contains data
of all students, when you find the marks you have scored you have the information that lets
you know whether you have passed or failed. The word data refers to any information which
is presented in a form that is agreed and accepted upon by its creators and users.
This process involves a communication system which is made up of hardware and software.
The hardware part involves the sender and receiver devices and the intermediate devices
through which the data passes. The software part involves certain rules which specify what
is to be communicated, how it is to be communicated and when.
1
The effectiveness of any data communications system depends upon the following four
fundamental characteristics:
Delivery: The data should be delivered to the correct destination and correct user.
Accuracy: The communication system should deliver the data accurately, without
introducing any errors. The data may get corrupted during transmission affecting the
accuracy of the delivered data.
Timeliness: Audio and Video data has to be delivered in a timely manner without
any delay; such a data delivery is called real time transmission of data.
Jitter: It is the variation in the packet arrival time. Uneven Jitter may affect the
timeliness of data being transmitted.
Data is collection of raw facts which is processed to deduce information. There may be
different forms in which data may be represented. Some of the forms of data used in
communications are as follows:
1. Text
Text includes combination of alphabets in small case as well as upper case.
It is stored as a pattern of bits. Prevalent encoding system: ASCII, Unicode.
2. Numbers
2
Numbers include combination of digits from 0 to 9.
It is stored as a pattern of bits. Prevalent encoding system : ASCII, Unicode
3. Images
An image is worth a thousand words‖ is a very famous saying. In computers images
are digitally stored.
A Pixel is the smallest element of an image. To put it in simple terms, a picture or
image is a matrix of pixel elements.
The pixels are represented in the form of bits. Depending upon the type of image
(black n white or color) each pixel would require different number of bits to
represent the value of a pixel.
The size of an image depends upon the number of pixels (also called resolution) and
the bit pattern used to indicate the value of each pixel.
Example: if an image is purely black and white (two color) each pixel can be
represented by a value either 0 or 1, so an image made up of 10 x 10 pixel elements
would require only 100 bits in memory to be stored.
On the other hand an image that includes gray may require 2 bits to represent every
pixel value (00 - black, 01 – dark gray, 10– light gray, 11 –white). So the same 10 x
10 pixel image would now require 200 bits of memory to be stored.
Commonly used Image formats : jpg, png, bmp, etc.
4. Audio
Data can also be in the form of sound which can be recorded and broadcasted.
Example: What we hear on the radio is a source of data or information.
Audio data is continuous, not discrete.
5. Video
Video refers to broadcasting of data in form of picture or movie
Two devices communicate with each other by sending and receiving data. The data can flow
between the two devices in the following ways.
Simplex
Half Duplex
Full Duplex
1.5.1 Simplex
In Simplex, communication is unidirectional.
Only one of the devices sends the data and the other one only receives the data.
Example: in the below diagram: a cpu send data while a monitor only receives data.
Figure 2 depicts the concept of simplex communication.
3
1.5.2 Half Duplex
In half duplex both the stations can transmit as well as receive but not at the same time.
When one device is sending other can only receive and vice versa. Example: A walkie-
talkie. Figure 3 depicts the concept of half duplex communication.
Definition:
A computer network can be defined as a collection of nodes. A node can be any device
capable of transmitting or receiving data. The communicating nodes have to be connected
by communication links.
A. Local Area Networks (LAN) is usually limited to a few kilometers of area. It may be
privately owned and could be a network inside an office on one of the floor of a building or
a LAN could be a network consisting of the computers in an entire building.
B. Wide Area Network (WAN) is made of all the networks in a (geographically) large
area. The network in the entire state of Maharashtra could be a WAN
C. Metropolitan Area Network (MAN) is of size between LAN & WAN. It is larger than
LAN but smaller than WAN. It may comprise the entire network in a city like Maiduguri.
4
1.7 Protocol
A Protocol is one of the components of a data communications system. Without protocol
communication cannot occur. The sending device cannot just send the data and expect the
receiving device to receive and further interpret it correctly.
When the sender sends a message it may consist of text, number, images, etc. which are
converted into bits and grouped into blocks to be transmitted and often certain additional
information called control information is also added to help the receiver interpret the data.
For successful communication to occur, the sender and receiver must agree upon certain
rules called protocol.
B. Semantics
It tells the meaning of each section of bits and indicates the interpretation of each
section.
It also tells what action/decision is to be taken based on the interpretation.
C. Timing
It tells the sender about the readiness of the receiver to receive the data.
It tells the sender at what rate the data should be sent to the receiver to avoid
overwhelming the receiver.
Without standards we would have proprietary products creating isolated islands of users
which cannot interconnect.
1. De facto Standard
These are the standards that have been traditionally used and mean by fact or by
convention.
These standards are not approved by any organized body but are adopted by
widespread use.
2. De jure standard
It means by law or by regulation.
5
These standards are legislated and approved by a body that is officially
recognized.
Examples of Forums
1. ATM Forum
2. MPLS Forum
3. Frame Relay Forum
2. Digital data refers to information that has discrete states. Digital data take on discrete
values.
For example, data are stored in computer memory in the form of 0s and 1s.
6
Figure: a) Analog Signal b) Digital Signal
Signals which repeat itself after a fixed time duration are called Periodic Signals (E.g.
simple pendulum or movement of planet around the sun).
Signals which do not repeat itself after a fixed time period are called Non-Periodic Signals
(E.g. Speech wave form). In data communications, we commonly use periodic analog
signals and non-periodic digital signals.
An analog signal has infinitely many levels of intensity over a period of time.
As the wave moves from value A to value B, it passes through and includes an infinite
number of values along its path as it can be seen in the figure below.
A simple analog signal is a sine wave that cannot be further decomposed into simpler
signals.
1. Peak Amplitude
2. Frequency
3. Phase
7
2.3.1.1 Peak Amplitude
The amplitude of a signal is the absolute value of its intensity at time t.
The peak amplitude of a signal is the absolute value of the highest intensity.
The amplitude of a signal is proportional to the energy carried by the signal
2.3.1.3. Phase
Phase describes the position of the waveform with respect to time (specifically relative to
time 0).
Phase indicates the forward or backward shift of the waveform from the axis.
It is measured in degrees or radian.
The figure below shows the sine waves with same amplitude and frequency but
different phases.
8
T=1/f
OR
F=1/T
Example 1. A wave has a frequency of 100hz. Its period (T) is given by T = 1/ F = 1/ 100 =
0.01 sec
Example 2. A wave completes its one cycle in 0.25 seconds. Its frequency is given by
F = 1 / T = 1 / 0.25 = 4 Hz
2.3.3 Wavelength
The wavelength of a signal refers to the relationship between frequency (or period)
and propagation speed of the wave through a medium.
The wavelength is the distance a signal travels in one period.
It is given by
Wavelength = Propagation Speed X Period
OR
Wavelength = Propagation Speed X 1/ Frequency.
It is represented by the symbol: λ (pronounced as lamda).
It is measured in micrometers.
It varies from one medium to another.
A sine wave can be represented either in the time domain or frequency domain. The time-
domain plot shows changes in signal amplitude with respect to time. It indicates time and
amplitude relation of a signal. The frequency-domain plot shows signal frequency and peak
amplitude. The figure below show time and frequency domain plots of three sine waves.
9
Figure: Time domain and frequency domain plots of three sine waves
A complete sine wave in the time domain can be represented by one single spike in the
frequency domain.
A composite signal is a combination of two or more simple sine waves with different
frequency, phase and amplitude. If the composite signal is periodic, the decomposition
gives a series of signals with discrete frequencies; if the composite signal is non-periodic,
the decomposition gives a combination of sine waves with continuous frequencies.
For data communication a simple sine wave is not useful, what is used is a
composite signal which is a combination of many simple sine waves.
According to French Mathematician, Jean Baptist, any composite signal is a
combination of simple sine waves with different amplitudes and frequencies and
phases.
Composite signals can be periodic or non-periodic.
A periodic composite signal can be decomposed into a series of signals with discrete
frequencies.
A non-periodic signal when decomposed gives a combination of sine waves with
continuous frequencies.
10
Figure: The time and frequency domains of a non-periodic composite analog signal
Information can also be explained in the form of a digital signal. A digital signal can be
explained with the help of following points;
A digital signal is the signal that has discrete values. The signal will have value that is not
continuous.
Information in a digital signal can be represented in the form of voltage levels. For example,
in the signal shown in figure below a ‘1’ is represented by a positive voltage and a ‘0’ is
represented by a Zero voltage.
Figure: A digital signal with two levels. ‘1’ represented by a positive voltage and ‘0’
represented by a negative voltage
11
In general, if a signal has L levels then, each level need Log2L bits.
Example: Consider a digital Signal with four levels, how many bits are required per
level?
Answer: Number of bits per level = Log2L
= Log24
= 2.
Hence, 2 bits are required per level for a signal with four levels.
It is the rate of Signal Speed, i.e the rate at which the signal changes.
A digital signal with two levels ‘0’ & ‘1’ will have the same baud rate and bit rate.
The diagram below shows three signal of period (T) 1 second
a) Signal with a bit rate of 8 bits/ sec and baud rate of 8 baud/sec
b) Signal with a bit rate of 16 bits/ sec and baud rate of 8 baud/sec
c) Signal with a bit rate of 16 bits/ sec and baud rate of 4 baud/sec
12
Figure: Three signals with different bit rates and baud rates
Each composite signal has a lowest possible (minimum) frequency and a highest possible
(maximum) frequency.
From the point of view of transmission, there are two types of channels:
This channel has the lowest frequency as ‘0’ and highest frequency as some non-zero
frequency ‘f1’. This channel can pass all the frequencies in the range 0 to f1.
This channel has the lowest frequency as some non-zero frequency ‘f1’ and highest
frequency as some non-zero frequency ‘f2’. This channel can pass all the frequencies in the
range f1 to f2.
13
2.6 Transmission of Digital signal
The signal is transmitted without making any change to it (i.e. without modulation).
In baseband transmission, the bandwidth of the signal to be transmitted has to be less
than the bandwidth of the channel.
Example, Consider a Baseband channel with lower frequency 0Hz and higher frequency
100Hz, hence, its bandwidth is 100 (Bandwidth is calculated by getting the difference
between the highest and lowest frequency).
We can easily transmit a signal with frequency below 100Hz, such a channel whose
bandwidth is more than the bandwidth of the signal is called Wideband channel.
Logically a signal with frequency say 120Hz will be blocked resulting in loss of
information, such a channel whose bandwidth is less than the bandwidth of the signal is
called Narrowband channel
Given a bandpass channel, a digital signal cannot be transmitted directly through it.
In broadband transmission we use modulation, i.e. we change the signal to analog signal
before transmitting it.
The digital signal is first converted to an analog signal, since we have a bandpass channel
we cannot directly send this signal through the available channel. Example. Consider the
bandpass channel with lower frequency 50Hz and higher frequency 80Hz, and the signal
to be transmitted has frequency 10Hz.
To pass the analog signal through the bandpass channel, the signal is modulated using a
carrier frequency. Example. The analog signal (10Hz) is modulated by a carrier
frequency of 50Hz resulting in a signal of frequency 60Hz which can pass through our
bandpass channel. The signal is demodulated and again converted into a digital signal at
the other end as shown in the figure below.
14
3.1 Bandwidth
This section gives insights to the concept of bandwidth. It tells about bandwidth of signal
and medium. Also explains how to calculate the bandwidth for a noisy and noiseless
channel.
In the 19th century, French mathematician Jean-Baptiste Fourier proved that any composite
signal is a combination of simple sine waves with different frequencies, amplitudes, and
phases.
15
Figure: Bandwidth of a signal in time domain and frequency domain
The Nyquist bit rate formula defines the theoretical maximum bit rate for a noiseless
channel.
Where,
Example: What is the maximum bit rate of a noiseless channel with a bandwidth of 5000
Hz transmitting a signal with two signal levels?
Solution: The bit rate for a noiseless channel according to Nyquist Bit rate can be calculated
as follows:
The Shannon Capacity defines the theoretical maximum bit rate for a noisy channel.
Where,
Shannon Capacity for calculating the maximum bit rate for a noisy channel does not
consider the number of levels of the signals being transmitted as done in the Nyquist bit
rate.
Example: Calculate the bit rate for a noisy channel with SNR 300 and bandwidth of
3000Hz Solution:
17
The bit rate for a noisy channel according to Shannon Capacity can be calculated as follows:
SWITCHING METHODS
4.1 Introduction
Switching is the generic method for establishing a path for point-to-point communication in
a network. It involves the nodes in the network utilizing their direct communication lines to
other nodes so that a path is established in a piecewise fashion. Each node has the capability
to ‘switch’ to a neighboring node (i.e., a node to which it is directly connected) to further
stretch the path until it is completed.
One of the most important functions of the network layer is to employ the switching
capability of the nodes in order to route messages across the network. There are two basic
methods of switching circuit switching and packet switching.
The Figure below, shows a simple circuit switch which consists of a 3×3 matrix, capable of
connecting any of its inlets (a, b, and c) to any of its outlets (d, e, and f). Each crosspoint
appears as a circle. A hollow circle means that the crosspoint is off (i.e., the two crossing
wires are not connected). A solid circles means that the crosspoint is on (i.e., the crossing
18
wires are connected). Switches may also have more inlets than outlets, or more outlets than
inlets.)
When the two hosts shown in the figure initiate a connection, the network determines a path
through the intermediate switches and establishes a circuit which is maintained for the
duration of the connection. When the hosts disconnect, the network releases the circuit.
Data transfer:
Transfer data is from the source to the destination. The data may be analog or digital,
depending on the nature of the network. The connection is generally full-duplex.
19
Circuit disconnect:
Let us consider the operation of a single circuit switched node comprising a collection of
stations attached to a central switching unit, which establishes a dedicated path between any
two devices that had the intention to communicate.
A blocking network is one, which may be unable to connect two stations because all
possible paths between them are already in use.
A non-blocking network permits all stations to be connected (in pairs) at once and grants
all possible connection requests as long as the called party is free. For a network that
supports only voice traffic, a blocking configuration may be acceptable, since most phone
calls are of short duration. For data applications, where a connection may remain active for
hours, non-blocking configuration is desirable.
20
Figure: Schematic Diagram of a Switching node
Circuit switching uses any of the three (3) technologies: Space division switches, Time-
division switches or a combination of both.
In Space-division switching, the paths in the circuit are separated with each other spatially,
i.e. different ongoing connections, at a same instant of time, uses different switching paths,
which are separated spatially. This was originally developed for the analog environment,
and has been carried over to the digital domain. Some of the space switches are crossbar
switches, Multistage switches (e.g. Omega Switches). Basic building block of the switch is a
metallic cross-point or semiconductor gate that can be enabled or disabled by a control unit.
Some of the limitations crossbar can be overcome with the help of multistage space
division switches. By splitting the crossbar switch into smaller units and interconnecting
them, it is possible to build multistage switches with fewer cross-points.
Both voice and data can be transmitted using digital signals through the same switches. All
modern circuit switches use digital time-division multiplexing (TDM) technique for
establishing and maintaining circuits. Synchronous TDM allows multiple low-speed bit
streams to share a high-speed line.
21
Figure: Time Division Multiplexing
Packet switching was designed to address the shortcomings of circuit switching in dealing
with data communication. Unlike circuit switching where communication is continuous
along a dedicated circuit, in packet switching, communication is discrete in form of packets.
Each packet is of a limited size and can hold up to a certain number of octets of user data.
Larger messages are broken into smaller chunks so that they can be fitted into packets. In
addition to user data, each packet carries additional information (in form of a header) to
enable the network to route it to its final destination.
A packet is handed over from node to node across the network. Each receiving node
temporarily stores the packet, until the next node is ready to receive it, and then passes it
onto the next node. This technique is called store-and-forward and overcomes one of the
limitations of circuit switching. A packet-switched network has a much higher capacity for
accepting further connections. Additional connections are usually not blocked but simply
slow down existing connections, because they increase the overall number of packets in the
network and hence increase the delivery time of each packet. Figure below depicts a simple
packet switch with six I/O channels (a through f). Each channel has an associated buffer
which is used to store packets in transit. The operation of the switch is controlled by a
microprocessor. A packet received on any of the channels can be passed onto any of the
other channels by the microprocessor moving it to the corresponding buffer.
22
Figure: A simple packet switch
The virtual circuit method (also known as connection oriented) is closer to circuit
switching. In this, a complete route is worked out prior to sending data packets. The route is
established by sending a connection request packet along the route to the intended
destination. This packet informs the intermediate nodes about the connection and the
established route so that they will know how to route subsequent packets. The result is a
circuit somewhat similar to those in circuit switching, except that it uses packets as its basic
unit of communication. Hence it is called a virtual circuit.
Each packet carries a virtual circuit identifier which enables a node to determine to which
virtual circuit it belongs and hence how it should be handled. The virtual circuit identifier is
essential because multiple virtual circuits may pass through the same node at the same time.
Because the route is fixed for the duration of the call, the nodes spend no effort in
determining how to route packets.
The figure below illustrates the virtual circuit method using the switch. When the two hosts
initiate a connection, the network layer establishes a virtual circuit (denoted by shaded
switches) which is maintained for the duration of the connection. When the hosts
disconnect, the network layer releases the circuit. The packets in transit are displayed as
dark boxes within the buffers. These packets travel only along the designated virtual circuit.
23
The datagram method (also known as connectionless) does not rely on a pre-established
route, instead each packet is treated independently. Therefore, it is possible for different
packets to travel along different routes in the network to reach the same final destination. As
a result, packets may arrive out of order, or even never arrive (due to node failure). It is up
to the network user to deal with lost packets, and to rearrange packets to their original order.
Because of the absence of a pre-established circuit, each packet must carry enough
information in its header to enable the nodes to route it correctly. The figure below
illustrates the datagram method. Noting how the packets exercise different routes.
The advantage of the datagram approach is that because there is no circuit, congestion and
faulty nodes can be avoided by choosing a different route. Also, connections can be
established more quickly because of reduced overheads. This makes datagrams better suited
than virtual circuits for brief connections. For example, database transactions in banking
systems are of this nature, where each transaction involves only a few packets.
The advantage of the virtual circuit approach is that because no separate routing is required
for each packet, they are likely to reach their destination more quickly; this leads to
improved throughput. Furthermore, packets always arrive in order.
Virtual circuits are better suited to long connections that involve the transfer of large
amounts of data (e.g., transfer of large files). Because packet switching is the more
dominant form of switching for data communication, we may need to focus our attention on
this form of switching from now on.
24
Any delay in passing traffic is known as latency. Switches offer three ways to switch the
traffic depending upon how thoroughly you want the frame to be checked before it is passed
on. The more checking you want, the more latency you will introduce to the switch.
Cut-through
Store-and-forward
Fragment-free
Cut-through Mode: Cut-through switching is the fastest switching method,
meaning it has the lowest latency. The incoming frame is read up to the destination
MAC address. Once it reaches the destination MAC address, the switch then checks
its MAC table for the correct port to forward the frame out of and sends it on its
way. There is no error checking, so this method gives you the lowest latency. The
consequence is that the switch will forward any frames containing errors.
Store-and-forward Mode: in this, the switch reads the entire frame and copies it
into its buffers. A cyclic redundancy check (CRC) takes place to check the frame for
any errors. If errors are found, the frame is dropped. Otherwise the switching table is
examined and the frame forwarded.
Fragment-free (modified cut-through/runt-free) Mode: Since cut-through can’t
ensure that all frames are good and store-and-forward takes too long, we need a
method that is both reliable and fast. Using an example of a nightclub security,
imagine you are asked to make sure that everyone has an ID and that the picture on
the ID matches the person. With this method you have to make sure everyone is who
they say they are, but you do not have to take down all the information. In switching,
we accomplish this by using the fragment-free method of switching.
NETWORK MODELS
5.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 Open Systems
Inter Connection Reference Model (OSIRM) and the Transmission Control Protocol/
Internet Protocol (TCP/ IP) Model. This section provides the understanding of the OSI
reference model.
25
5.2 The 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.
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.
26
vii. At the Receiver side, 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.
viii. 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.
ix. The important and complex activities are organized into the Higher Layer and the
simpler ones into middle and lower layer.
5.3 Open System Inter Connection Reference Model
The OSI model has 7 layers each with its own dedicated task.
A message sent from Device A to Device B 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 of A then all
the layers till it reaches its physical layer and then it is transmitted through the
transmission medium.
27
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.
Figure: Flow of data from Device A to Device B via the 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.
The Data Link layer determines the next node where the message is supposed to be
forwarded and the network layer determines the final recipient.
28
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.
Figure: Encapsulation
29
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.
Physical Layer
iii. Interface: the Physical Layer defines the characteristics of interfaces between the
devices and transmission medium.
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.
30
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.
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:
31
b. Error control information is present in the trailer of a frame.
vi. Access Control
a. The data link layer imposes access control mechanism to determine which device has
right to send data in a multipoint connection scenario.
vii.Main Responsibility
i. the main responsibility of the data link layer is hop to hop transmission of frames.
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 then send the packets to the transport 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.
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
The network layer divides data into units called packets of equal size and bears a
sequence number for rearranging on the receiving end.
32
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.
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. Therefore, 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.
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.
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. Example, 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.
33
vi. Flow Control and 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.
vii. Main Responsibility
The main responsibility of the transport layer is process to process delivery of the
entire message.
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. Example, 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 synchronization
Presentation Layer
i. The communicating devices may be having different platforms. The presentation layer
performs translation, encryption and compression of data.
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.
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
34
iv. 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 of Presentation layer is translation, compression and encryption.
Application Layer
i. The application layer enables the user to communicate its data to the receiver by
providing certain services. For example, Email is sent using X.400 service.
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.
35
3. Session Layer: To establish, manage and terminate sessions.
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.
6.1 Introduction
After understanding the concept of layered task and 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.
It is also called as the TCP/IP protocol suite. It is a collection of protocols.
It is a hierarchical model, i.e. 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. Internetwork Layer (Network Layer)
3. Transport Layer
4. Application Layer
The figure for TCP/IP model is as follows:
36
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:
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 a connection-less and unreliable protocol.
37
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 (4) protocols:
1. Address Resolution Protocol (ARP)
2. Reverse Address Resolution Protocol (RARP)
3. Internet Control Message Protocol (ICMP)
4. Internet Group Message Protocol (IGMP)
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 and universally identify a device.
i. It is used by a device on the network to find its Internet address when it knows its
physical address.
i. It is a signaling mechanism used to inform the sender about datagram problems that
occur during transit.
ii. It is used by intermediate devices.
38
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.
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.
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.
i. SCTP is a relatively new protocol added to the transport layer of TCP/IP protocol suite.
iii. It is used in applications like voice over Internet and has a much broader range of
applications.
D. Application Layer
39
i. The Application Layer is a combination of Session, Presentation and Application Layers
of OSI models and define high level protocols like File Transfer (FTP), Electronic Mail
(Simple Mail Transfer Protocol-SMTP), Virtual Terminal (Text-based Network protocol-
TELNET), Domain Name Service (DNS) and so on.
1. Physical Address
2. Logical Address
3. Port Address
4. Specific Address
40
v. The size of physical address may change depending on the type of network. Example.
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 example, 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
i. 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.
Example. Users A and B are chatting with each other using Google Talk, Users B and 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 and B are communicating using Google Talk.
ii. Since the responsibility of the IP address is different 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.
iii. A Port Address is the name or label given to a process. It is a 16 bit address.
iv. Example. 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.
41
For Example: Consider users A, B and C chatting with each other using Google Talk. Every
user has two windows open, user A has two chat windows for B and C, user B has two chat
windows for A and 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 and
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.
6.3 IP Protocol -IPV4
Packets in the IPv4 format are called datagram. An IP datagram consists of a header part
and a text part (payload). The header has a 20-byte fixed part and a variable length optional
part. It is transmitted in big-endian order: from left to right, with the high order bit of the
Version field going first. IPv4 can be explained with the help of following points:
1. IP addresses
2. Address Space
3. Notations used to express IP address
4. Classfull Addressing
5. Subnetting
6. Class Inter-Domain Routing (CIDR)
7. Network Address Translation (NAT)
8. IPv4 Header Format
6.3.1 IP addresses
Every host and router on the Internet has an IP address, which encodes its network
number and host number.
The combination is unique: in principle, no two machines on the Internet have the same
IP address.
An IPv4 address is 32 bits long.
They are used in the Source address and Destination address fields of IP packets.
An IP address does not refer to a host but it refers to a network interface.
6.3.2 Address Space
42
An address space is the total number of addresses used by the protocol. If a protocol uses
N bits to define an address, the address space is 2 N because each bit can have two
different values (0 or 1) and N bits can have 2N values.
IPv4 uses 32-bit addresses, which means that the address space is 2 32 or 4,294,967,296
(more than 4 billion).
6.3.3 Notations
There are two notations to show an IPv4 address:
1. Binary notation
The IPv4 address is displayed as 32 bits. Example. 11000001 10000011 00011011
11111111.
2. Dotted decimal notation
To make the IPv4 address easier to read, Internet addresses are usually written in
decimal form with a decimal point (dot) separating the bytes. Each byte (octet) is 8
bits hence each number in dotted-decimal notation is a value ranging from 0 to 255.
Example. 129.11.11.239.
6.3.4 Classful addressing
In classful addressing, the address space is divided into five classes: A, B, C, D, and E.
43
The IP address 0.0.0.0 is used by hosts when they are being booted.
All addresses of the form 127.xx.yy.zz are reserved for loopback testing, they are
processed locally and treated as incoming packets.
6.3.5 Subnetting.
It allows a network to be split into several parts for internal use but still act like a single
network to the outside world.
To implement subnetting, the router needs a subnet mask that indicates the split between
network + subnet number and host. Example. 255.255.252.0/22. A”/22” to indicate that
the subnet mask is 22 bits long.
Consider a class B address with 14 bits for the network number and 16 bits for the host
number where some bits are taken away from the host number to create a subnet number.
44
This is resulting in depletion of Address space. A solution is CIDR (Classless Inter-
Domain Routing). The basic idea behind CIDR, is to allocate the remaining IP
addresses in variable-sized blocks, without regard to the classes.
6.3.7 NAT (Network Address Translation)
The scarcity of network addresses in IPv4 led to the development of IPv6.
IPv6 uses a 128 bit address, hence it has 2128 addresses in its address space which is
larger than 232 addresses provided by IPv4.
Transition from IPv4 to IPv6 is slowly occurring, but will take years to complete,
because of legacy hardware and its incompatibility to process IPv6 address.
NAT (Network Address Translation) was used to speed up the transition process.
The only rule is that no packets containing these addresses may appear on the
Internet itself. The three reserved ranges are:
10.0.0.0 – 10.255.255.255/8 (16,777,216 hosts)
172.16.0.0 – 172.31.255.255/12 (1,048,576 hosts)
192.168.0.0 – 192.168.255.255/16 (65,536 hosts).
Operation:
Within the Organization, every computer has a unique address of the form 10.x.y.z.
However, when a packet leaves the organization, it passes through a NAT box that
converts the internal IP source address, 10.x.y.z, to the organizations true IP address,
198.60.42.12 for example.
6.3.6 IP Header
45
Summary
Example of subnetting:
Subnetting basics
46
Subnet mask
Network ID
Host ID
RRRR XXXX YYYY ZZZZ
8 bits (octet) 8 bits (octet) 8 bits (octet) 8 bits (octet)
+
Network Bits Host Bits (Denoted
(Denoted by ‘1’) by ‘0’)
Class A- (0-127) N H H H
Class B- (128-191)
N N H H
Class C- (192-223)
N N N H
Class A
11111111 00000000 00000000 00000000 16,777,216 Hosts
Class B 16
11111111 11111111 00000000 00000000 65,536 Hosts
Class C
11111111 11111111 11111111 00000000 256 Hosts
For us to understand how this values are obtained, we can use power of 2 approach.
2 2 2 2 24 25 26 27 28
0 1 2 3
1 2 4 8 1 3 6 12 25
145.65.16.0
6 2 4 8 6
145.65.0.0
Subnetting
Router
145.65.32.0
Subnet Mask of
Class A is 255. 0. 0. 0
47
CIDR is represented with slash ‘/’ notation.
Number of Host?
Broadcast ID?
Create the subnet of the following IP address 203.155.67.0/26. Then generate the;
Subnet mask
Network ID
Number of Host
Broadcast IP
Number of Subnets
Solution
Subnet mask is
255.255.255.2^7+2^6 = 255.255.255.128+64 = 255.255.255.192 is the subnet mask
Network ID is
To get the Network ID, you need to perform logical AND operation for the binary bits of all
the subnet mask and the initial (given) IP address.
203.155.67.0 x y AND
1 1 1
AND 1 0 0
0 1 0
255. 255. 255. 192 0 0 0
Number of Host is
We need to count the number of ‘0’ bits in the last octet of the IP address
And the formula is, number of host = 2n-2. The n is the number of ‘0’ bits
48
Number of Subnet
This is represented as 2n, where n is the number of ‘1’ bits in the last octet or subnet part.
Broadcast IP
You will need to consider the number of host calculated and then add a one (1) to the last
values.
Solution
To create 10 subnets, you need to use the formula for finding number of subnets which is 2 n.
Thus, we start from 20 = 1, 1 is less than 10, 21 = 2, 2 is less than 10, 22 = 4, 4 is less than 10,
23 = 8, 8 is less than 10, 24 =16, 16 is greater than 10.
Hence, we use n = 4
Subnet mask is
255.255.255.2^7+2^6+2^5+2^4 = 255.255.255.128+64+32+16 = 255.255.255.240 is
the subnet mask
Network ID
To get the Network ID, you need to perform logical AND operation for the binary bits of all
the subnet mask and the initial (given) IP address.
207.144.77.0 x y AND
1 1 1
AND 1 0 0
0 1 0
255. 255. 255. 240 0 0 0
49
Therefore, the Network ID is 207.144.77.0
Number of Host is
We need to count the number of ‘0’ bits in the last octet of the IP address
And the formula is, number of host = 2n-2. The n is the number of ‘0’ bits
Number of Subnet
This is represented as 2n, where n is the number of ‘1’ bits in the last octet or subnet part.
Number of subnet = 24 = 16. Therefore, we can have sixteen (16) different networks/subnets.
Broadcast IP
You will need to consider the number of host calculated and then add a one (1) to the last
values.
Assignment
50