You are on page 1of 1302

INDEX

S. No Topic Page No.


Week 1
1 Lecture 1 : Introduction to Computer Networks – A brief history 1
Lecture 2: Data Networks – from Circuit Switching Network to Packet
2 Switching Network 21
3 Lecture 3 : Network Protocol Stack 51
4 Lecture 4 : Services at the Different Layers of the Protocol Stack 74
Lecture 5 : Application Layer I – Different Protocols at the Application
5 Layer 96
Week 2
6 Lecture 6: Application Layer II – Domain Name Systems 117
7 Lecture 7: Application Layer III – The Web 148
8 Lecture 8; Application Layer III – Hypertext Transfer Protocol 171
9 Lecture 9: Application Layer III – Internet Mail Transfer 194
10 Lecture 10: Application Layer IV – File Transfer (FTP) 215
Week 3
11 Lecture 11: Transport Layer I – Services 238
12 Lecture 12: Transport Layer II - Connection 252
13 Lecture 13: Transport Layer II - Connection (Contd.) 274
14 Lecture 14: Transport Layer IV – Reliability 297
15 Lecture 15: Transport Layer V – Sliding Window Protocols 313
Week 4
16 Lecture 16: Transport Layer Performance 335
17 Lecture 17 Buffer Management and Congestion Control 350
18 Lecture 18: Transport Layer Primitives 371
19 Lecture 19: Transmission Control Protocol I – Basics 390
20 Lecture 20: Transmission Control Protocol II – Connections 410
Week 5
21 Lecture 21:Transmission Control Protocol III – Flow Control 428
22 Lecture 22: Transmission Control Protocol IV – Congestion Control 451
23 Lecture 23: User Datagram Protocol 473
24 Lecture 24: Socket Programming – I 489
25 Lecture 25: Socket Programming – II 512
Week 6
26 Lecture 26: Network Layer I – Introduction 550
27 Lecture 27: IP Addressing (IPv4) I – Classful addressing 570
28 Lecture 28: IP Addressing (IPv4) II - CIDR 588
Lecture 29: IP Addressing (IPv4) III – Network Address Translation
29 (NAT) 605
30 Lecture 30: IPv6 Addressing 622
Week 7
31 Lecture 31: Internet QoS - I (What is QoS) 643
32 Lecture 32: Internet QoS - II (Basic QoS Architecture) 665
33 Lecture 33: Internet QoS - III (Traffic Policing and Traffic Shaping) 682
34 Lecture 34: Internet QoS - IV (Traffic Scheduling) 694
Lecture 35: Internet QoS - V (Integrated and Differentiated Service
35 Architecture) 717
Week 8
36 Lecture 36: IP Routing Table 744
37 Lecture 37: Routing in the Internet I – Intra-domain routing 771
38 Lecture 38: Routing in the Internet II - Routing protocols 795
39 Lecture 39: Routing in the Internet III – Inter-domain Routing 814
40 Lecture 40: Routing in the Internet IV – Border Gateway Protocol 832
Week 9
41 Lecture 41 : IP Routers 852
42 Lecture 42 : IP Routers Demo 870
43 Lecture 43 : Software Defined Networking - I (Basics) 893
44 Lecture 44 : Software Defined Networking - II (Open Flow) 908
45 Lecture 45 : Software Defined Networking - III (Demo) 930
Week 10
46 Lecture 46 : Data Link Layer - Overview 961
47 Lecture 47 : Data Link Layer - Basic Concepts 981
48 Lecture 48 : Data Link Layer - Ethernet 1000
49 Lecture 49 : Data Link Layer - Ethernet(Contd.) 1022
50 Lecture 50 : Data Link Layer - Flow and Error Control 1040
Week 11
51 Lecture 51 : ARP-RAPP-BOOTP-DHCP 1061
52 Lecture 52 : ARP-RAPP-BOOTP-DHCP(Contd.) 1086
53 Lecture 53 1106
54 Lecture 54 : Wireless LANs 1131
Week 12
55 Lecture 55 : Layer 1: Physical Layer 1152
56 Lecture 56 : Layer 1: Physical Layer-II 1172
57 Lecture 57 : Layer 1: Physical Layer-III 1193
58 Lecture 58 : Network Security-Overview 1222
59 Lecture 59 : Network Security-II 1245
60 Lecture 60 : Network Security-III[TCP?IPSecurity] 1272
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 01
Introduction

Hello. So, welcome to this course on Computer Networks and Internet Protocols. So, this
course we’ll be taking, I will be taking jointly with Dr. Sandip Chakraborty of Computer
Science and Engineering of, of IIT Kharagpur. So, as the name suggest, we will be
primarily looking around all sorts of aspects encompassing Computer Network and
Internet Protocols, right.

So, though all of us are somewhat means rather, everybody is accustomed with using
computer network in some form or other and it has become a part and parcel of our life,
right, anywhere any disruption in the computer network is as a disruption of power or
water supply like that, right everything moves around the networks. And with the more
E-enabled services like starting from banking to E-marketing to any aspects we talk
about is so, these networks become all-pervasive and we need to look into this, means
working principles of the network.

So, this course primarily aims at looking into that backbone or background or the, what
the, what activities go out the back of the network which helps us in having a, this whole
inter-networks, right.

1
(Refer Slide Time: 01:50)

So, if we try to look at that objective of this course, so, we try to understand how two
computers in a network talks to each other, right like, if I say if I type “www” or if you
type “www iitkgp ac dot in”, so, what are the activities goes on at the background that
the page get displayed, right. Or if I do a, if I send a mail, what it goes on type of things,
right, we need to understand.

Go through the, we like to go through the basic functionalities of the computer networks,
what are the various component.

Learn about how to write my own application programs or own programs in a network
and also try to look at the other aspects, like what is, what is in future, what we are
looking for, given our different aspects of, with our needs and different proliferation of
several network enabled applications. So, what type of designs or what are the things
what we need to look at. So what sorts the, what in other sense, what is the future of this
computer network, we set to open up.

This also may help you, in some of you who are looking for some of the research
activities around this, may help you in finding out some research directions.

So, so what we look at, we have a, in a broadly, we have a set of functionalities one side
and set of protocols, right. We will discuss about both of them in details in the

2
subsequent lectures. But protocols, what do you mean by protocols? That’s a, in very flat
terms or layman terms, it is a set of rules which allows me to execute something, right.

So, if I want to do something, so this is the protocol I want to follow. So, network also
have a set of protocols. And using this protocol, I want to achieve some functionalities,
right, like I want to transfer a file given my underlying network. I want to, this, this
particular lecture is broad-casted or multi-casted across different sender using these
underlying networks, right.

So, there are functionalities I want to achieve from this network, right. The network as
such the architecture of the network should be supportive for the things, right. Though
there are general, general architecture backbone, I may look into some specialized thing
when I do some - (Refer Time: 04:31) like multimedia transmission may have little bit
different requirement from say general texting machine or email services or internet
services, right. Anyway, we will, we will be looking at those different aspects when we
go through the course. And in between to, what this tie up these functionalities and these
protocols is basically the network architecture. This is a very very broad view of the
things. We want to look into deep into the aspects.

(Refer Slide Time: 05:01)

Now, so obviously, comes that what is this network architecture?

3
So, a way to visualize, how two remote computers talk to each other, right. So, it is gives
me a way to visualize that how that underlying things will be there. I require some sort of
a protocol stack to handle that, right. So, even if I look at our, even not in case of the
network, forget about the network, if I want to communicate with somebody else at the
other things or some other party, I need to follow some, I need to follow some set of
protocols. When I, when I am delivering lectures I am following some protocols and type
of things and there is a way of looking at it, right.

So, these protocols or the network protocol stack and having a underlying technology of
the things provides me a way to communicate between two any systems - whether it is in
my same network or whether it is in the different network, right. One may be here IIT
Kharagpur; one may be somewhere else in the world.

(Refer Slide Time: 06:14)

So, so, our basic objective is that two systems talking to each other, right, these two
systems can be wired connections, directly connections, we will see that whether it is
possible or not and where these two systems can be somewhere at the different things.
So, the basic vanilla thing is that I have two systems and somewhere I, I connect a wire
between these two network interfaces, like there may be some, some way of connecting
them and then these two systems talks to each other, right. This can be two direct
systems.

4
(Refer Slide Time: 06:49)

Or so, what we have for these, we require a need to convert this digital data to analog
signal and vice versa, right.

So, when we connect by a wire, this is a physical connection, right. This is physically
connected between the two systems. So, what I require? I require a physical wire and as
the signal transmitted by the typical wire, say, say even if you consider our, previously
we used to communicate through telephone lines and type of things or still we do in
some cases.

So, what is there, it basically converts this digital data of these generated by these
computer systems to analog signal which is carried out by this wire, at the other end it is
reconverted to digital data and placed it to the systems. So, I have two applications at
two systems. They are generating some data. Underlying network interface converting
that to the analog signal, being carried out things etcetera. This basic communication
path which allows things to communicate is the physical layer.

So, whatever may be the way of protocol etcetera followed at the high levels, I need to
have some physical connection. It can be wired, it can be wireless, right, it can be cable,
it can be fiber, it can be normal, it can be Bluetooth, it can be Wi-Fi etcetera, but I require
a physical connection, right. There should be a connectivity which carries the signal from
one part to another, right.

5
(Refer Slide Time: 08:27)

And then, if I have more than one, like only not two party, more than more than two
parties are communicating with each other, like three systems are there, then I cannot
connect this wire like this.

So, I require a somewhere, concentrator, right or somewhat we say in our terms, a


concept of hub or switch in between, where it has a multi-port things, I can connect to
the things and then I communicate with the other three systems, can communicate. The
property of this device is allows it to communicate to one other.

So, one way of looking then, is that they when everyone talking to other, there is a there
is a collision between the things. So, what we say they are in the same collision domain,
right. They can - they are in the same collision domain in the same physical network and
or they one communicating others can listen, or everybody can listen. So, they are in the
same broadcast domain.

So, this sort of things at a vanilla things what we say that, there is a say I can think there
is a concentrator of these wires, where we - where the wires basically terminates and
allows to communicate to each other, right. So, another property usually these type of
devices has, is that they are more, they acts as an amplifier. So, if there is a degradation
of the signal, they act as a amplifier. Sometimes, we call that at the physical layer they
are hub or repeater. So, they repeats, they basically energize the signal, right.

6
So, this physical layer, here the requirement is, ensure proper scheduling in the media
access, right. Now, the underlying media say like A communicates, A communicates with
B, B communicates with C, A communicates with C. And so, there will be some
collision. So, there should be some media access protocol need to be scheduled or need
to be ensured that how this access will be there, otherwise what will happen there should
be lot of retransmission.

So, if at the physical layer, if all things are connected at the first layer, then we have lot
of retransmission. Whenever we retransmit, we lose bandwidth. Right, like 4 person
talking or 3 person talking to each other and everybody wants to talk, nobody is waiting
for others to the thing. So, there will be lot of collision. If there are collision, then say I
am one of the party, I need to again tell my own story, whatever I have told. So that
means, there is a retransmission and in doing so, what I am doing, I am losing that, I am
taking more time - that overall communication things is more time or in other sense, it is
losing bandwidth of a communication it is becoming inefficient, nevertheless we can
communicate, right.

Now, the next type of things what we have a layer 2 switch, what we say where these
communication are at a, what we say data link layer, right, where these collision domains
are divided. So, they, though they listen to the same broadcast, but collisions are reduced.
So, effectively, we increase the available bandwidth of the things. So, this layer 2 activity
allows us to have a better bandwidth realization of the things. So, initially we are having
a physical layer or layer one type of devices. Now, we are having layer 2 type of devices.
So, it I can that that is, that communication between A to B, B to C, C to D or D to E
etcetera are not colliding. So the retransmission is less and effectively we are getting
much more bandwidth, what we say in network terms, they are in different collision
domain, but still in the same broadcast domain. Listen to, they are in the same broadcast
domain, but they are in the different collision domain.

7
(Refer Slide Time: 12:40)

Now, it may so happen that I have number of things, like consider your office or
university institute type of things. So there are several departments. Every departments
has several labs, class room etcetera a different labs, etcetera which are having different
set of computers and we require, so, there are, there are huge, huge number of systems
come into play and as such there may be two groups who are talking, right. But they are
talking among themselves, they are talking among themselves, but as such, there is, they
are not, this group is not talking with each other. In other sense, their conversation being
heard by them or their conversation being heard by this group will create a collision or
network congestion, right and it may lead to again, bandwidth loss.

So, I need to so, if you look at a data link layer, so we could have avoided that collision
domain. But even we listen to each other, right. So, they are in the same broadcast
domain, right. So, though we could handle this collision, but they are in the same
broadcast domain, right.

8
(Refer Slide Time: 14:10)

So, in order to handle this, so we need to find out a suitable way to forward this data
from one to another, right and they are what we require a network layer. I, let us think of
another case, like here in a class room I am, we are discussing about the network,
computer network, internet, internet protocols. In the next class room, there may be
something going on, say something on a class on economy. So, economics or a class on
say chemical bonding, right. So, had it been a one class, say two parallel system in a
large class. So, they are in the same broadcast domain. So, my broadcast is heard there,
but now if it is a different physically card, so, my broadcast is not going to their other
things, right. In order to communicate now from here to here what I require, I require
another way to go there. I have to go out from this particular gate or room, catch hold of
some person, if somebody is there, then tell that I need this communicated to be
communicated to this. I require a pen from the other class room right. I need to
communicate something, right.

So, I require so, this not only the collision domains are divided, there the broadcast
domains are divided. So, I in networks terms, we say these are two different networks. In
order to connect these two networks, I require a network level device which will allow
me to connect, right. So, what we say this is a layer three or the network layer type of
things, where routing is possible. So, one network is routed to the things and rather
finding a suitable path to forward a data from one network to another, right.

9
So, we require a level 3 or network layer, right or mostly they are known as layer 3
switches or routers. So, whenever we have different networks like in this case if you see
this is a network this forms a network, this forms a network, in order to communicate I
require a, L3 switch or routers. So, that routers can communicate this. In this case, then
the picture it shows that two port that can be multi-port, typically routers are 4 port
routers and type of things. So, there can be other networks connected from other ports
etcetera. So, they can communicate with each other, right.

So, this is this way, I have a network layer type of things. So, what I, what we try to see
that initially, from the physically we can connect, right; two things, they are in the same
collision domains etcetera in order to improve that situation, we have a data link layer or
layer 2 type of switches where, this, though they are in the same broadcast, collisions are
divided, now we divide both the things. So, they are separate networks in order to, in
order to connect them, we require a layer 3 switch or a router.

(Refer Slide Time: 17:15)

So, sorry, so if we try to see, so, there are different networks communicating to each
other and there are some inter-between links, right or what we say data links or this like
the road networks, these are high speed connected links or gateway or data paths
between the things. So, I have different networks across the world and they are
connected with different type of mechanisms and these routers across this world layer 3

10
or layer 3 plus switches distributed over the network allows these things to communicate
with communicate anything to the anything.

So, within the network, there are devices, right, there are several computers. So, one
computer here wants to communicate to here, it needs to find the path; either this path or
this path or this path. There may be multiple paths like in case of our road network. So,
different cities, different regions are connected by these road networks. You can have
multiple paths and you chose a optimum path, right, based on your requirement, right.
Here also, if the particular path is chosen based on the, based on the overall traffic flow
management and other type of things, right. And if there is a interruption or, if there is a
some congestion in the path, so, there some other paths can be chosen etcetera. So, there
are multiple paths and so and so forth. Rather, if you like to see that they are all
somewhat independent things, they are, there is this particular network at 4 or network at
2, 1 they do not, they do not control each other, right. So, they are distributed network
autonomous systems or autonomous networks and still it can communicate because they
follow a underlying protocol and there is a different network architecture for that. So, I
can, I can say this is the way I architect the internet, right or I architect my network.

So, it can be at a small scale, right. It is in a department, how you things make the
networking things, it can be at a institute scale, it can be as a region scale, it can be
country it can be over internet, right.

So, the core things which binds them is that agreed upon protocols, right. How they
communicate is the agreed upon protocols and there should be a network architecture
which may vary from installation to installation, and even within a installation, we can
have different type of reverse of the things, but nevertheless they allowed you, they
follow that standard protocols, right.

We see, we have seen this in our telecoms scenarios also, then we can communicate to
anything to anything because they follow from protocol. Anyway these days, segregating
data, voice and other things are slowly becoming, they are becoming converged networks
and type of things they follow is becoming more, what we say consolidated so to provide
a better service.

11
(Refer Slide Time: 20:50)

So, what we see that with this 3 layer, we try to have a end-to-end some network
connectivity or some sort of a traffic control in the network, right. So, there should be
some physical connection, there should be some data link for hub to hub connection, and
there should be a network layer to have a network to network connection, right. Over and
above, we require a layer called transport, right or mostly what we say it is a process to
process connection and it has lot of property: error control, traffic management, traffic
control and different other properties.

So, it is above the network layer, right. So, it gives a process to process communication.
So, one is physical connectivity, one is hub to hub connectivity, one is network to
network, even to system to system connectivity, but there can be multiple process in the
system, process to process communication is handled by this transport layer type of
things, right.

So, we see that this different type of layers gradually will be dealing all of them in this
particular course. We will be going details into the things, but we try to have a overview
that these are the stacking of the layers which are there in our realization of a, any
computer network or inter-networking or what you say data communication, the
whatever way you try to put it. Whenever there is a, there is a movement of a some data
from one node to another node from another place, I require this type of things will be
there.

12
But you see, I may not require always all the things, right. If I am, my data is only
transmitted in between and to the other point, like in between router, may not want to
open up to the transport layer, right. If there is a hub to hub connection, the data link
layer may not require that needs to be open up to the, this up to the data link layer so, not
even the network layer is not required.

So, sorry, intermediate devices can act up to the level which connect and carry, right.

(Refer Slide Time: 23:10)

So, finally, what we looking for, end user is the application, right. So, end of the day I am
looking for, if I am a having a mail application, I am looking for the mail application,
that in turn uses some transport layer that, in turns uses some network layer; in turn data
link and physical - all stack is there, but the at the top it is the application layer. This is
the, this is the typical protocol stack popularly referred at TCP/IP protocol stack which
are, which is the predominant protocol across this over all, over inter network, right.

So, this stack is the what we will try to look into the things, right, into one by one into
the all the aspects of this particular protocol stack in this particular course.

13
(Refer Slide Time: 24:03)

So, what we try to do now, the if there is a source and the destination of somewhere in
the network, then somewhere other a path should be established between the source and
destination, and the communication should go on into the these paths, right. So, there can
be, we will see that what are the subsequently the nitty gritty of these having these paths
to the things, but nevertheless I require a path to communicate from the source to
destination, right and this, overall different layer of structure. So, at the source and
destination, what the things are going on? These are basically applications what the user
is using primarily, right like I say “www iit kgp ac dot in”. So, what I am doing? I am
opening up a browser it can be a say, some some browser like this Firefox or Chrome or
Internet explorer explorer and then that’s a client thing and at the other end somewhere,
the server is there, iit kgp server is there. So, it hits through the things.

So, the applications things are going on, but it is taking it is using this intermediate layer
to communicate, right. That will, we will look into these aspects.

14
(Refer Slide Time: 25:21)

So, what we will see, if we look at from this picture to this picture. So, it is a this is a
application stack where this is the whole protocol stack down there, to application is
talking to the application, it is reduced to the transport, network, data link, physical, then
it go on, in the in between there is a layer 2 switch. If there is layer 2 switch, it can open
the packet up to the data link layer, right. Rest of the things is a payload for the data link
layer, then it goes this some routing device and it have a up to the network layer.

So, it network layer means, it can see this by which network it transmits and find out the
path. Then it can go to another layer 2 switch and finally, hits to this server or means to
other party A and B, right. And similarly, one packet moves from here to here, other
packet moves from here to here and things goes on into in the communication the
communication, but the intermediate devices can open the packets up to the things which
is which it can handle, right, rest is a payload for the things, right. Had it been there is a
hub, so it could have opened only up to the physical layer, rest are is a payload of the
things.

So, you see though these devices can be from different sources etcetera, that we can still
handle a communication between source and destination, right.

15
(Refer Slide Time: 26:52)

So, protocols at different layers if we try to see or what we are looking at, is more
popular protocols at different layer; if we look at the application layer, the popular
protocol is HTTP for what by which we access web pages etcetera that is the
predominant protocol, there are protocol for FTP: file transfer protocol and there is a
predominant protocol for SMTP: simple mail transfer protocol, right.

So, there are TCP, UDP, RTP and these are the predominant protocol in the transport
layer, right. We will see that some are connection-oriented, some are connectionless,
some are real time protocol and so and so forth. Similarly, at network layer we have IP,
they what say we call it also IP layer different protocol like IPV4, IPV6, MPLS and so
and so forth. Similarly, data link layer Ethernet, Wi-Fi, Bluetooth, UTMS, UMTS and
LTE type of things different set of protocols. Major predominant protocol definitely is
Ethernet and Wi-Fi, but we have other protocols to communicate. At physical layer is
more of the physical connectivity is mostly the physical characteristics of the things,
whether it is wired, wireless, if it is wired what set of wiring and type of things.

So, there are standards for, there are well defined standard for their communications or
what we say signal and data communications that which are used by the things, right.

So, if you, there are some of the, what we say protocols or which are, which we do not,
we cannot place in a particular layer rather like if you talk about DNS, it is somewhere
between application and transport; SNMP, this is between transport and network; ARP,

16
DHCP, these are again in between. They’re some in some reference they are considered
at in say network layer ARP and so on and forth.

But nevertheless, they use the cross layer phenomena. So, these are what we say, cross
layer protocols, they connect between two layers, right.

(Refer Slide Time: 29:13)

So, what if you want to look at computer network, there can be two way of looking at it
like if I want to study things, one is going from physical, data link, transport, application
etcetera, other is going on the, from the top to bottom. So, one is bottom-up approach or
is the top-down approach. So, both are fine, both are accepted and type of things. In this
particular course, we will be taking this top-down approach, we will start from
application, transport, network and goes to the physical layer type of things. So, we will
be going in this means bottom means, top-down approach, right. From the top we will
start and then go on the down, right.

17
(Refer Slide Time: 29:29)

So, we will come to this history of networks subsequently, I will just give you some

(Refer Slide Time: 30:07)

references which will be good for you to refer. Like one book is by Kurose and Ross,
Computer Network.

18
(Refer Slide Time: 30:16)

There are, this is primarily having the way we will follow that is top-down. There are
bottom-up they primarily follow this bottom-up, but nevertheless it really hardly matters
that which book you refer.

Computer Networks, so, this is with Tanenbaum and the computer networks, there is a
system approach by Peterson.

(Refer Slide Time: 30:40)

19
And there are different sources; one good source is IBM Redbook, there is a nice
reference which is on the internet. Again you can refer TCP/IP guide, this is also
available online. So, this will be some of the books.

(Refer Slide Time: 30:55)

And there are several internet sources like one is IETF is one of the major source, there
are RFCS related to this network protocol requests for comments.

So, it will be nice to look at those sites like Internet Engineering Task Force. I think it is
from 1986 or so, it has been established and there are several resources which give you
gives you a things that how this protocols are developed, what new things are coming up
and so and so forth. So, with this, let us compute our this first introductory lecture. We
will be continuing with the subsequent lectures on those on the on this internet and
internet technology.

Thank you.

20
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian institute of Technology, Kharagpur

Lecture – 02
Protocol Stacks – OSI and TCP/IP

Hello so, we will continue our discussion on Computer Networks and Internet Protocol.
So, today will be discussing on in this lecture Protocol Stack or a overview of the
protocol stack OSI and TCP/IP; this two protocol stack. Though we’ll be primarily
following the TCP/IP, but just we’ll have a overview of the OSI. So before going into
this protocol stack, that overview of the protocol stacks, what we’ll try to look at, that a
quick, we’ll look at a quick, quickly look at the history of this Internet or inter-
networking; how it evolved over years type of things right.

(Refer Slide Time: 01:02)

So, if you go to there are two interesting site one is a in a YouTube and also in another
site where you get lot of history information, but if we try to correlate from different
sources, if you see if you see that the history how this Internet came into picture.

21
(Refer Slide Time: 01:11)

So, we start from 1836 when the telegraph, first telegraph message was sent and it has
been said that Morse Code, a series of dots and dashes which were used for
communication and somewhat we find analogy with our today’s binary 0 and 1. Then
between somewhere between 58 and 1858 and 66 so, transatlantic there is a part of trans-
atlantic cable.

And if you see today also this huge sub submarine cables primarily forms the major
backbone of the data communication part. And in then came telephone lines which
revolutionized our way of connecting things and if you see that our earlier network
connection, these days also there are connections which piggyback on this primarily use
this telephone line as a physical layer. And then gradually somewhere in mid 1950’s or
1950 around so, U.S. formed that Advanced Research Project Agency or ARPA. So, this
is one of the major state under Department of Defense which was there and there was a,
there was a parallel if means that is not on the network phone, but at the around that time
USSR launched Sputnik. So, some sort of a, there are there are reports that there is a
some counter or some parallel efforts was there.

Now in 1962 this ARPANET was formed which primary aimed at finding a network
which will allow some sort of a resilient and reliable connectivity during very extreme
situations right. So, there is the major thing.

22
(Refer Slide Time: 03:18)

And we see that in around 60’s early 60’s the packet switching network developed. So,
we will discuss about circuit switching and packet switching in our subsequent lectures.
So, it was developed where data is split into small packets which may take different
routes to the destination. So, the it will follow different routes to the destination, but data
is small packets and that the union of all these packets are primarily at the destination or
intermediate things, intermediate devices or product also will to continue.

In 69 ARPANET commissioned by DoD for research, primarily what does research


network where four major US university came into picture, like University of California
at Los Angeles like UCLA that is Stanford Research Institute and then UCSB and
University of Utah. So, this is the major four things came into play and it what we see it,
it gets a open research motivation other things right. So, long it is under the department
of defense, it is more of a what we say secured type of things, but here its gets a more
university flavor where the number of research efforts were came into play right. And
then what we see in 71 that first email program was transmitted, it seems that the first
program was the first row of the alphabet in the typical QWERTY keyboard and with 15
nodes or with 35, 23 hosts on ARPANET.

Then in 73 global networking became some sort of reality connecting in England and
Norway. So, it is some sort of across country or across continent.

23
In 74 this packets become more mode of switching that there is evolution of transmission
control protocol and other things came into play right.

(Refer Slide Time: 05:38)

And 77, what we see that number of email hosts become email is really reality, there
were host where 100 plus host were communicating and there was a steep increase after
that on overall efforts, 79 news groups were formed, 82 TCP/IP protocol was proposed
for ARPANET. Then there is a major development in 83 when name servers are
developed like it is it was becoming difficult to remember the IP in numbers and etcetera,
so name servers developed. In 84 DNS came into play; number of host crosses 1000, by
87 it crossed 30000.

24
(Refer Slide Time: 06:27)

Then we see gradual increase - 89, primary this, our omnipresent dub dub dub or
“WWW” concept was coined by Tim Berners-Lee. So, in 90 what we see in first search
engine what was proposed and number of host was 3 lakh plus, around 1,000
newsgroups and at the same time ARPANET was cease to exist officially or it where it
went to a distributed development mode and there is no practically that what we say
existence of ARPANET was not there. In 91 developed user-friendly interface for
Internet primarily Gopher, some of you might have heard about it released by was
released, and text-based, menu-driven interface axis of Internet resources was possible
through Gopher.

Then 92 was a more multimedia came into much into play and so called quote on quote
“Surfing the net” was term was coined. 93 onwards truly this WWW revolution begins.
Number of host cross millions and Mosaic web browser are launched right. So, then
onwards what we have seen as a phenomenal growth with different type of applications,
different type of content and so and so forth.

(Refer Slide Time: 08:01)

25
(Refer Slide Time: 08:07)

And if we look at some of the things, like if we look at that is web explosion; say 84, 94
it was around 3.2 this are from different Internet resources. So, means I do not claim that
all are pretty or authentic to the last bit of the number, but it shows that how things grows
in a big way. In 95 it was 6.4 million, 97 - 19.5 to in 2001 it is 110 million hosts over 30
million websites and so on and so forth and this expansion continues right. It is a
exponential or expansive.

26
(Refer Slide Time: 08:49)

Also there are some other things like 94 Hotmail came into picture, W3C was founded in
1994. 95 - JAVA source code was released and what we see that there are other stars ICQ
or ICQ type of application in 96 by Israel and then 1998 Google was founded. So, these
are some of the milestone we shows that that not only that growth of the things, the
overall interest of the human community at large to us the to us, the Internet this inter-
networking.

So, we just try to come back where we started from. So, this is a brief after this very brief
history that how things are there; what we see now it’s a huge volume of applications
right or huge huge volume of applications on the net. The some of the applications if you
see they are pretty sensitive on error, some of the applications are pretty sensitive on
time, some needs more data to be handled, some needs more accuracy and type of things,
and this application form anything and everything feasible for our from day to day life to
scientific application and so and so forth right. Rather what you what we see for this
typically for last one decade or so, with the different service, services or internet bit
services being enabled or whole scenario or information system design is moving
towards is a moves towards a what we say service-oriented architecture, this network
became a major thing to be considered. With cloud, high performance computing coming
into play, see this overall backbone network plays important role.

27
This any interruption of the network will make the not only make us difficult to
communicate, but several industry several industrial processes will come into a standstill.
So, it becomes a extremely, it is extremely important to have this network in place.

So, as I was mentioning in our earlier lecture earlier lecture, that we like to see that that
what are the basic protocols, what are the basic processes, methodology, algorithms at
the behind this overall networking right. That is one of our, that is a our major goal of the
things.

Now if we just again recap from our earlier talk like we primarily have protocols stack
right, we discussed about this, we’ll again little bit re-look on the whole thing. So, there
is a physical layer, data link layer, network layer, transport layer, application layer, right
and it is not necessarily all devices should manifest all the layers right, that also we have
seen right.

So, in other sense the application layer at the top is basically the applications what we are
working with. So, the application layer is the output of the so-called application layer is
piggyback or became a payload of the transport layer. The output of the transport layer or
will become a payload for the network layer and subsequently payload for the data link
and then it is the physical layer and the physical layer takes care about the physical
communication between two nodes, right, between the two nodes like. So, it can be
somewhere wired, wireless and different type of technologies coming into play. So, that
is, that is the basic bottom line of the things.

And if you look that different type of services then, the popular services; so to say HTTP,
FTP and SMTP are the very popular services at the application layer, not only that if you
look at our these days several web services, these basically piggyback on this sort of
services. So, it is above application layer right. So, they use application layer like HTTP
protocol is being used to carry some sets of messages or type of things right.

Similarly at the transport level we have TCP, UDP, RTP. Some are connection-oriented,
connectionless, real time protocols.

Then at the network layer we have different protocols like IPv4, IPv6, MPLS; these are
the very prominent protocols. Data link layer, Ethernet is one of the major protocol Wi-
Fi, Bluetooth, UMTS and LTE and other protocols which are there and a physical layer is

28
basically the physical connectivity and it goes on the communication system processes
and methodology and technologies. There are some of the protocols as we discussed like
DNS, Domain Name System or SNMP for management protocol or ARP and DHCP for
some of the address resolution protocols. So, these are the protocols which are somewhat
cross-layer protocol right. They exist between two layers. So, they basically interfaces
between the two layers right.

So, will discuss these things in details in the subsequent lectures or some subsequent
talks, but this is our all-encompassing things. So, we will be mostly hovering around the
TCP; primarily looking out at these major protocols and of course, opening of that what
are the other protocols and other things etcetera.

(Refer Slide Time: 14:53)

Now, if I as we are discussing about protocols; so what is the meaning of protocol right,
what do you mean by when it is protocol? It maybe for networking or any other aspects
also we say that the protocol to be maintained etcetera. So, protocol is a controlled
sequence of messages that is exchange between the two or more system to accomplish a
given task right. So, when I say that I do FTP communication, I do a SSH
communication, I do a HTTP or a DNS system resolution, DHCP, so, I do a control set of
messages right so, that where between two party or multiparty to accomplish given task
right; so, some maybe downloading some documents or some maybe resolving some
network configuration IP address and so and so forth.

29
Protocols specifications define this sequence together with the format or layout of the
message that are exchanged right. So, the one is that protocol is a set of messages to be
exchanged and there is a protocol specification that the what message, what is the
specification, how many, what is the size, what are the different fields of the message
those are precisely defined. So, define this sequence define this sequence together with a
format or layout of the message that are exchanged. So, that the other party on receiving
the message can basically decipher based on the specification of the message. Like I say
if I send a particular a DHCP packet, the DHCP receiver can basically open the packet
and it knows that these are the way it is sequenced. Similarly for any other protocol. So,
that that makes this, what we say inter-operate between variety of things like if I say that
I am following so and so protocol, then I am done with the things that other things. So, I
say I am following IEEE so and so protocol and then the other end basically only
understand the specification no need of any understanding separately knowing that what
is the format etcetera that is that that the that exactly tries to do.

So, this so, whole any this sort of distributed, loosely-coupled and autonomous systems
or autonomous systems and services when they communicate, this protocols played a
primary, a very important role.

So, in this, basically in this course we try to look at, look whole thing in terms of
different inter-networking protocol which makes it possible to communicate between any
two devices over the network.

30
(Refer Slide Time: 17:46)

Now, one of the very measure effort was made to define the protocols in a bigger, in a
more specific way, that is the what we say OSI model of model layers of the networking.
Unlike our TCP/IP things were which is a five-layer stack in some cases; there are they
considered as a full layer stack will come to that, but nevertheless it is a five-layer stack,
OSI is typically seven layer stack right.

So, it is it has physical, data link, network, transport, session and presentation additional
things what we see here and the application. In the TCP/IP also this things are there, but
they are merged with the other layers right.

So, physical is primarily as we were discussing, transmission of binary data on a over a


media right; so, this is a thing. So, when I get say digital or binary data which is carried
over the media.

Data link is a transfer of units of information, framing and error checking. So, this is the
data link layer consideration, primarily one of the functions which it does.

Network layer primarily involved for delivery of packets of information which includes
routing right, rather what will see that network layer it is what we say it is not a reliable
layer. So, it’s a, it delivers packet in a unreliable way means that reliability is not
guaranteed.

31
Whereas transport is a provision of end-to-end reliable and unreliable delivery both right.
So, though transport layer sits over network layer, it has the protocols supports to for a
for giving a provision for end-to-end reliable service or in case of unreliable services
right.

Session establishes and maintains a session, so this is a session layer which establishes
and maintenance session.

Presentation is data formatting and encryption if any, so that it takes care.

Application is network applications are just file transfer, terminal emulation and so and
so fort, so all type of application at the application layer. So, these are the primarily this
seven OSI, Open System Interconnection model for networking which takes care of
every part of the things.

So, every network device will have all or some of this layers right. It is not necessary that
all will be enabled like as you are talking that (Refer Time: 20:40) a layer 2 switch is up
to, enabled up to layer 2, a layer 3 switch is up to layer 3 and so and so forth, so that
means, it is it is it can have one or more layers or all the layers in some cases. So that
means, it allows it to the things.

As we are discussing, just discussing that packet of the application is piggyback is


become a payload to the presentation which in terms become a payload to the session
and so and so forth. Finally, carried over the physical layer to the other end.

32
(Refer Slide Time: 21:12)

So, TCP/IP on the other end is one of the very prominent protocol which is being started
long back and being used or being followed in different, in different type of network
enabled devices. So, it’s a suite of - it’s a suite of protocols that become the dominant
standard for inter-networking right. TCP/IP presents a set of public standards that specify
how packets of information are exchanged between the computer of one or more
networks right. It is not only confining the one network, it can be between any two
system in between any two network.

(Refer Slide Time: 21:57)

33
So, if we try to compare these TCP/IP, so somewhere we try to match like this, like
physical, data link, networking etcetera whereas, transport of the TCP/IP takes a little bit
of the part of the session and the transport where as the application takes care
presentation and the application and maybe little bit of the session layer. So, this is it is it
is not like that something is left out or something new is there, but TCP/IP is somewhere
in between.

(Refer Slide Time: 22:29)

And if we look at the different type of protocols which are supported by different layer of
TCP/IP, are variety of protocol, these are some of the what we say standard or well-used
protocols, there can be other protocols at so and so forth, like data link layer that can be
fiber optics, it can be UTP, Coax, microwave, satellite, STP and type of different type of
links layer whereas data link layer there are there can be different other things like
Ethernet which or (Refer Time: 23:01) IEEE 802.3 standard or X.25 token ring frame
relay and different sort of protocols.

In networking, with TCP/IP the networking is over IP. So, it can be IPv4 or these days
IPv6 transport TCP, UDP, ICMP and this sort of protocol whereas application has a big
bunch of protocols right, it can be variety of protocols. There are issues of which are
intermediate protocols where which are between the different cross layer protocols
etcetera, but that is some view so of this TCP/IP stack.

34
(Refer Slide Time: 23:51)

Similarly, if you try to look at some other way of looking at it like this is other way of as
mentioning that some places it is considered as a four layer stack instead of data link and
physical TCP/IP considered as single layer stack.

(Refer Slide Time: 24:08)

So, as we are mentioning that use at data at the top is becomes a payload for this next
layer right and with the application header etc it is it becomes a application data which is
a payload for the next layer, which becomes a payload for the which in turn the whole
thing become a payload for the next layer and so and so forth. Like at the physical layer,

35
physical level, this whole data is transmitted through the underlying physical channel
right.

So, we will try to see that different protocol structure and what it sizes, including its
payload wherever this it is applicable right in this particular lecture.

So, why different type of things what we are looking at because in different books
different Internet resources you will say that different representation. So, I thought that I
will try to get will put some of the things; so, that we should not get much confused with
the things.

(Refer Slide Time: 25:14)

Now let us see, consider a typical local area network right. What are will be the typical
component? There are clients, there are servers right. So, client - servers are serving for
some application or something, like there is a FTP server, FTP client; HTTP server or
sometimes we say HTTP daemon and HTTP client, like what we use on the browser at
my end is HTTP server, if I accessing “iitkgp ac dot in”, so, it is a HTTP server is there
from, I am a HTTP client, my browser is HTTP client.

And if you look at the network devices, there are several devices repeaters, hubs,
transceivers, NICs, bridge, switches, routers; these are the different type of devices we
have to see, which are at different layers like repeaters and hubs primarily at the layer 1
whereas, whereas NIC, bridges, layer 2 switches are layer 2 and routers and so forth.

36
(Refer Slide Time: 26:13)

So, if I and there are, there is a concept of Local Area Network, Wide Area Network we
like to see look at it. So, a WAN is a data communication networking covering a large
geographic span. Unlike LAN, a WAN connection is generally rented from a service
provider, so when you go for a WAN connection, it is from the service provider. WANs
connects various sites at different geographic locations so that information can be
exchanged.

So, what? So, there is a concept of WAN and LAN primarily that way of handling will be
different, but nevertheless the devices, etcetera or the way the protocols works remains
same.

37
(Refer Slide Time: 26:50)

(Refer Slide Time: 26:58)

Now, if we see that so it is a layer 1, layer 2, layer 3 and type of devices. So, let us see
that what so, NIC typically the network interface card which what we are having in our
all systems laptop, PC etcetera are basically having as a layer 2 device. So, it is having
MAC address or sometimes call hardware address which is with that interface card right.

So, it is a unique address, so called unique address which is given by the, from the (Refer
Time: 27:27) OEM or the manufacturer right. There you may argue there are way to
spoof etcetera that we are not going to those business, but we consider that MAC address

38
is a unique address given by the hardware address given by the things, we’ll come to
those things.

(Refer Slide Time: 27:41)

So, if I have two computers with NIC cards, the first LAN how to connect? Just connect
to end of either cable; only thing that should be a crossover cable; that means, the
transmitter or TX of one should go to the RX and RX of the other should go to that TX.
So, it is a crossover cable or what sometimes what we say cross cables right.

(Refer Slide Time: 28:06)

39
(Refer Slide Time: 28:13)

So, if it is typically can connect 100 meters things at a that maximum things it maybe
little less than that and if I have to go more than that, I require a some repeater or which
amplifies the signal right.

(Refer Slide Time: 28:24)

(Refer Slide Time: 28:29)

40
And if I want to connect more than two things, then I require a multi-port repeater or
popularly we called as a hub. These are all layer one devices. So, it is only amplifying
the signals and type of things right.

(Refer Slide Time: 28:41)

(Refer Slide Time: 28:44)

41
(Refer Slide Time: 28:52)

And if the business expands and I have cascade of things right; so, one repeater, another
hub, again hub and go on expanding. So, what it happened that the problem is, that the
hubs share bandwidth between all attached devices like typically if it’s a, if it is a say, 10
Mbps hub with 8 ports. So, effective bandwidth is 10/8 right. So, it is what we say that
worst case scenario will come like that. So, hubs are layer 1 devices, cannot filter traffic.
Most LANs use broadcast topology. So, every device sees everyone and is like if there is
a communication is there, so it is everywhere the things are there. So, there are lot of
collisions and there are lot of things. Though only 1 is sending to 2 only 2 should
expand, but all will getting the collision things.

42
(Refer Slide Time: 29:36)

So, the solution is whether we can have a smarter hub or bridge. So, bridge filter traffic
based on the MAC address; that means, as every NIC have a unique MAC address or
every system has a unique MAC address, so, they filter traffic based on the MAC
address. So, how it looks like?

(Refer Slide Time: 29:52)

(Refer Slide Time: 29:53)

43
(Refer Slide Time: 29:56)

(Refer Slide Time: 30:01)

44
(Refer Slide Time: 30:03)

So, if I send a instead that bridges, then the traffic are localized right, so localized. So, it
the traffic will not cross these things so that the other parts are bandwidth are not wasted.
So, if it is, if there is a multi-port bridge, we primary we say that is a switch or more
precisely is a layer 2 switch. So, there can be layer 2 switch where it connects etcetera it
can have a connection to the cloud. In this case the cloud is Internet cloud what we mean
and that is a I can have we can have this sort of connectivity with the cloud right.

45
(Refer Slide Time: 30:20)

(Refer Slide Time: 30:35)

So, and then comes the router. If the two networks are different, router filter traffic based
on IP address. The IP address tells the router which LAN segment and segment can ping
the ping belong, in other sense where you can have the things. So, this two networks are
different networks. So, one is machine 1 is one network, the machine 2 is in other
network this router finds the path from this to this. So, in other sense it is not only filters,
the collision it not only divides the collision domain, it also divide the broadcast domains
so, that it is it is only allowed filter the traffic those traffics to the other things.

46
(Refer Slide Time: 31:20)

So, what we look at it? So, there are devices at different level. Typically routers are layer
3, these are layer 2 switches, there are layer 1 devices and also each device works its
layer, but all the things - where router has the property of data link and also physical.

(Refer Slide Time: 31:31)

So, any higher layer as all the properties of the lower layer thing so, if you have a router
it as all the other properties. So that means, it can basically do data link layer filtering
also can communicate and all those things right. So, as that layer 3 device but also uses
MAC layer and so and so forth right.

47
(Refer Slide Time: 31:51)

(Refer Slide Time: 32:01)

So, and typically when we’ll come to those things later on it is a what we look at the
hierarchical design of network where we have a, that core at the things, then distribution
then the access right. So, the core is very fast, then the distribution is more of policy and
the access is the end mile type of solution.

48
(Refer Slide Time: 32:07)

Let us say quickly few points and before we conclude. So, routers by default breaks up
broadcast domain. Broadcast domain set of all devices on a network segment that hear all
the broadcasts send to the segment. Breaking up the network broadcast is important
because when the host and the servers sends network broadcast every device on the must
read and process that broadcast right. It may reject or accept based on whether is meant
for that. When a router interface receive the broadcast, it discards the broadcast without
forwarding to the network, routers also breaks up collision domain right.

(Refer Slide Time: 32:59)

49
Switches are not used to create inter-networking so, that is for router. They are employed
to add functionality to the Internet LAN. So, switches breaks up collision domain. It
switches frame from one part to the other part in a switch network so to say that is why
the switch.

So, again collision domain in Internet term used to described a network scenario in
which one particular device sends a packet to the network segment, forcing other devices
in the same segment to pay attention to it. At the same time with different device there
will be collision, loss of data and re-transmission and loss of bandwidth (Refer Time:
33:36) It typically found in layer one or hub. So, each and every port on a switch is own
collision domain collision domain and hub represent one collision domain and so forth.

So, what we try to say that this different layer of the things has different level of
functionalities right. One is basically that different like at the physical layer is more of
the physical transmission of the things, whereas data link layer takes care of the filtering
at the MAC layer level. And also communicate between so that it is filtered and the
collision domain are divided; routers typically layer 3 device connects to, to devices on
the network; more precisely if we see that it helps in inter-networking.

If we go to the transport it connects two processes into machines in the internetwork. So,
that is process to process communication is feasible by this transport and the applications
what we are interested in what the end user is interested in where the end user basically
use this different applications like what we use in inter-networking and type of things
and also we have seen that every layer processes and piggyback - make its payload and
from the things.

So, let us conclude here. We will continue our discussion on the things as we mentioned
that will go on a top-down approach so will go from application to transport and so and
so forth okay. So, we will let us stop here.

Thank you.

50
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 03
Circuit Switching and Packet Switching

Hello. So, we will be discussing on the course on Computer Networks and Internet
Protocol. So, today we’ll be discussing on the topic of Circuit Switching and Packet
Switching, right. So, what we see when we look at a any network or any communication
network it is a switch network. That means, if I have two nodes connected directly or two
station, if we consider the station, that source station and destination directly connected
then they can communicate to each other directly. But however, if they are in the some
other network then what I require? I need require to switch between different devices
right, network-enabled devices.

It is true for our telecom connection also, when you are calling somebody it is some
other exchange, then there should be some sort of a switching between these exchange.
So, it will be first the first the phone my phone is directly connected to my home
exchange, then there can be other trunk connection and go and so on so forth, it go on
switching to the so long to the end, right. Similarly, for data network also, when we look
at when two station, source and destinations are apart then there they are equal number
multiple hop which are being switched, right.

So, what we try to look at is the preliminary of what are the switching technique,
irrespective of what sort of network is there. It can be added a network, it can be a
telecom network and type of things. So, what sort of switching techniques are there? So,
that is our goal and will try to look more deep into the thing, when we actually see when
we discuss about the protocols, right.

51
(Refer Slide Time: 02:05)

So, what we are discussing about is a switch network. So, communication between
distance stations or end devices is typically done over network of switching nodes. So,
the so, intermediate nodes are switching nodes which allows me to switch to the things
or in other words what we say, we find a path between the source and destination, right.
So, from the source to destination we get a path and that is that is that path need to be
established or and the your packets or the data or need to be information need to be
transmitted from the source station to the destination through this switch network.

So, switching nodes do not concerned with the content of the data. The switching nodes
typically not concerned about the data. The purpose is to provide a switching facility or a
path between the source and the destination. So, they are not what data is being carried,
right. Later on we will see that the different data has different type of necessities, right.
So, a collection of node and connections forms a communication network. So, this
collection of nodes and intermediate connections forms network. So, the nodes and the
errors or the connection between the nodes from the communication network that we
already we known.

So, in a switch communication network the data entering the network from the source
station are routed to the destination via being switched from one node to another, right.
So, that is when we natural that if I have two nodes far apart and intermediate set of
connection and nodes, so the data need to be switched or hopped between one node to

52
another. So, couple of things one is that there can be multiple paths, right; there can be
no path, right. I cannot able to switch or there can be a path at times while the
communication is on, there can be one of the node fails or edge fails and there can be
communication problem right. So, what there can be the several issue; so to for this type
of switch network.

Nevertheless, if we keep those challenges and issues little bit apart like will look at those
thing that how still reliability whether it can be attained, if at all what are the
mechanisms, but what we try to see is that how these information or data from the source
station or destination can go from one hop to another.

(Refer Slide Time: 04:45)

Now, typically this is a example of scenario from the switch network I am - you can refer
this data communication by Williams which I am also referring in this case. So, this is a
switch network if you say, right. So, there are there are end systems right end systems,
there are there can be mainframe, server, personal computer and variety of things, there
can be mobile devices and so on so forth. So, if so for them this is a switching cloud
right, or so to say, that some way if I am connected, I will be able to communicate with
the things, right. So, I am not bothered about this or a user is not bothered about this
switching things, but if you look try to look a little deep into things, so there are different
category of switching nodes. So, if a packets come, if I want to communicate from B to
E, so, B is this is the host or the connected switch or the connected node in case of

53
telephone we connect to our nearest telephone exchange and then it decides in order to
go to D which path it should follow, right. It can follow this path, this, this, this, this it
can follow this path, sorry. Or there can be other paths, right this, this, here, here, here
and D right, B to D. So, there can be different path. So, this intermediate switch need to
decide that which path there should be followed or there can be a predefined path. If I
want to go from B to D I need to follow 1 4 5 3 D somebody defined it, right,
nevertheless this route or path need to be decided or need to be established by this switch
network. So, this is the switching network typical switching network thing and there are
the external things which are going.

(Refer Slide Time: 06:51)

Now, there are what are the there are different switching technologies? So, switching
nodes may connect to other nodes or to some station. So, in this case what we mean to
say there are two category of nodes what we say these are switching nodes and these are
some other nodes right, these are stations. So, this is a terminology which are being
followed here, but you in some places you will find that though all are considered as
source node, destination node, it doesn’t matter.

A network is usually partially connected, like it is not that all are all routes are
established. So, that it is the routes will be established on demand and type of things and
however, there can be some redundant connections are desirable for reliability also, right.
So, I can connect that network, like I can have only these path, only this path could I

54
have been there for B to C, but there can be there can be redundant paths so that the
reliability if 5 goes down in this case I could have gone through 1 2 3 D, if 6 4 goes
down also this path can be possible, right. So, there can be reliable path there can be
multiple paths, right.

So, two predominant switching technologies are there: circuit switching, one is packet
switching, right. At as the name suggest or roughly suggest, circuit switching is
establishing a circuit or establishing a connectivity between source and destination this is
the predominant thing; whereas the packets switching says means that individual in the
from the source station data can be divided into different packets which are being
transmitted through this switch network to the destinations. We will try to see that both
the things quickly.

(Refer Slide Time: 08:533)

Now, circuit switching it says that there is a dedicated communication path between two
station. Usually there is a three phase things. So, for circuit switching I should have a
dedicated path from the source station to the destination right. So, how I how a dedicated
path can be established? So, there are how this from communication can be goes on?
There are three phases; first one is a path establishment phase, then next is the transfer of
data or information form the source station to destination and the third one is the
disconnection phase.

55
Or, in other words if you try to see this establishment phase is basically acquire the
resources right, suppose I want to talk to somebody so, I basically some other part of the
world, so, I what I am trying to do is allocating the resources from my starting from my
telephone connection to my nearest exchange and there are different other intermediate
switching nodes so, I am allocating the resources. And interesting and then I can go on
communication it can be bi-direct communication or full-duplex communication and
once the communication is over, then I teardown the connection or disconnect the thing
right, in other sense I release the resources, right.

So, if there are there are possibility of ten connections can be established, if when I am
one is already in the communication path. So, one is blocked one is already occupied
other nine are available. So, there from there are another type of things come up that is
blocking architecture and non-blocking architecture. So, if the connections if the all ten
connections are blocked then we then they are when may not be the eleventh connection
will get a that “no connection available at this point of time” type of things; that means,
it is a blocking things. Unblocking or nonblocking means I have enough resources to
handle, that we’ll look at this.

So, circuit switching must have switching capacity and channel capacity to establish
connection, right. So, it should both have switching capability; that means, capacity; that
means, that number of paths are free and not only that, the data which is being carried by
the channel that should have also the capacity to carry the information or the data. So, it
should have both channel capacity and switching capability to establish connection; must
have enough intelligence to work out routing. So, in some of the cases or many of the
cases it should have a typical intelligence to work out the routing. So, if a B wants come
to connect to D what should be the path intermediate through the switching node, that
need to be find out. So, it can be, there can be some algorithm, routing algorithm, some
way of intelligence which work out the routing, in some cases there can be dedicated
path if B to D this is the path which is there, right. So, there can be dedicated path or
algorithm to look at it.

56
(Refer Slide Time: 12:20)

On the other hand, the packet switching try to say that the station or source station breaks
the message into packets right, typically smaller chunks of packets now packets are now
becomes a independent authority, right. Packets are sent out from the network
sequentially one at a time, right. So, one packet after another it goes on. The stream of
packets are routed through the network and are delivered to the intended destination,
right. So, these packets are pumped into the network and these go on the network and
they are delivered at the destination.

So, there can there are also can two approaches; one is what we say datagram approach
where packets moves on independent things, one packet may follow say route 1, one
packet may follow the route 2 and so on so forth. Nevertheless, there is the destination
and not only that, once this type of situation come you cannot guarantee that they will
may reach sequentially, because the one say path one or the route one may be more
congested then the path 2 so, the delay will be varying and so on so forth. Whereas there
is another approach called virtual circuit approach, where a virtual circuit is established
between the source and destination and the packets moves in that particular path.

So, these are typically in case of a packet switching network.

57
(Refer Slide Time: 13:55)

Now, again we if we come back to this our circuit switching discussion so, there are
predominantly basic four type of thing, type of approaches. One is space division switch,
another is time division switch, another is TDM bus – the time division multiplexing bus
and there can be combination of this type of things, right of these switching things. So,
these are the four predominant stuff.

(Refer Slide Time: 14:40)

So, like a typical circuit switching network is like these that from the like, which is this is
as we know that circuit switching predominantly for that voice type of connectivity. So,

58
the connectivity is like a telephone. If you consider a telephone then it is this first office
or this nearest exchange then a switch to that, if there is a call from this A to destination
B so, it goes on different switching circuit, circuit so like things are established. So, a
path is established from source to destination. Now, this how this connectivity’s will be
established by at the intermediate things is decided by some protocols or some
algorithms or some way intelligent techniques that it how things will be established.
Once established the this is dedicated for this things. So, that nobody can basically
intrude into this path in other sense this path is reserved or the resources are reserved at
different exchanges, at different with different type of what we say resource allocations
schemes, right.

So, in this case it is connecting trunk, then intercity trunk and then another connecting
trunk and going on the things. There can be multiple other, many other hops based on the
things, but nevertheless the whole path is reserved.

(Refer Slide Time: 16:02)

Now, if you just look at the space division multiplexing. So, or in the other sense there’s
what we say this sort of cross connect or cross points. So, 1 connects to 4 or 2 wants to
connects to 4 then I switch on this type of things. So, there is a controller or control
station which basically tries to see that that which is connected. So we have this sort of a
matrix type of things so anybody can connect to the any other resources.

59
(Refer Slide Time: 16:38)

So, it is a that was a single stage, it can be a multi stage thing where you have this sort of
switches in different multi stage and in doing so, there can be optimization of this type of
space division switching, otherwise if it is a whole matrix everybody is connected to
everybody by these things like here if you see there are 10 to 10 this side 10 nodes this
side 10 nodes. So, in ideally we could have a needed a 10 cross 10, or if this sort of
situation was there. So, around means 10 cross 10 or 100 nodes right like 3 cross 4 here
we are having 12 nodes; whereas, here the number of points have much less. So that we
can have multi stage switching and then I can have a, we can established here established
connectivity into the things, but this still the then we have to looked at to whether it is a
becoming a blocking architecture or nonblocking architecture, how many can
simultaneously talk each other and type of things. So those consideration comes into
play. So there is a need of overall planning when we go for this type of switching
strategies.

60
(Refer Slide Time: 17:50)

So in case of time division sorry there was a type of in case of time division multiplexing
so what we have? There is so, one is that no switching. So, I send it BCDA and it is
received by BCDA, right or there can be some sort of a switching, right. I want to send
from D the connectivity is that this has to go for to 4 has to communicating with 2 then I
can basically here change this packets sequence. So that there is a switching. So, BCDA
DCBA now become BADC based on that where the packets should go, right.

So, these sort of things are possible there this is a time division multiplexing and instead
of these we can have TDM bus or a mix of the different things. Nevertheless for all these
purposes what we have there is a resources location, a connection establishment is
required, then the communication and then a connection teardown process required. So,
these are these things are required when we look go for a this sort of circuit switching.
The circuit switching on the other hand is extremely useful or extensively used for our
standard telephone connections, right. All our exchanges etcetera are circuit primarily
circuit switched network means this our traditional telephone connectivities.

61
(Refer Slide Time: 19:28)

Like we are talking about time slot interchange, so that I can have a particular switching
things which basically with a control unit based on the things we can interchange or
select, so this is this can we select sequentially control and this can be a selectively
control that which data is coming in the thing. So, that is 1 2 3 4 whereas, I can
selectively control from where the date has to come out. So, in other sense I have I
simulated switching techniques where things will be there.

(Refer Slide Time: 20:06)

62
So, if you look at the switching circuit switching properties and issues, first of all once
connected, it is some sort of a transparent, right. So, once connected it is the
communication goes on in a transparent mode, like what we do in our telephone
connection once it is connected, I am talking about our traditional telephone connections.
So, once it is connected over this exchange and trunks and type of things then it is
transparent it is as dedicated line between the source and destination with appropriate
resources, so that you can go on communicating with the things, right. So, this is a
dedicated connection.

Secondly, what we have primarily developed for voice traffic. So, this was primarily
developed for voice traffic or our traditional phone connections, right. In some scenarios
or in several scenarios it considered to be not efficient, right. Channel capacity dedicated
for a duration of the connection, even a whole channel capacity which could have been
properly multiplexed right, I could have done a frequency division multiplexing etcetera
or other type of multiplex it is fully dedicated for the things right, or if even no data is
there, the channel is wasted, right. Even if you are not communicating holding the phone
or even not no data communication is not there, the channel capacity is wasted - no other
party can use the things. So, it is a dedicated resource type of things.

So other things other issues are there at times there are set up or connection takes time.
So establishment phase takes time to have connectivity, because unless the connection is
establish you cannot start communication. The basic assumption or basic condition is
that there should be connection between the source and destination, a full connection
should be established between the source and destination, unless it is established then
you cannot do.

Another things is the data rate is fixed. Both the ends must operate at the same data rate.
As the as it is dedicated path and flowing the data flow is in a particular data rate, so,
your source and destination should that it should be fixed and must operate at the same
date rate otherwise the sum there will be accumulation of the data all over flow of data
rate is come will come to play which will adversely affect the connection. So, the data
rate need to be fixed. So long as the voice things are concerned with fine right because
first of all voice as this own means, that communication has its own restriction with the
devices at the end, secondly, the human interaction can handled this data rate and type of
things, right if there is at all need is there.

63
(Refer Slide Time: 22:50)

On the other hand, which is our primary interest for our data network is the packet
switching. So, basically what it tells it is typically small packets the data from the station
to station it typically source to destination typically broken down into small packet
typically it is 1000 octets or one 1000 8 bits - 8 bit packet or type of packet. The longer
message split into series of packets. Each packet contains a portion of the data plus some
control information. Now here what is happening as we understand that it is as it is a
packet and packets are moving independently, so the packet contains the data and some
control information which helps it in get routed to the destination, right. So, there is one
information.

So, what is the control information primarily for? It’s basically for the routing or
addressing informations, where I am going type of things, or where to where I am it is
moving and there are other informations which are there in the things when we
particularly discuss about this packets then we’ll be discussing those things right like.

So, packets are received stored briefly or what we say buffered and passed on to the next
node. So, once say intermediate node receives a packet, it once a packet reaches a
intermediate switching node, it receives it, store it and forward it. So, typically it is that
store and forward mechanism receive it, store it and forward the packet to the next
destination.

64
(Refer Slide Time: 24:43)

So, like this like the I have a application data from the one end, that is the packet
switched network and I want to communicate to the other end through this packet
switching network.

(Refer Slide Time: 25:05)

So, there are advantage, first of all line efficiency - single node single node to node link
can be shared by many aspects of the many packets over the time because now it is no
dedicated path, I have small packets. So, the single node to node edge can be shared by
different packets. So, packet queued and transmitted as fast as possible, right. So, at

65
everywhere what we are doing, you are receiving, storing forwarding, so, it is queuing,
queued and pass to the next destination or next hop as fast as possible.

There is a there is a possibility or there is a what we say chance of data rate conversion
right, each station connects to the local node at it is own speed, right. So, nodes buffer
the data, if require equalize rates. So, as there is a store at forward type of mechanism the
node has a option of synchronizing the speed, right. So, different communication
between the different edge and different speed of different node may be different. So, it
takes and basically make a rate conversion on the things, right.

So, that is possible because this these are small packets and are handled independently
and each other. Packets are accepted only even when the network is busy even when in
the intermediate network is busy, that the packets can be accepted and delivery may be
slow, right. Which may be which will be difficult in case of a circuit switch things if the
network is not there it is basically a dedicated circuit we cannot do anything on the
things. But here we can accept the packets and it will be delivered once the things are,
may be at slower rate or once the availability is there definitely there are time limits over
which we cannot it cannot wait and so on so forth. Nevertheless, things will be there and
another thing is that I can have a priority of the things right. I can say that this sort of
packets may give an priority or others can wait and type of things. So, prioritization of
the packets for the communication, this is also possible.

(Refer Slide Time: 27:17)

66
So again, here also what we see there are two predominant techniques or two different
ways of packet switch: one is datagram, another is the virtual circuit.

(Refer Slide Time: 27:34)

Now, in case of a datagram each packet is treated independently. Packets can take any
practical route. So, if there are ‘n’ number of routes or say there are 4 routes, 10 packets
this anything can. Packets may arrive out of order, it should not arrive, it not necessarily
arrive in sequence, packet may get lost or delayed. So, once some packet may get
dropped or delayed may not reach the things on time or even may not reach at all.

So, there can be other mechanism to look at it, but it there this is possibilities are there.
Up to the receiver to reorder packet and recover from the missing packets. So, the
receiver only sequence it, and if there is a missing packet, receiver can take appropriate
mechanism, like receive can request for retransmission of the packet and so on so forth.
So, there can be appropriate mechanism, but there as to be done by the receiver end.

67
(Refer Slide Time: 28:35)

So, like typically if you look at a packet switched network. So, say 1 2 3 going towards
this particular node can follow different paths and go on accumulating, go on this at the
receiver end it accumulates or it order the packets in the things in a proper way.

(Refer Slide Time: 28:57)

So, other technique for packet switching is the virtual circuit. So, preplanned route
establishment before any packet is same. So there is some sort of a route establishment is
there. Call request and call accept packet establish connection or hand shaking. So, there
are there are request and call accept packets and type of things. Each packet contains a

68
virtual circuit identifier or VCI instead of the destination address, right. So, it is more
decided instead of destination address it goes on locally like if I want to transmit here
when next thing I have to deliver, which in turn things will be there right, but my routing
is now somewhat table based, right. I at every node, I say that if I received packet these
VCI received from port number received at port number 1 will go to that with port
number so on so forth.

So, no routing decision required for each packet once the packet is established, right. So
you do not have to individually you don’t have to take the routing decision. So, it follows
the things. So, it can be at times more efficient. Clear request to drop circuit. So, if there
is a if the once the communication is over, circuit may have to drop. So, there can be a
some sort of a circuit means tear of request and it may not be truly dedicated path. So the
circuit once they are if there is disruption or some other reason there can be another
circuits can be established. So, it is not necessarily truly dedicated path not only that the
paths can be shared by other virtual circuit also, right.

So I can have some sort of a multiplexing on the path, like here same thing what we are
seeing at a thing is established and then it goes on communicating in this particular
sequence right, in case of a virtual circuit.

(Refer Slide Time: 30:55)

So, as we were discussing that it carries a VCI so, if we see if I have a switch here which
receives a data 77 data 14 at port number 1, then it decides that if it receive 14 for one it

69
will push it to port number 3 with a VCI 22. So, this switching things are there and if you
see this is interestingly localized. So, I do not have to have a huge number etcetera also
because it is it is only localized like I can have other hops where some other VCI 14 can
be there, theoretically right. So, this is this way it goes on switching. So, if it is a one port
from port 1, VCI 77 it will go to port 2 with VCI 14.

(Refer Slide Time: 31:48)

Now, this so, if you if I have a larger scenario, then I can have something some paths to
communicate, right. So, it is for here it is one 14 coming, going to three 66, this is port 3
packet VCI 66. If 66 is established at port 1 and then it will be pushed to port 2 at 22
with VCI 22 it receives at port 2, sorry port 2 with VCI 22 and push it to port 3 to this. It
goes from source to destination with different type of hops and if you see this table
allows me to establish the route between A and B, right.

So, this is a virtual circuit established, it data flows in this particular direction.

70
(Refer Slide Time: 32:47)

So, if you try to look at the packet switching virtual circuit by the datagram. Virtual
circuit network can provide sequencing and error control, as they are having a establish
path. Packets are forwarded more quickly, no routing decision is required for
individually at the packet level. Less reliable, loss of node loses as the all the circuits to
that particular node and because a particular node can have more than one circuit which
is established, and if that particular node is faulty or not working, then all the circuits to
the node is lost it goes for not only reliability, it also have extra cost of reestablishing the
country circuit and transmitting the things.

Whereas datagram one has these has no call setup. So, each packet moves independently.
Better if the number of packets is less, if huge volume of packets are there then there are
lot of calls there. More flexible, routing can be used to avoid congested part of the
network, right. So, I can we can have different routing things, so that if there is a
congestion then the other packets are routed to some other part of things etcetera. So that
is not affected or better routing strategies can be there.

71
(Refer Slide Time: 34:15)

So, if we try to now look at circuit switched and packet switched network or packet
switching network, right; so in case of circuit switch, bandwidth is guaranteed right. So,
that you have a establish connectivity and your data flow through that so, the bandwidth
is guaranteed; whereas, in case of a packet switch, bandwidth dynamically allocated as
needed as need basis right, or as and when needed type of things. So, that is that is being
allocated as there is a need, right. So, it is not guaranteed bandwidth. It may so happen
that the bandwidth availability is not there or when you need because you are not
preoccupying the resources. So, while communication you may face problem of
dropping of packets etcetera lose of packets.

Circuit capacity not reduced by other network traffic. So it is not, as it is a dedicated


circuit the circuit capacity once allocated or once established, are dedicated for this
source and destination. Whereas, may have concurrent transmission over physical
channels, right. In case of a packet switches, may have concurrent transmission over
physical channel so one physical channel there can be number of things.

Circuit costs independent of the amount of data transmitted right, resulting in wastage of
bandwidth. So, whether I if I established a connectivity whether I transmit or not it is a
dedicated connection. So, I pay for it, right. So, in other sense, there can be effectively
there is a waste of bandwidth whereas, there is more effective and better performance
because there is no such sort of a blocking the channel even if you not communicating,

72
but they may have some delay and congestion because of its typical characteristics. And
at we see that this type of circuit switch network is more amicable for voice
communication, right. So, it is more amicable for voice communication where as this
sorry this circuit switch network and where as the packet switch network are more
amicable for data communication or how data is communicated between the things. So
for our computing this particular course for computer network and internet protocols; we
will be primarily looking at this sort of a packet switched network, right where this nodes
or the packets are independently moving from the source to destination and in number of
cases this is a unreliable, best effort service, it depends on how things are there.

If you want to have a reliability on the things, you should have a different mechanism of
the things. That we will gradually study on in this particular course when we go on more
deep into the things and specifically look at different protocols, their characteristics and
type of things. So, what the primary objective of this particular lecture is to that to brush
up that already most of you may be knowing that packet switch and circuit switched
network. There are several other things we mentioned here. So, we have a overview of
the things, but we primarily now look at that packet switched based things what we go on
subsequent things, right.

So with this, let us stop today and we will continue our discussion in subsequent lecture.

Thank you.

73
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 04
Protocol Stacks – Layered Services

Hello. So, we’ll be continuing our discussion on Computer Network and Internet
Protocols series of lectures. Today we will have a quick overview of the different
services at the different Protocol Stack. So, if you recollect in our previous talks or
discussion what we tried to look at it that how this inter-networking is possible and
primarily the concept is a layered architecture so that intermediate networking devices
are enabled up to the layer which is upon which is it supposed to look at. Like what we
see that if it is a simple hub or a repeater. So, it can look up to the physical layer, all other
layer things will be a payload to this physical layer, or if we look at a, on the other hand
if we look at a router, so it has a network layer. So, it can look at the packets at the level
of the network layer or sometimes called IPDR or inter-networking layer and type of
things right. So, these protocol stacks allows us to design different devices and also
allows to inter-operate between heterogeneous devices and services. So, what today’s
talk what we’ll be looking at, is that what are the different typical services provided at
different level layers of per say TCP/IP protocol stack or which is which will be
somewhat true for OSI stack only. We will just look at it. So, that in our subsequent
lectures we will go on looking at this stack individually like that how they behave.

74
(Refer Slide Time: 02:19)

So, just to have a quick recap; so, again if when we talk about network protocols; so
what a protocol says? Protocol defines the interface between the layers in the same
system and with the layers of peer system.

So, it is a set of rules, set of guidelines or what that by which the different, the different
applications or the different services in the same system or with the peer systems things
can interchange. So, protocol basically allows us to inter-operate right.

So buildings blocks of any network architecture that we have already seen.

Each protocol object has two different interface. So, broadly two different interface one
is service interface - operations on this particular protocol, that is it keeps some interface
that which explores the services which can operate on this protocols or peer-to-peer
interface - message exchange with the peer. So, one is allowing it some interface the
services can be exploited or executed or can be done or another is that how I can say in
message pass between the peers of the two protocol, to particular protocol say.

So, it includes specification of peer-to-peer interfaces if I want to communicate with


peers, then I should include the specification for peer-to-peer, that what way the message
will be there, what will be the particular size of the message, what will be the structure of
the message and what you expect when whether you expecting an acknowledgement; if
at all how things will be there, how will be and so on so forth right. So, other things is

75
that the module it implements this interfaces. So, there should be so, modules which
implement this particular interfaces right at the things.

So, typical features are like that can there are there are prose, pseudo-code, state
transition diagram and it allows interoperability when two or more protocol that
implement the specification accurately, and overall it is guided by IETF right, Internet
Engineering Task Force. Otherwise the standardization will be a major challenge. So, if
you see these like any other systems, here also what we see this protocols provides a
guideline how to inter-operate between two peers and how to basically provide a
interface with the services which are provided by that particular protocol right.

So, this makes or this appropriate definition or appropriate guideline helps us to inter
correct this whole networking or what we say that making this inter-networking possible
right.

(Refer Slide Time: 05:28)

So, if we again little bit look at the key elements of the protocol, when we when we look
at individual protocol stack like when we look at the application layers or the protocols
in the application layer, protocols in the transport layer, protocol in IP or network layer or
data link layer though physical layer protocols are there, but physical layer based on the
communication network in some of the cases we segregate we will try to give a overview
of the physical layer protocol. But if you look at that that this link layer, network layer,
transport layer, application layer, these are the major contribution of this inter-

76
networking things, definitely there should be a physical layer and there are physical layer
constraint things that we’ll discuss.

So, when we discuss at the individual protocol level, we’ll see that what is their different
what we say specifications right. So, if you like to like to look at the key elements of a
protocol, of any event protocol, so one is the syntax right or what we say syntactical
specification that is data formats, signal levels and type of things right. So, this keeps the
overall syntax at the protocol. If we come to the other side or the next level is the
semantics right; what are the control informations or error handling capability, whether
the at all the protocol has this error handling capability or not, what sort of the control
information or control structure is there in the protocol that comes in the things which is
more of the semantics.

So, given a syntactical framework how this my how this protocol still works? Like I say
that when I keeping apart the networking, say I my protocol that I send a message in a
particular things, when I when I send a message like a voice message at some other part
it interprets. So, that is a particular format right. So, I send a message in a particular
format and it respond in a particular format right, like I say, I in order to knowing the
result of a particular things I send a SMS number and some reference number and so on
so forth. So, three, four fields I send the things. On that I expect a response on the things
right. So, within that it will respond either by voice or send me back some other message
and type of things.

And if there is a fault in that overall things, if there is a packet drop or there is a failure in
the transmission line; so what is the error handling? One is that there can there may be
totally no error handling mechanism. If you don’t get a response with a stipulated time,
you think that the message is lost, you resend or whatever things you want to do you do,
otherwise if there is a error handling mechanism. If it is there a loss, there is a specific
mechanism to indicate that if it does not say receive acknowledgement, it will resend or
retransmit the signal in the things right.

So, that all depends on that how this protocol is specified. And there is in order to happen
all those things, we require a timing relationship right. So, there can be a speed matching
issue right like what we say that the interfaces you’re pushing in say, usually what we do

77
in case of our say when we have push message along the network typically it follows the
store and forward: store and then forward the things.

In order to do what is one of the things what it tries to do, it tries to match this incoming
and outgoing stream right. So, there should be a synchronization, appropriate
synchronization of the thing, there is a speed matching thing, because there are
independent devices working at different speed or different frequency rate whereas I
need to have a appropriate speed matching otherwise the communication may not be
possible. So that also need to be somewhere looked into a within that particular protocols
to specify somewhere or other.

Another in some cases we require sequencing of the things right, I send message one,
two, three and it should be reached as a one, two, three right. So that and as we have seen
in a packet switched network where a particular message is broken down into a different
packets or datagrams and they are sent independently over the network. So, it is not
necessarily that always the datagram will follow the same path and at the end the
datagram need to be appropriately sequenced right.

So, the sequencing mechanisms need to be ensured in some way or other right. So, that
either the it follows the same path or there is a sequence number which allows it to
reconstruct and so and so forth, but nevertheless there should be sequencing mechanism
in place. So, that if you look at the protocol as a whole at any layer of this network layer
or for that for that matter any systems which communicate with one another, I need to
look at this different aspects – syntax, semantics and this timing relationships right. So,
this is this is pretty important for to have the in realization of the protocol. So, whenever
a protocol is designed, so these aspects are looked into right, that how things will work.

78
(Refer Slide Time: 11:16)

Now, so if you look at the very broad view: interfaces. So, if you see there are some
higher level objects right, at the both ends. So, this is host 1, host 2; it can be directly
connected or it can be at any level of the internet right. It can be machine to machines
directly connected or two machines connected through different are different network
and frame.

Nevertheless, it has a higher level object at which is say messaging or something which
is going on, and it has a service interface to this protocol, right. I put a service interface
and this protocol carries the things and go on at the other service interfaces, like if I vary
broadly try to say I am writing a letter to somebody with our standard postal system or
courier systems or what we see that we write a particular letter or write a particular form
for a application for something. And then, I push it to envelop then write the address
etcetera and then I put it in somewhere, either I put it to that letter box or I register or put
through a courier system to their desk etcetera.

So, there is the interface to take that and there is a separate way of carrying those things
to the other end right. So, that is a that two protocols, how to carry something from IIT
Kharagpur to something say Kolkata is, there is a interface for the protocol end. Now one
day once it is there then the again there are interfaces to go to this higher level things. So,
this is so what we try to see that every protocol this interfaces should be properly
defined, that how need to talk to this interfaces.

79
(Refer Slide Time: 13:05)

And if you look at it there is a inherent hierarchy in the protocol itself right, like if we
see these are at the upper application layer, then the next layer of protocols should be
there and then there is a another level of things and go on going to the things. So, if you
look at so there is a appropriate hierarchy of these protocol stack; if you look at the
networking things.

So, what we what we trying to discuss is that, these are the different features of a
protocol stack and we will we will be going deep into the things once we look at the
individual layers.

80
(Refer Slide Time: 13:48)

And then another things what we have already discussed in some form is that
encapsulation right, like if I have say application layer, transport layer, network layer,
data link layer and physical layer, then things are encapsulated. That means, the data
generated at the application layer becomes a payload for this next layer, becomes that
along with its own header and other information, it becomes a payload for the next
header. So, what we see, that a data generated at a higher level get encapsulated in some
form of other and at the end, it is carried through this physical media to the other end
where it is again been exploded or extracted out from this particular bundle at the
different level.

So, this there is a distinct beauty of the thing, like intermediate layer which is looking at
it opens up the packet up to the layer it needs to look at right, like as we are saying that a
network interface, a router interface will open up the things at the, up to the network
layer. It is not opening up the so, at the higher layer. That’s why we say these are layer 1
devices, layer 2 devices, layer 3 devices, layer 4 devices and so and so forth, right up to
layer 7 devices; if we follow that protocol OSI or we say layer 5 device and type of
things; that means it opens up the packet up to that layer right.

So, layer 1 device will open up to the data link layer and so on and so forth right. So, that
keeps a beauty that I need to open up to look at take it is enough to up that level, it is rest
of the things is a payload to me. So, open system interconnect as if we if we quickly try

81
to revisit, so that is the OSI model says there are 7 layers like physical, data link,
network, transport, session, presentation, application and intermediate hops there the
layers are may be like if there are intermediate routers, so they are up to the network
layer.

(Refer Slide Time: 16:00)

So, what we say this peers are in some sort of a virtual connection or virtually connected
I should not say virtual connection. So, this network layer whatever is there, can be open
up by this network layer and this network layer and go on doing that right, and rest of the
things at the up to this is become a payload for the network layer. So, it carries that data
as a payload for this network layer right. So, this goes on. So, if there is a layer 2 device
in between, then it will can it could have seen only up to this data link layer. If there is a
hub or simple repeater, then it could have been the physical thing which is only
regenerating the signal and transmitting the signal right.

So, this if we so if there can be one or more nodes within the networks which allows it to
hop to the destination. So, if it is the two end host or the remote host, so it will go on
looking at it.

82
(Refer Slide Time: 17:05)

So, if we look at that protocol layers typical functionalities: so we have physical layers
which handles transmission of raw bits over a communication link right. So, physical
layer is concerned to the things. If it is a, if it receives a data how this bits can be
transmitted to the through the communication link. As one of the predominant thing is
that these are transmitted as most in analog signal, there are provision for detail
transmissions the analog signals so that the data gets converted, transmitted and
regenerated at the things right.

So, as long as the physical layer is concerned, it is not bothered about what is going on
the upper layer things right. So, this is the one there is the functionality of the physical
layer is to transmit to the other end in a error free manner, so that it can be reconstructed
in the things right, and does it individually without bothering that where the upper layer
things are doing. If we look at the data link layer or the layer 2, it collects a stream of bits
into a larger aggregate called frame. So it collects a stream of bits called frame and so,
what we say that if we say raw bits at the physical layer then, what we say if say
aggregation of this bits into frames.

Network adapter along with device driver in the OS implement in the protocol is in the
layer right, like all of you know all of us know that any of our devices like laptop or
desktop or even our mobile devices with Wi-Fi connectivity, it needs a network interface
card or it needs a interface card to connect it to the what we say to the transmission lines,

83
so to say right, like it can be wired, it can be wireless and type of things. So, those who
are using wired connection like RJ-45, so there is a interface card which takes the signals
or the data from the systems and interface to the RJ-45 to this our copper cable right.

If you have a fiber connect, then it converts to that particular things. So, that the interface
card is responsible to convert this data to that appropriate signal level. So, that it can be
transmitted right. So, that is the basic property or one of the major functionalities of these
data link layer and data link layer also what we what we what we see that it mention
maintains a hop to hop connectivity like a what will be the next hop see this hop to hop
connectivity has to be at the data link layer level. Data link layer also has a property of a
having a hardware address or MAC address what we popularly known as. So that is
address which is which comes along with this interface card right. So, it goes to the hop
to hop.

So, even there is a network connectivity like or between several hops of routers things
are going on, it has to has to come to that particular hop, and then find out that particular
what is the data link layer, then the hop to hop connectivity is established; data is
transmitted to this particular signal right, a particular transmission line whatever
underlying transmission line is there.

Network layer handles routing among nodes within the packet switched network. So,
network layer handles this routing along the nodes. So, if there are if there are two
devices or two stations then this network layer takes care of the routing, it basically
responsible to finding out the path between the source to the destination, source node to
the destination node, source network to the destination network and so and so forth. So,
it finds a path or route or it helps in routing right.

So, even if finds the path going to one hop to hop by hop, it has to come back it come
down to this data link layer to go to the hop to hop. In order to come to the data link
layer again transmission the thing, it has to come to the physical layer to find out that
appropriate media to transmit the things right. So, data link network layer is much
higher, it cares about this how this path will be there.

So, unit of data exchanged between nodes in this layer are called packets. So, what we
say bits then the frames then the packets. So, these are different nomenclature which are
commonly looped into the things. So, this if we in some of the literature or some of the

84
books we refer this 3 layers at the lower 3 layers at typically implemented in all network,
mostly implemented in all network nodes. So, these layers are mostly available in all
network nodes which allows routing right. So, it is all what we are thinking that all
intermediate network node are having at least routing things. So, it allows routing on the
thing.

(Refer Slide Time: 22:33)

So, protocol layers functionality continues, the transport layer implements process to
process communication right. So, network layer this what is the path and transport layer
process to process communication, unit of data exchange in this case what we say
message right. So, this is typically called message. There are in case of OSI, we have two
more layers, like session layer that provides name space that is used to tie together
potentially different transport stream that are part of the single application. So, session is
basically maintaining a session which gives a some sort of a name for that session which
allows to have a transport stream of transport things which are at transport layer to
having the same session right. So it is session to session communication.

Similarly, then the present to presentation layer concerned about the format of exchange
data format, that format of the data exchange between the peers. So, what should be the
exchange format and support; and application is basically the application where the end
user are interested. So, it is standardized common types of exchangers using this network
stack. So, I have some applications like it can be file transport application, remote

85
logging application and so and so forth. This layer allows us that how this application
can be transmitted or can be standardized so that it can goes over this network.

So, transport layer and higher layers typically run on the end host right, and not in the
intermediate switches or router. So, this is typically if we see this transport layer
functionalities or higher layer like session presentation etcetera that are the end devices
right.

(Refer Slide Time: 24:18)

So, if we look at the network architecture to revisit the thing. One way that we have
upper layer things, then we have this transport layer, then IP which allows me to connect
to the thing. Other way of looking at this there are applications which uses this transport
layer which instead IP and the sub network is rest of the network what we say that last
three network and there can be application which directly talk with the IP, there are can
be application which directly talk to this sub network right. So, there are things which are
other way of so, different way of looking at the things what it allows it a large scale inter-
operation.

86
(Refer Slide Time: 24:52)

And if we look at the internet architecture which is defined by IETF, what this say does
not imply strict layering right. This application is free to bypass different transport layer,
different transport layers and to strictly use IP and other thing. So what it says that IETF
is not very stringent on this type of things right. It may be good to have a standardize
things so that you can receive you can inter-operate in better way. And if you see the
model is some way hour glass right you have very at the thin at the things and then
explode at both the side right; wide on the top, narrow in the middle and wide of the
things right.

If you look at the network, I have different networks and then, it boils down to the things.
Even if you see the telecom type of structure you have telecom circles etcetera, then you
have the trunk line which connects them. So, it is some sort of a hour glass. So, in order
for a new protocol to officially included in the architecture; there needs to be both
protocol specification, at least one preferably two representation in the implementations.
So, that how you can include the thing we’ll come to that thing that how a new protocol
can be included in the architecture when we go on different discussion on the network.

87
(Refer Slide Time: 26:01)

And there is concept of Application Program Interface. So interface exported by the


networks in most network protocols and implemented those in the high protocol stack is
in software right; what we see that at the higher level things are mostly on the software
and nearly all computer system implement their network protocols a part of the operating
systems itself, like if you see any operating system, they have that protocol stack
implemented. You have a interface card and rest of the things in your protocol, all the
thing are there available in to the thing.

So, this is the interface this sort of interface is called network API or Application
Program Interface. So, that is important. So, that it can allows you to talk application to
application and at different level of the things. So, we will we will be again taking up this
APIs at different context when we will talk about that different application layer things.

88
(Refer Slide Time: 27:01)

So, when you took at the TCP/IP protocols stack vis-a-vis OSI, so, is same more or less
the same functionalities not more or less, the same functionalities. Here it has been
shown as a 4 layer, but it you can look it as a 5 layer in several references books and
etcetera. So, application, transport, internetwork and there are data link and physical. In
this case it has been network interface and hardware are clubbed together. So it is a some
sort of 4 layer, but typically we will discuss the things as a interchangeably had 5 layer
where the data link at physical things are separated out, as physical connectivity or
communication have lot of complicacies and integrity we need to look at those type of
things in a separate way. And if you have that at the top level application, this
predominant protocol here is TCP, UDP, then we have here the dominant protocol is IP,
there are companion protocol which is ICMP. We will look at to those ARP RARP, ARP
RARP again allows to interface with the lower layers right, like data link layer and so
and so forth.

89
(Refer Slide Time: 28:12)

So, if we quickly try to visit these TCP/IP protocol stack. So, there are application layer,
application layer of the TCP/IP provides by the program uses TCP/IP communication
and application is a user process right, cooperating with another process usually on the
different host right. So, it is a application like one popular thing is FTP file transfer
protocol. So, I have FTP client somewhere FTP server is running. So I can basically
connect to the things. How do I identify a particular application? It is a typically
identified by the IP where the application is running and the port where it’s the interface
where you need to connect to.

So, we come to a concept called socket. So, in this particular course we will have some
socket programming. We will be detailing little more on the socket when we talk about
this socket programming aspects. So socket is allows us to connect to applications.

90
(Refer Slide Time: 29:08)

Similarly, in case of a transport layer, so it is it identifies a, it is a process to it basically


helps in process to process communication so; that means, it looks at that port of the
thing. So, transport layer provide the end-to-end data transfer by delivering data from the
application to its remotes peer right; so two application by at the port level. Multiple
operation can be supported simultaneously, There it concurrent application that we will
see. The predominant protocol is TCP or transmission control protocol which provides
connection-orientated reliable data recovery, duplicate data suppression, congestion
control, flow control and so on so forth. There is another protocol which is also very
popularly used - it’s UDP, User Datagram Protocol. So, it is connection less, unreliable,
best-effort service right.

So, in some cases what will see that so, if you require this other type of things, error
control, flow control etcetera, then this has to be handled by at the upper layers right. So
usually UDP is used for application that need a fast transport mechanisms and can
tolerate some loss of data right. We will see that where which type of applications which
where this UDP will be useful and where we use this type of thing.

91
(Refer Slide Time: 30:25)

Next come that inter-networking layer or IP layer or network layer what we say different
type of things, it allows us to route packets from one network to another. So it connects
network right. So, it is a most important protocol in this layer, it is the IP is the most
important and it is a connectionless protocol that does not assume any reliability. So, it is
connectionless best-effort service right. So, there is the predominant protocol is the IP
protocol which allows to that connectivity of the network between the two networks
right.

There are and we will see little detail once we discuss. So, does not provide reliability, no
flow control, no error recovery and this function can be provided by the higher layer. So,
predominant protocol in this is the IP, ICMP, IGMP, ARP, RARP and we will discuss
those when we discuss at the RARP what are the different, but the major protocol is the
IP protocol.

92
(Refer Slide Time: 31:27)

Then we have internet interface layer what we say data link layer and rest of the physical
layer type of things. So, this is this provides the data link layer. So, predominant protocol
here are IEEE 802.2, 2.3 which are that we have the Ethernet protocol there are X.25
ATM, FDDI, SNA and different type of protocols. And what we assume there is a
underlying communication path which allows to which this particular frames is the data
link layer and pushed as a bits into that particular physical layer connectivity.

(Refer Slide Time: 32:08)

93
So, if we look at again come back and try to look at, so we have this different type of
layer application where these are the predominant some of the application protocols,
transport layer, inter-network layer and there are interfaces which combines both your
data link and physical, we can have different data link means I am repeatedly telling that
these some references in several references, there are treated separate, here it does not
matter, here it is shown as a single stack.

(Refer Slide Time: 32:47)

So, that single stack, that means, underlying physical layer, physical communication path
is there which takes care by these type of protocol. So, if we have a big picture, so we
have different computers where this applications through this transport service access
point and there is network access. And we have a underlying communication path which
allows me to connect to this different devices across this internet.

94
(Refer Slide Time: 33:05)

And if we look at the same thing in a little different way, so there are peer-to-peer
application understand application; FTP client understand FTP server, HTTP client
understand HTTP server. How things goes on? It is transparent to that application right.
So, it goes to the transport if the TCP is the basic thing, then it connects to the TCP or
UDP, it goes to the network access IP, IP routes the packets form one to another and it
goes to data link, then it goes to the physical and being communicated through the
communication network right. So that goes in a ubiquitous way right.

So, what we try to see in this particular talk is that how a communication between two
host anywhere across the internet is possible by the, or different type of services are
provided into the things. And in the subsequent lecture slowly what will start we will
look at different layers individually right, that how different layers individually what are
the different properties, what are the predominant protocols, how they work and so on
and so forth right. And also, we will try to, as I was mentioning that we look at little bit
of programming like socket programming; how you can how two things works and
etcetera right.

So, with this let us stop today’s discussion.

Thank you.

95
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 05
Application Layer - I

Hi. So, we will be discussing today on application layer of our TCP/IP protocol or
network protocol part say. So, what are the so, as we have discussed in our earlier
lectures, that we will be initially we were discussing about the overall protocol stack.
Now, we will start discussing layer by layer and their basic properties etcetera, and what
are the different features of those layers. So this application layer as we all understand
plays the more, most vital role as far as the end user of the clients are concerned right,
more concerned about the application which is running over the things right, not the
underlying thing.

So, when we open a web page or transfer a file, open the mail server or download mail or
look at the mail server. So, we are these are the different applications which are at the
front of us, right which the end user or is bothered, or the client is bothered. Whereas,
where as there are a lot of under underlying things goes on down the layer which are
equally important we will go through the things. So application layer has a direct
connection or manifestation to our, this end user perspective.

(Refer Slide Time: 01:34)

96
So if we look at our typical protocol stack as we have discussed, that it has a application
transport internetworking or layer three. And this network interfaces and hardware as
repeatedly, we are telling that there are there can be data link layer and the physical layer
which constitute this. So, there and there is a underlying physical layer underlying there.
So, if you look at the applications there the predominant things are like Telnet, FTP,
SMTP, HTTP and DNS and so and so forth. So, these are the predominant
functionalities. We will be for next couple of lectures we will be concentrating on these
application layers.

(Refer Slide Time: 02:21)

So, again if we if you recollect what I have seen that these application layer protocols,
primarily talks with the next layer of the transport layer which provides either a
connection-oriented service or connectionless service which in turns talks to the down
the layer like layer 3, IP layer and so on so forth. There can be application layer which
directly talks with that IP layer and like that. So, these application layer can primarily
talks with these transport layer or in some cases in some of the applications it can talk
with the directly to the IP layer.

97
(Refer Slide Time: 03:00)

So, again what are the basic philosophy that application layer is provided by the program
that uses TCP/IP communication. So, it is the, what we say that programming quote
unquote “programming interface” to this whole networking paradigm. And application
layer is a user process, cooperating with another process usually on the different host.
Typically, we call this as client server things. So, when I run an application it is a client,
to some application at the server, at the other end of the network.

So, though the client server do not say that it should be other end of the network, it can
be the same network itself, but nevertheless I have a application server client which
connects to the server like when we download www, or link to “www iitkgp ac dot in”
, then what we do? We basically connect to that iitkgp web server and my browser at my
end acts as a client, client to the things which is connect to the server.

So, this HTTP client to HTTP server then there can be FTP client to FTP server and so
and so forth. So, it is a so, user process cooperate with another process. So, is that in turn
can have other type of things. So, there are popular example like Telnet SMTP SNMP,
FTP HTTP type protocol DNS and so on and so forth. Interface between the application
and transport layer is defined by port numbers, right like how do I identify a system? By
a IP address how do I identify a process in the system? By a IP plus a port number which
is which is a mostly as a transport layer phenomena. So that identifies a process in the
system. And there is there are a concept called sockets. We will be discussing on those

98
sockets a little bit of socket programming, also we will be looking into, but this is what
we say socket. So, it is a socket which is establish a socket interface with establish
between the source and destination. And popularly what we use the term like socket
programming and so and so forth, which allows me to communicate between each other.

(Refer Slide Time: 05:11)

Now, same thing this if application layer there is a variety of things some of the file
transfer label things, some are email type of thing that use SNM SMTP, remote login
Telnet, a login network management, name there are name management like DNS, and
used by routers. There are different applications which are at the this at different level.

99
(Refer Slide Time: 05:38)

So, if we have a more holistic mix, where there are applications different applications.
So, there are different service points of the things. So, this transport layer defines that,
along with that we have a network access layer. So, IP plus the process allows me to run
that application. So, that means, I may have a server which acts as a say FTP server, a
SSI server or a Telnet server or different type of server. So, where the different things are
defined at different port.

There are popular ports like what we know that Telnet like port 23, FTP is port 21, rather
there are 2 ports, data and control port 21, 22, then HTTP port 80 and so and so forth
these are popular port, but you can define your own port where the server is running.
Client can connect through any other port, right. Similarly, so, there may be computer 1,
computer 2, computer 3 and there are there can be several applications. So if you look at
the at the top level view so, these different applications are talking to each other, right.
So, that that actually what gives us that realization of how a process can communicate to
process, or a application talks to each other, and that has a with the with the underlying
network. So, the beauty of the things that this, the underlying network is not exposed to
the client or the server, right. When I access a through a when you do “http www iitkgp
ac dot in”, so you are basically bothered about the page to be described right. So, neither
how this protocols stack or intermediate routers come into play that we are not looking
at. So, what we look at is the intermediate communication networking is in place, right.

100
(Refer Slide Time: 07:27)

So, similarly so if you as we discuss, so if you look at, so I have application transport and
network access. So to say that means, one defines the port and IP, and then whatever the
data is there, it is being a payload to this next layer, that is for the transport video and it
being becomes a payload, this whole thing becomes a payload to this network access
layer. And at the destination it gets deciphered.

(Refer Slide Time: 07:54)

Or look at some another view if you look at. So, I have different applications. So it is
logically connected to different applications, like as the TCP is the predominant protocol

101
that is which is a connection-oriented protocol. So, it has a - it finds a logical connection
between the things. We as we discussed that that it is this whole thing runs on IP, IP is
again a connectionless best-effort protocol. It does not guarantee that the packet will be
delivered or not. So, there should be some mechanisms, here at the TCP end which will
allow this logical connectivity, and what we say reliable connectivity on the over this
unreliable layer right. So, we will discuss when we go into those lecture series, that how
it is feasible to do that and how irrespective of that underlying layer giving some services
I can have a upper layer services on the things.

Now down the line I can have different network access level protocol by which the
network is accessed. And it goes on through the physical layer and the type of thing so, it
goes on routed. So, there can be n number of router in between. Again we will be
discussing those things when we go at different layer that how these routings are made
possible. Nevertheless, this application X talks to the application X, right or if we little
bit look on if the this is a application X client talks with the application X server, right.
Or application Y client while talks to the application server right, two applications are
talking to communicating with each other.

(Refer Slide Time: 09:30)

And I can have different type of things there are predominant applications which are the
TCP. There are few applications which are UDP. Like, SNMP is one of that for the
network management. There are several companion protocol for the ICMP, IGMP, OSPF,

102
RSVP and so and so forth that the IP somewhere in between transport and IP. And so,
there is a bunch of protocols which are they are in the within this protocol stack.

(Refer Slide Time: 10:02)

So, if we look at so if these are the layers. So, applications and then we have something
which is controlled by the software and kernel. This data link some part and the physical
is primarily controlled by this firmware devices or device drivers and hardware at the
physical layer; that means, you require a network interface card, and network interface
card to have a physical connectivity, like when you put a RJ-45 cable into your laptop or
desktop, so you there should be NIC card which takes care. You will have a, you do
require another interface card like wireless interface to work on those looking at those
that, there is also a hardware, over that I require a firmware and device driver which runs
the things like if I have a NIC net inter card there should be a particular device driver to
work on if you have wireless or Wi-Fi interface, so there should be a device driver
support from the operating system to that, right. Over that primarily it is handled by the
machine and by software and kernel of the particular ways, and the device drivers to
takes care of this network and protocol; the network and transport layer and over that the
application runs, right. So if you look at, if a when we are running FTP or HTTP, so
underlying we are using some of the things which are defined at the net at the stack level,
transport and IP layer which primarily if you see that if you in a normal Windows PC or
even Linux level or Unix system. What we do we basically this define the TCPIP
property, right. So, we provide those information to look at and there are some of the

103
things are taken care by the OS or the kernel itself. Say, when a pack a when a when a
client is going out, it gets a port address to go out of the serve out of that particular
interface. So, this gives a overview of the stack.

And if we look at again some again that stack view,

(Refer Slide Time: 12:15)

so I have say there is a HTTP data. So HTTP data along with the HTTP header which
creates the application it becomes a payload for the transport layer, it becomes a payload
for IP layer, adds the IP header and it becomes a payload for this data link layer and
finally, it goes to the physical layer and where the things are being transmitted, right. So,
this way it goes on and it goes it gets unpacked or extracted at that different level. If
there is a router it gets extracted up to the network layer. If it is a other end system, it
gets extracted up to the application layer right. So, it gets unfolded as a as far this as the
device level whatever the support is there.

So, in other sense what we what we try to see that it supports interoperability in a bigger
sense right. So what we say that I do not care about what intermediate router is there. So
now, I am following the protocol right it goes on hop to router, it the overall routing
business to finding the best path between the source and destination is not primarily
dependent on the system level things right. So, these are the things we look at.

104
(Refer Slide Time: 13:33)

So, if we look at the anti-application layer interfacing in some other way. So, we have
different applications, and they have different type of requirement, right. So, one may be
the end to end packet delivery which may not be that reliable service required we can
push it to UDP; whereas, there are some of the things where we require a reliable
connection-oriented service TCP. So, we require different type of things. Connection
establishment, reliable data transfer, flow and congestion control, order packet delivery
and then the rest of the stack.

(Refer Slide Time: 14:04)

105
And different types of services are like typically DNS types of services are over UDP.
Whereas, HTTP email file transfer are over this type of TCP/IP, TCP type of thing
connection-oriented service. So, what we see that there are several application which has
their different kind of need, and based on that either they are pushed through the TCP
type of things or UDP type of things, UDP type of connections.

(Refer Slide Time: 14:35)

So, again if we come back we if we try to again look at it, so one is what are the typical
responsibilities of the application layer, identifying establish establishing availability of
intended, communication partners like if I am doing a “http iitkgp ac dot in” “www http
ac dot in”; that means, my intended other partner is the iitkgp web server, it need to
connect somewhere other it should take care.

Synchronizing cooperating applications - if there is a cooperative applications that like


say I have a chat server request-response I have multiple applications, where I require
orchestration or synchronization of the applications right, one data goes there then their
response income in some other fashion that need to be taken care by this at the
application level.

Establishing agreement on procedures for error recovery - if there is a error how to


recover from the reporting recovery from the error. So there should be some established
procedure for that right.

106
Controlling data integrity - so I need to have again mechanism procedure for handling
data integrity. So, these are the things need to be there, basic responsibilities there can be
based on the application, then several other properties or responsibilities of the
application, but nevertheless if you try to fit in somewhere other they fit in into the this
overall structure.

(Refer Slide Time: 16:08)

And if we look at the examples, there is a (Refer Time: 16:12) number of examples what
we use directly or indirectly day to day, one of the major thing is the DNS or domain
name systems. There are file transfer protocols or FTP, hypertext transfer protocol or
what we say HTTP which is which is the predominant applications which is which has
mostly used across the world. There are simple mail transfer protocols or SMTP which
takes care of our mailing system. There are simple network management protocol basic
management of the overall network SMTP Telnet. And there are there can be any host of
applications some of the applications can be used as defined applications which are
defined by that particular user; some of the applications are do whatever the applications
we are talking about these are mostly generic applications, mostly available in systems
and like that.

107
(Refer Slide Time: 17:18)

So, if we look at the DNS so, what is DNS? Domain Name Systems. So it is primarily
major job is to translate name to IP, like so, when we because if you see the; if we I say
that I want to find out “www iitkgp ac dot in”. Now www this name does not have any
meaning at the IP layer or the down the layer right, say whenever I want a routingm the
router requires a IP right. So there should be, either I give the IP at the top so that in
understand this is the thing. Or there should be someone which resolve that id IP right.
So, what we do? That when I give a name I send a resolver that you resolve it. So, during
DNS so I send to a DNS server we resolve and send me back this IP, right. And based on
this IP, the rest of the things goes on. So, name to IP conversion it is the resolve.

So I my system say by particular this system or my laptop acts as a primarily a it has a


DNS client, which requests to the DNS server which is revert back. How do I know that
DNS server? Either you while network configuration somebody has put the DNS server
here or from the network administrator you got it in the TCP/IP protocol stack etcetera,
or that automatically done if you have a DHCP type of things which when you put the
systems it loads the things. But nevertheless it should know where the server is right.

And there are as it is and here is domain based so, that a domain definition there should
be a particular protocol to follow. So, there are more than 200 top level domains right in
the internet, we’ll come to those things more in detail. Some of the example like “dot in”

108
is India, “dot us” is US, “dot edu” is educational sites, like “dot com” is company site,
“dot net” is network services and so and so forth.

So, these are top level domains. So, when I say “iitkgp dot ac dot in” is my domain, then
India is the top level domain or sometimes what we say that is a TLD, and below that
there is a sub domain called ac; that is, which primarily represent academics below that
we have a sub domain call iitkgp, right?

(Refer Slide Time: 19:39)

So, when we take the TCP, FTP and TFTP. FTP is a reliable connection-oriented service
that uses TCP to transfer files between systems that support FTP, right. So, TCP, FTP is a
reliable connection-oriented service right. Whereas, TFTP is a connectionless that uses
UDP to transfer.

So, there are different places where we need this type of things. Once you have to do for
a connection-oriented the resource requirement may be high. So, you may have some of
the cases whether those resources are not there. Secondly, if there is a failure you can
easily retransmit right, that may not be a big deal to retransmit, right. I may not be
requiring connection things, like I say I want to send a something from one place to
another. One is that I want a reliable service, I do not want failure to occur, other things if
there is a failure, I again send the things to again right, then I do not mind sending it
again. So that means, based on the requirement, like typically TCP is used for routers
figures like, like typically for example, some of the iOS images or the router images.

109
TFTP is designated for small and easy to implement. So, it is a less payload so it is easy
to implement.

(Refer Slide Time: 20:56)

So, another is the HTTP hypertext transfer protocol which is our as we are telling the
predominant protocol, and not only that as HTTP is extensively used HTTP is also
allowed in most of the routers and firewalls they allow to cross if at all they are allowing
the crossing of the thing HTTP is the first thing. That is why I will later on we will see if
time permits that if we have this web services etcetera which predominated piggyback on
the HTTP. Because these are anyway that part we will see later on. So, it goes for HTTP
request and the HTTP server responses with a HTTP response message. So, this way it
goes on communicating between the things, right.

110
(Refer Slide Time: 21:35)

Then we have a SMTP email server communicate other using simple mail transfer
protocol to send and receive mails. So, this is SMTP protocol is for as for the for mail
transport protocols. There are other back copies or the front end protocol like POP3 and
things likes that.

(Refer Slide Time: 21:58)

So, other another protocol which is there is a simple network management protocol
SNMP is an application layer protocol, that facilitate exchange of management
information between the two devices. So, SNMP is a application layer protocol, and it

111
facilitates that exchange of management information, right. Network level management
like it goes on, there are SNMP agents which reports the different status of the network,
where this SNMP there is your network management system takes that SNMP data and
do. So, it is not may not be directly used by us, but nevertheless it is required for network
management right. So, there is a important protocol for network management.

(Refer Slide Time: 22:54)

There is another protocol which is called Telnet, right. So, that which allows me which
allows us to connect to a remote system or site. So, Telnet client provides ability to log
into a remote internet host that is running a Telnet server. So, any client should have a
corresponding server at the other end. So, and then to execute commands from the
command line so, I have a Telnet client and server and a allowed to the command to the
command line.

So, we have Telnet client and Telnet server. And it goes on communicating between each
other. Or if you look at it that Telnet client basically does a TCP connection to the Telnet
server, which in turn can have different type of things. One is that can it can be running a
user applications or some sort of access control mechanisms, or there is a server control
for some other things, right.

So, these are the things which are possible with the things. So, it is a way that I can do a
remote login to another system, right. So, I can have a remote access to the systems by,
and then we can have applications, we can have server control, we can have access

112
control type of things. Again it is a client server things. So, if you have a Telnet client the
other end Telnet server will be there and there should be some credential check that IP
login password and so and so forth to go there, further matter in FTP also we require
those things to be there.

(Refer Slide Time: 24:22)

Now, we come to another thing which is to see that what underlying things how things
work what we see a network socket, right. So, it is we hear about network programming
or socket APIs and like this.

(Refer Slide Time: 24:53)

113
So, like if we if we try to little look back so, say if this Telnet server, what it is doing? It
is basically opening up or it is running a Telnet server things or in sometimes what we
say it is a daemon it is running right; that means, which is running and listening to a
particular, it is running and listening to a particular port, right. So, always active, right
say like if I if I do when I do a say HTTP. So, this HTTP server what it is doing? So, say
if I consider this is a www iitkgp server then what it is doing? So, they are at some port
say port 80, that is the standard port 80, port 80 that it is always listening. And listening
for what? Is there any request from the client? If there is a request from the client, when I
went from these, it absorb it takes it if it is a concurrent server, it creates a child process
or it is fork a child process and go on serving that like.

So, whether whatever may be whatever is that any kind server protocol, whatever is the
applications if the corresponding server end it creates a server process to look at it. So,
so, while connecting from the source, what we require? I require that IP right, of that
where I want to connect, like in our case when we “www iitkgp ac dot in” what we are
looking at? We are basically resolving it and going to a IP address of the iitkgp web
server. And then I want to know that where it is available; that means, I want to identify
the machine and also identify the process in that machine, right.

How do I identify the process is by the port number. How do I get the port number? That
is either it is known or for the popular HTTP things what we have the port is the port 80.
So, it is listening to a port 80, right. So, what we have from the client end it is a sending a
particular say application. So, it goes on that particular port and goes on that port. So,
this is suppose this application is running at port say x this application is running as port
y, and then when it goes it goes to the port. So, it may be the same server same IP
address, but I have a different port numbers, right. So, if you so, client what is what it
goes on. It basically take a the client what it, what is does? It goes to the IP of the server
port of the server, right. And it goes to the other end, right? When it goes out this it
knows that IP of the server, port server, IP of the client because it coming from where
and port of the client. Port of the client is automatically provided by the system if there is
no thing. Another thing I require is that the protocol. So, if we know this 5 step allow me
to connect to the things. Like here also we if we consider protocol so, this is it is a what
we did once this is there.

114
So, there is a path is established between these two, right. I am not bothered that in
between there may be lot of routers etcetera and so and so forth. That is underlying
network, but there is a path established. Now I can basically talk like a chat server or a
FTP file transfer or any other applications like that. Similarly, if I have another this
applications so, we can have another like this, right. So, another things established.

So, this things what we say they a basically a socket is established. So, that the
communication path is established. We will be dealing little detail with this type of
programming aspect, what we say socket programming how we can write my own socket
programming that how what are the things required. So, by this if we if we logically see
like the server when that things are running that http daemon is running, what popularly
what we say that “httpd” daemon is running.

(Refer Slide Time: 30:04)

So, at the server end so, for the http and here we have that http client which is our
browser; so, this daemon what it is doing? It is listening to port 80 or that server thing
and always alive. Like, it is something is anybody there? So, when the client’s request
comes, it takes it right, it gets the client IP etcetera, and the protocol. Though our for our
case the predominant protocol is the IP protocol. So, it takes that thing, and it based on
its resource and etcetera it responses that whether it accept this protocol.

So, once that is there the connection is established, and then goes on thing based on the
whether is a statefull, stateless etcetera based on the protocol thing right, it is like for

115
these it is the page is displayed for FTP. So, for the same like for FTP what we have
FTPD and here we have FTP client and so and so forth.

Other thing is that in some cases the, it can be a server other case it can access a client
and so and so forth. Like, I can have a print server which has a FTP client right. So, it is
all that process level things what we want to do. See by doing this we are giving a
interface to the end user to write program one network which can communicate with the
other processes, right. And the beauty of the thing is that you are not bothered, but say
with the underlying network it takes care of the things, because we are following some
protocols, some particular rules which is guided by the things.

Not only that, it is device independent we can have different type of devices and different
levels right we can have different mix and type of things. So long they are fitting into the
protocol we are not able to connect them. We are not bothered about the communication
path. It can be fiber, it can be wireless, it can be wired and anything, right. So long again
following the protocol, but end of the day your page get displayed, or you write a
program which can communicate to each other each other.

So, this is the ubiquitousness of this whole network level communication things, right.
Which that is why it is so popular because now it is heterogeneous, it is what we say no
centralized control per say, whatever you are doing at your end, only you are following
the protocols, right. There are guidelines, there are protocol guidelines, there are
authorities which takes care of those things, but say what you develop at your end and
flowed at the things is a business for your means it is your own business, right.

So, that means, that that allows me to do that. So, what we will do in the subsequent
classes will see some of this more application layer things. And slowly go into the
transport and network and data link and so on and so forth right. So, with this we let us
end our today’s class.

Thank you.

116
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 06
Application Layer - II (DNS)

Hello. So, welcome to the next lecture on Computer Networks and Internet Protocols.
Today we will be discussing one of the important application layer product all namely
DNS right. So, this DNS helps us in resolving name to IP conversion. So, we’ll go on
looking at it.

(Refer Slide Time: 00:40)

So, as if you just quickly recollect, so we have seen this application layer, there are
various protocols right, like some related to file transfer, email, remote login, network
management and there is a name management or name resolution for name resolution
which is DNS.

117
(Refer Slide Time: 00:59)

So, Domain Name Systems, FTP, Hypertext Protocol and so and so forth as some of the
important protocols. Today we will discuss on domain name system or DNS.

(Refer Slide Time: 01:11).

So, what is DNS? It is a sort of a global data base for internet addressing, mail and other
information. So, why suddenly we require this? Now you see, whenever you want to
communicate one packet or one data packet from one to another, what we require? We
require primarily the IP address of the destination right. So, specially when we do
internetworking, the IP address is the of the destination what we require.

118
Now, remembering IP address is the tedious job right. If you want to say if you want to
open iitkgp “www iitkgp ac dot in” and instead of this if I say that you remember the IP
address of iitkgp at 203 dot 16 dot so and so forth it is very tedious to remember. So, in
other sense whether I can have some naming convention; so, that mean some names
which in turn can be resolved to IP right. Now on the other if you see the routers which
can open up to or look up to network layer or IP, we’ll not understand this names right,
names can be only understood at the application level right.

So, routers should be given data in form of IP only. So, I require somebody who can
convert this name to IP, that exactly the job of the primary job of DNS. DNS does some
few more things that we’ll see, but primarily it works on this resolving name to IP. So,
there is a concept of domain and sub domains as a in a sense that how much I will cover
my in my DNS. So, have suppose IIT Kharagpur DNS. So, what it its responsibility
whether it will take care the iitkgp as its domain, can have sub domain and so and so
forth like we “iitkgp dot ac dot in” may be a domain, “cac dot iitkgp is ac dot in” a sub
domain on the things, and the type of things, and there are concept of DNS servers which
translate the domain name to the IP address.

So, one is that management of this distributed domain, another is that I require domain
name server which we’ll transport which we will translate this domain name to IP
addresses right. These two are the primarily one of the major activities of the things.

(Refer Slide Time: 03:36)

119
So, we have seen there are some of the Top Level Domains or what you say TLDs like
com, org, net and so and so forth. Typically these top level domains are three character
length and there are few country domains. There are rather for every country there is a
country domain which are a two character length like ‘in’ for India, ‘us’ for US United
States of America and ‘ca’ for Canada and so and so forth. So these are what we say top
level domain, so or TLDs.

(Refer Slide Time: 04:16).

Now, if we like to see the domain name space right. So, the domain name space is
something like that. So, we have some of the top level domains like arpa, com, edu, org
and so and so forth and then, under that, I have sub domains like suppose in India. Under
India there are ac; under ac, iitkgp; under iitkgp, cac. So there is the overall domain name
space right. So, that those domain name space need to be defined.

120
(Refer Slide Time: 04:52)

Now so, that above the TLD, we what we do or is the root domain. So, what we have say,
if this is a typical example of say challenger or “atc fhda dot edu”. So, this is a overall
domain name. So, if we go on this hierarchy. So, the next level is this one, next level is
“fhda dot edu” and edu is the top level domain this dot indicates the root domain.

So, these are the top level domains, which are they are which is there. So, this typical
example may be from (Refer Time: 05:34) books you can refer that, but nevertheless this
is the hierarchy of the things. So, see the manageability of the name has been done in this
way. Now at the every level there is a IP address. So, I if I want to resolve if I want to go
to this domain I need to resolve. So, there should be somebody will resolve, as we know
about this client server thing. So, say I give “www dot iitkgp ac dot in” in my browser.
So, browser is a client or an http client which requires my DNS for a resolution right. So,
give me the IP sort of things. So, the DNS resolve and send me back the IP address, you
taking this IP address the less of the communication goes on. Intermediate routers and
other devices understand the IP address right, at the end it will be delivered to the
destination IP address.

121
(Refer Slide Time: 06:31)

Now, if we look at these domains; so, this is a domain, this is a domain, this is a domain
and there are difference. So, this dot com as the responsibility of the thing and if we are
if it is having another intermediate thing, then it has to go for other domains to look at
and so and so forth right. So, every domain server or the DNS server have some record
of what it is under that right, that we will see that we call that it has a resource record.
So, what are the resources it is having right. So, it has or we it has a some sort of a
control authority of the domain. It can have sub domain, it delegate that thing to things
right and go so and so forth. Similarly, here also in the edu case we see this one.

(Refer Slide Time: 07:25)

122
So, like if I have “cse dot iitkgp ac dot in”, then in ac iitkgp cse like this is a top level
domain country domain and we above this is the root domain dot which is dot. So,
domain names are arranged in a hierarchical tree like structure. So, see I can have
multiple cse at some level, they are also cse iitb also have a cse, but the overall thing will
not disturb right. So, individually iitkgp only if you look at the cse, so that may clash
right, every iit or every iit has a cse department and their domain names have cse and it
will clash, but that is partially qualified or partially defined. But if I have fully qualified,
cse dot iitkgp ac dot in, this will never will be duplicated, so that means, I can uniquely
define that thing and uniquely define that IP address of the things.

(Refer Slide Time: 08:25)

Now, that is why we have a fully qualified domain name that if a domain name ends with
a dot it is assumed to be complete. This is called fully qualified domain name or FQDN
or an absolute domain name right like it should be iitkgp cse dot iitkgp ac dot ac dot in
dot so; that means, fully qualified. Only if I see only cse dot iitkgp, this is partially
qualified; that means you require something to make it fully qualified. If a domain name
does not end in a dot it is incomplete and the DNS resolver may complete these by
appending a suffix to this domain. The rules for doing are implementation dependent and
locally configurable. So, what how you will be there? So, DNS server can make it fully
qualified before going to the other things

123
(Refer Slide Time: 09:16)

So, we have some generic TLDs as we are discussing that top level domains, top level
domains are called generic TLDs or gTLD sometimes and can be three characters or
more in length. So, there is a top level domain typically three characters or there are aero
etcetera which is four characters. These names are registered with and maintained by
what we say authoritative agency or vice what we can what we call as ICANN. So, these
are top level domain, which has three plus three or more characters can be are defined by
the ICANN.

(Refer Slide Time: 09:54)

124
Now, this are some of the examples of top level domains are aero, biz etcetera that is
minimum three character, even there is a top level domain called museum which is much
more than that.

(Refer Slide Time: 10:04)

There is a concept of country domain, top level domains named for each of the ISO 3166
international two character country codes.

So, that everybody has a things like ‘ae’ for United Arabs, ‘in’ for India, ‘au’ for
Australia and so, these are the country domain or the geographical domain. So, it is
country specific, many countries have their own second level domain underneath the
parallel which parallel the generic domain name this top level domain right like what we
say like ac dot in right. So, there can be ac dot or what we say co dot in. So, there can be
some other domain where that is co dot say something edu is could can be there right or
something. So, what we have a iitlkgp dot ac dot in these are underneath that in domain.

125
(Refer Slide Time: 11:04)

Now, this distribution of domain space right.

(Refer Slide Time: 11:09)

So, if I if we see. So, if the root server primarily understands the top level domains. Now
if there is any resolution, it will go to that next level domains. Say if there is a request
coming from something dot com or something dot edu, it will send it to the next level
server which resolves the next level things. So, every domain server has their particular
authoritative zone, where it keeps the information records regarding that zone right. So,
while resolution it helps in doing that.

126
Now this hierarchical structure allows me to expand or add, delete, update type of things
right. So, if there is a update in say somewhere bk dot edu, so that that is server or edu
dot server understands. So, the root server sends it to that right. So, it depends on where,
like iitkgp tomorrow opens up a new domain it basically put it into its own resource
record of iitkgp ac dot in domain name server, which in turn are resolved when a request
for that particular sub domain comes into play.

(Refer Slide Time: 12:27).

So that means, we have zone and domain. So, this is a domain. So, there is one zone this
is zone and domain in the same so; that means, it takes care of that where the authority is
there. So, the data for which it has the authority, so it its responses with a authoritative
answer or it responses with a non authoritative, it get it if it gets update from somebody
other domain.

So, what is a zone?

127
(Refer Slide Time: 12:54).

Domains are broken into zone for which individual DNS server are responsible. So, a
particular domain is broken into zone for which individual DNS servers are responsible.
A domain represents the interset of names and machines that are contained under an
organizational domain name.

So, a domain represents the interset of name like iitkgp ac dot in. So, it takes care of the
interset of name and machines or names versus IP address that are within that particular
domain; a zone is a domain minus the sub domain delegation to the other things. So, it
has it has delegated the server like ac dot in domain as delegated that iitkgp related to the
iitkgp dot ac dot in. So, that domain of that particular ac dot in is restricted to the things,
which excludes it is like minus those or excluding those sub domain delegated to other
DNS server if at all.

128
(Refer Slide Time: 13:57)

So, conceptually is domain name is typically served by two or more DNS server for
redundancy. So if there is a failure of one DNS other should be able to resolve. So, again
the resolving means primarily mapping from name to IP. So, if the one of the server fails
the other server takes up the responsibility. Only one DNS server should be configured as
primary of a zone. The primary server contains the master copy of the data of the zone;
secondary servers can get copies of the data through a zone transfer. So, that is a
intermediate things, which goes on to the zone transfer and goes on for this sort of update
to the secondary servers right. So, there can be one or more secondary server. So but
nevertheless the master record is with the things and this secondary server get synced or
transfer of zone from the primary to secondary.

129
(Refer Slide Time: 14:53).

Zone transfer a primary server loads all the information from the disc, the secondary
server loads all information from the primary server, when the primary downloads
information from the secondary, it is called zone transfer. So, it is required that zone
transfer if there is a need like that.

DNS in the of - role of DNS in the internet working or DNS in the internet.

(Refer Slide Time: 15:19).

So, there are three categories as we have seen generic domain and country domain. One
is three or more and one is two character, a two character length; now there is a third

130
category called inverse domain or reveres domain right. So, that is these are all domain
name to IP. If there is a inverse is required, name to a - IP to domain, then we have a
inverse domain data base right, or inverse domain server which is which does a inverse
domain resolution.

(Refer Slide Time: 16:00)

Like for generic domain like in this “chal dot atc dot fhda dot edu”. So in this path it is
defined. So it is chal atc fhda dot edu dot, chal atc fhda edu dot right, similarly any other
paths will be defined.

(Refer Slide Time: 16:22)

131
So, for country domain like here also the paths are defined like that.

(Refer Slide Time: 16:31)

For inverse domain if it is IP to this. So the IP and IP this basically this server is in addr
dot arpa dot net, arpa in addr dot arpa and the IP it is written in reverse way. So, 132 34
45 121 is written here that 121 45 34 132 in addr and arpa dot net. So, the IP
representation in a inverse way this inverse resolution right. So, it is if the IP there it they
it basically sends back the name of the things, usually we have we all primarily we have
forward resolution, this is a inverse resolution.

(Refer Slide Time: 17:25)

132
Name resolution the commonly used server is BIND that is Berkeley Internal Name
Domain runs under UNIX or Linux as a process and called named, so that means, named
is the demon which is the DNS demon.

When application needs some information from the user, it invokes DNS name
resolution resolver. So, it resolve the name, the DNS translate a fully qualified domain
name into a corresponding IP address using the command called nslookup. So, when you
give nslookup, then it is resolved into the particular particular resolution.

(Refer Slide Time: 18:13)

You can pretty easily use any command from this one. So, if the name of the server does
not have an information locally, it asks the primary server and so on for the redundancy
each host may also have one or more secondary name servers, which may be queried
when the primary fails.

133
(Refer Slide Time: 18:44).

So, there is a command is nslookup. We can have a quick look into the thing so that it
will be say, cmd if I give hopefully the ns sorry nslookup. Suppose I give www dot first
of all iitkgp dot ac dot in, it will resolves the returns the IP address as I am a locally
accessing it, so, it gives me the local IP address. Suppose I give some other things like
www dot say something like nic dot in.

So, I get a resolution for that whatever it is showing is the IP, similarly www say google
dot com. So, it is all there Google IP as 216 dot this. So, this type of what it is doing? It
is asking the DNS server give me the names. So, it is some sort of a resolution process
which is going on right.

134
(Refer Slide Time: 19:58)

So, this is the hierarchy as we have seen of the domain names.

(Refer Slide Time: 20:04).

And if the resolution goes on, so there can be recursive resolution name servers asks to a
edu that what it wants to resolve a particular client and that fhda. So, it go on resolving it
request goes on the things and resolving in a recursive way. So, it go on recursing one in
server asks the next and go on recursive way.

135
(Refer Slide Time: 20:25).

Or it can be iterative client subsequently send queries to the DNS server and receive the
resolution; if responses is negative, DNS server to query the next is also returned.

So, if it is not having, it returns that where DNS to be queried, unlike recursive resolution
here where only one response is the finally written by the things. So, in the recursive that
itself recurs to the other, in case of iterative it sends that if it is not having sends the next
that address of the next DNS server. So, it is some sort of what we are discussing as the
recursive resolution.

(Refer Slide Time: 21:04)

136
Now, they are if there are if I want to resolve a particular DNS, if you look at the DNS
resolution or resolver point of view, so user programs send a query user query to the full
resolver. It in turns send to the name server, it get resolved, response and in turn give the
user response right. The DNS the full resolver maintains a cache by which it remembers
that what is the mapping. So, that it does it next time much faster where as the name
server has a if it is has a own database and cache and if it is not having it goes to it sends
it to the other name server foreign name server right. This is a full resolution so, the user
program in turn send to the full resolution and get it done.

(Refer Slide Time: 21:57)

There is another resolver, which is pretty popular that is a called another way of resolver
that is a stub resolver. The stub resolver as a routine linked with the user program that
forwards queries to a name server for processing. So, it is a routine attached with that
process itself. So, on most platform the stub resolver is implemented by two library
routines or some variation of this, like gethost by name is the routine, most of the Linux
is tends supports it and gethost by address is another routine. So, in this case the resolver
is embedded in the user program unlike that full resolver and then it goes on directly
hitting to the name server. So it is much faster and popular and mostly used.

137
(Refer Slide Time: 22:50).

DNS, now, let us come to the DNS messages right or also we called the DNS there is a
concept of DNS resource records before going to that messages types. So, domain name
systems distributed data base is composed of resource record RRs which are divided into
classes for different kind of networks right.

So, this is the thing resource record provide a mapping between the domain name and the
network objects right. So the domain name and the network objects are given in
mapping; that is interestingly if you see say iitkgp ac dot in. It can be a domain, it can be
a domain server, it also can be a http server or I can have a FTP server over there. So
there there is a record which says based on that mapping that what sort of request I can
map to that particular network object.

The most common network objects are the addresses of the internet host, but the domain
name is designed to accommodate a wide range of different objects, so that means, it is
not only the host IPs, but is something much more than that. So, it is a concept of
resource records right.

So, a zone consists of a group of resource record beginning with a start of authority SOA
of the record. So, it is a particular zone as a a group resource record, but it starts with the
start of authority right. There will be a name server NS record NS record for the primary
name server for this zone. There may be also NS record for the secondary name servers
right. So there is a there can be NS record for the primary and secondary. The NS records

138
are used to identify which of the name servers are authoritative. It is whether it is
authoritative or non authoritative determine by this NS record. So, that whether it is itself
maintaining it has a authority of thing or it is basically updated from somebody some
other name server.

(Refer Slide Time: 24:57).

So, typical structure of this resource record we will see some example name, type, class,
TTL time to live, and RD rec RD length, RData. So, these are the typical structure of the
resource record.

(Refer Slide Time: 25:13)

139
This is a typical format of a RR message format where some identification is required,
parameter, query count, answer count, a total number of NScount and ARcount right. So,
these are record count. So, that we have the questions section, answers section, authority
section and additional information. So, this comprises a RR message format. So,
whenever this RR message is being exchanged, so these are the things which are which
are used for when we do, so this this format goes on; that means, the DNS clients are
severs or DNS zone transfers the this is the standard which is follows to the everybody
understands the other message.

(Refer Slide Time: 26:06).

DNS message is typically of two things one is query, another is response right. So, query
response type of thing.

140
(Refer Slide Time: 26:13).

So, the query as a header and question section where as the response is having a header
question section, answer section, authoritative section and additional section. So, this is
the response is goes on the thing.

(Refer Slide Time: 26:31)

So, there is in the header format there is a two thing is identification and flags, along
with the number of question records it is send number of answer records all 0s because
there is no answer recording the query. So it is all 0s in the query message, number of
authoritative records, again all 0s in the query message, number of additional records all

141
0s in the query message. And there is a flag field if you just recollect. So, there is a flag
fields we just see that one.

(Refer Slide Time: 27:04).

That is QR there is whether is a it indicates whether is a query or response, OpCode 0 for


standard inverse or server status. So, that is the operational code it is a standard manager
is name to IP, IP to name is inverse and then service status. If it is authority then this AA
flag is on, TC is whether it is truncated of the full record is sent, RD is the recursive
recursion desired, RA is the recursion available and rCode is the status of the error.

(Refer Slide Time: 27:47)

142
So, these are the different formats of this flag fields and the type of records as we
mentioned there is a record, one is the query name, query type and query class like here.

(Refer Slide Time: 27:54).

Query name format, suppose we want to have that admin dot atc dot fhda dot edu. So, it
says that number of count is 5; so, that admin 3 and so, and so forth. So, it says that these
are the different names which are separated by dot by doing that; so, this is the query
name format.

(Refer Slide Time: 28:19).

143
And resource record format we have seen already that domain name, domain type,
domain class, time to live, resource record, data length and the whole resource record.

(Refer Slide Time: 28:32).

So, we let us see one or two examples, a resolver wants to wants a query message to a
local server to find the IP address of the chal dot fhda dot edu. We discuss the query and
response separately. Let us discuss.

(Refer Slide Time: 28:52).

So, this is the typical format where you see that is encoded these are the different fields.
So, you say query message and other things as 0 and this is c 4 c h d a c h a l, then again

144
4 f h d a 3 e d u and 0; that means, that is the end of the things right. So, it has if it is a
large record that continuing on the next line on node and so and so forth.

(Refer Slide Time: 29:25)

Similarly, example of a response is it query message is there and along with the response
message is also there right. If you can check that particular IP, so it is 153 dot 18 dot 8
dot 105. So, it if the response message which is read by the system and it is the DNS is
resolved.

(Refer Slide Time: 29:53).

145
Similarly, example two, an ftp server has received a packet from a ftp client, with IP
address 153 dot 2 dot seventy nine dot nine 9. The ftp server wants to verify the ftp client
is an authorised or not right.

So, it is getting a IP and now it wants to verify whether its authorised or not right. In
other sense that it wants to know that particular which domain has this particular IP right.
So, this is the ftp server wants to the ftp client has requested and ftp server wants to do
that.

(Refer Slide Time: 30:35).

So, it is a reverse query message. So, it goes on if you if you look at, there is arpa dot this
is r d d a arpa dot addr slash dash in dot the IP in a other way around right.

So, if I have 9 dot 7 dot 2 dot 153, so here 9 dot 7 dot 2 dot 153 dot in minus addr dot
arpa right. So, this is the way it resolve and inverse response file is return the particular
name of the thing which is return it is m h h e dot com is the name of the particular
domain.

146
(Refer Slide Time: 31:28).

So, why we required this? The ftp site server wants to authenticate or wants to know that
whether the IP where from it is getting a request for a file transfer request or ftp request,
then whether that is an authorised or not and it does as a reverse domain resolution ok.

So, what we see over all? That domain resolution is primarily for IP to a sorry domain
name a name to IP and it is easier to remember name then IP. So, that any anywhere we
use the name, if it is if the request is going across the internet, it has need to be resolved.

So, the domain resolver that every particular domain sub domain can have will have a
DNS server, which basically resolve this when the request go to the DNS query it resolve
it right, and it goes it sends back the resulting. There is a concept of inverse DNS where
if you give the IP it returns that domain of the things, it may be required for authenticate
or see the authority of a particular domain. So, with this, let us conclude our discussion
today we will continue on this particular topic or basically on application layer for one or
two more lectures.

Thank you.

147
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 07
Application Layer – III (Client Server, FTP)

Hello, we will continue our discussion on Computer Networks and Internet Protocols.
We were discussing on Application Layer protocol or different protocols, which are
prominent in the application layer and today’s discussion will be primarily on FTP or, but
before that we will have a quick overview of the client server system, right. Now this
client server paradigm is I believe that well known to all of us, but it is for the sake of
understanding, we will relook at the thing. Now this is a as we understand this client
server paradigm is a predominant paradigm in our for application different application
running over the internet. It helps us two application talking to each other across the
network, right.

So, what is the basic philosophy? So, there is a server program and corresponding client
program right, like we know that there should be if I am doing FTP, there should be a
FTP server and corresponding FTP client. Similarly, if I am doing a say telnet. So, there
should be a telnet server and there should be a telnet client and like this, right, the server
and client can be on the same machine or in the different machine.

So, if it is a different machine, then the client server needs to know that the client needs
to know where the server is and make a connection before establish a connection before
the communication going on. So, what we are trying to at done at the basic at the
underlying level we have some applications which will work over the network. And
basically rely on this network typically TCP/IP or OSI or network models and the
application can run over the this network, right. So, later on in this course, we will look
at some other things like web services, service-oriented architecture, but the predominant
application layer processing or what we say application layer communication is will be
done, we will be seeing the client server model.

148
(Refer Slide Time: 02:38)

So, standard model for developing network application; so, as we are discussing and
notion of client server a server is a process that is offering some service, right, as we
normally know. And a notion of a client is a process that is requesting for a service, right
like if I have a print server, a print client is requesting for the service in the for the
printer, you many of you are accustomed with network level printer where over the
network, we request for that service, even these days, we are using network where means
a paradigm which is where you can connect or project something display something
using a using the underlying network, right. So, that is anything any such applications,
which is giving service has to be this is typically known as the client server. And the
request requesting process is the client process right.

Server or client may be running on the different machine or in the same same machine,
all right, if it is on the same machine or different machine, the way of handling the whole
thing remains same, server waits for the request from the client. So, in other sense, if we
look at, server is always active waiting for the request from the client to happen, like one
of the very popular paradigm is our http server, right, any document you want to access
over the internet, over the using our browser, so, what we see that “http://www say iitkgp
dot ac dot in” right.

So, there are two things that are the iitkgp server, which is which is there in somewhere
in IIT Kharagpur network or somewhere in the internet will respond back once the client

149
this type of request is there. So, this browser my typical browser or your browser is
acting as a http client and the server machine is responding to that. The server is always
waiting for a client to be request. So, it is waiting for the client to send their request and
respond accordingly, based on that the if the respond is successful and the format is
correct etc that is other part of the things, but it will respond to the nothing whereas, the
so, I have http server typically known as “httpd” or http daemon in terms of Linux or
stuff like that and I have a http client, which is http client or typically if it is http client,
we this is manifested by our standard browsers web browsers.

(Refer Slide Time: 05:15)

So, what we see there is a server and there can be multiple clients. So, immediately two
things pop up that whether the server will serve one client after another that is whether it
is a iterative server one server subcede second server, etcetera, etcetera, like that. So, it
that can be iterative server or all the servers all the clients are served together. So, I have
a concurrent server, right.

So, number of requests are being served together and the limit based on that the resource
availability etcetera the number of servers can be served together right and this whether
we will look at in couple of sites there, whether it is iterative or the concurrent based on
the application requirement right, some resources where the server is handling maybe has
to be done iterative way. So, the other things has to wait or so, some of the most of the

150
cases, it can be served concurrently like typically http servers. So, that can be served
concurrently.

(Refer Slide Time: 06:16)

So, typical scenario the server process starts on some computer system, initialize itself
and then goes to sleep waiting for the client to request, right. So, this is the thing a client
process starts as an as the client needs it either on the same system or some other system
right, sends a request to the server.

So, this is the typical scenario and whenever whether whatever the client server
paradigm things are there, that has to be the this sort of mechanism has to be there. There
can be different way of handling, some can have more than one connect connection to be
established, some single connection to be established that is protocol dependent, but
nevertheless this has to be satisfied.

151
(Refer Slide Time: 07:00)

When the server process finished providing its service to the client, the server goes back
to sleep waiting for the next client request to arrive.

So, once it is the finished, it is the it will goes back to sleep the process repeats when the
things are there, this is the very vanilla type of operation, but it describes the things how
it works.

(Refer Slide Time: 07:23)

So, as we are discussing the role of client and server processes are asymmetric, they are
not there can there are may not be symmetric and two types of servers there, one is as we

152
are discussing iterative server another category of server, what we called concurrent
server which serves concurrently and iteratively one by one.

(Refer Slide Time: 07:44)

So, iterative server used when the server process knows in advance, how long it takes to
handle each request and handle each request itself and type of things or more specifically
when there is a requirement, which goes for an iterative things. The resource allocation
should be done one after another, so that all cannot bumped into the things like I have a
some resource, some say some sort of a resource to be reserved and type of thing and I
cannot do concurrently maybe, I may have to do iteratively one by after one after another
and in most of the cases we have some estimate that how much time it will take in
working on it so, that I can have one step another. The single copy of the server runs all
the time right and a client may have to wait if the server is busy right or in this case one
server a one copy of the server or the server process is only one process.

So, it is running all the time it serves goes to the next, next, next, next. So, it is a iterative
way of handling the thing.

153
(Refer Slide Time: 08:52)

Whereas, concurrent server were used when the amount of work required to handle a
request is unknown right. So, if the concurrent server is required when the amount of
work required to handle a request is not known, right, the server starts another process to
handle each request, right. So, the server starts other process or in other sense my
requirement or my way of delivery is concurrent right, like I have a say iitkgp website or
my own website or something which I can serve concurrently. So, that is one way.

So a copy of server caters to the client requests in a dedicated fashion. So this is


important right, so a copy of the server, so what it does? It is those who are accustomed
with some sort of OS programming, there is a concept of forking right, so, forking a
child process. So, some sort of forking a child process the server fork a child process,
which goes on serving the request of that particular client and then it again comes back
and listen to the start listening to the client request, right.

So, it makes a self copy of the things which goes on serving the things as many of the
copies of the server, there can be many client requests. So as much as based on the
resource availability, the amount of the number of copies will be going on serving the
client request.

154
(Refer Slide Time: 10:23)

So, whether TCP or UDP, again, what is the requirement of the application. Before start
of communication the connection has to be established between the host, right, it can be
a connection-oriented service like FTP type of things or it can be a connectionless
service right either UDP like say DNA, sub DNA type of things where or DNAs
resolution that can be a UDP type of services based on the what the application needs,
right.

So, if you see, what we require to make a connection establish? We require 5 things, right
that IP of the server, port of the server where the server is listening, right. So, what so, if
in our terminology, what we in network terminology, what we see that what we see that
to identify a system we require IP address to identify a process in the system, we require
a port. So, IP plus port combinely defines the process of the thing as the server process.
So, I require the IP of the server and IP of the port number of the server process where it
is listening, on the other hand, I require a client IP of the client right, where the
communication is other part of the communication and the port of the client, where to
which it is the client process is communicating. So this four thing apart from that we
require that underlying protocol.

So, in most of our cases what we work on is the internet protocol is our predominant
protocol. So, it is most of the cases is the IP protocol which, but nevertheless it defines
that thing this combination. Now if it is the same machine the IP will be same. So, server

155
IP, client IP will be same, but nevertheless the port number will not be same even the
protocol is also same. So, this port will distinguish that two connection that is why as
saying that if I open up a http server, right I am requesting for I am multiple browser in
my windows open. And I am requesting say iitkgp page one and some other things say
IIT Delhi something IIT Chennai, IIT Madras and type of things and, but it is not like
that request of these we will go to the thing, right. So, they are in they are these five tuple
distinguishes stuff distinguishes every connection or defines every connections. Now so
what we require to develop a network application. So, at the data link layer we require
ethernet at the network layer we require IP.

(Refer Slide Time: 13:05)

At the transport layer use of TCP or UDP and there is a concept of Berkeley socket, we
will do some socket level programming at some part of this course show you that how
things works, but nevertheless there is a Berkeley socket interface.

156
(Refer Slide Time: 13:24)

So, socket is a, what we can say it is a methodology or a mechanism by which inter


process communication or IPC works, right. So, its a mechanism by which this inter
process communication works, it is used to allow one process to speak to another on
same or different machine, right. So, what we say, that I establish a socket between these
two processes and this IPC or Inter Process Communication works over this socket or
those who are or all of you have some working experience on C or type of languages. So,
what you see that if you open a file in a C language what we require a file ID to
communicate right rest of the things right here also I get a socket id. So, I establish a
comm communication like using this over five tuple to be satisfied. And once that is
done, I have that socket id which allows me to transfer traffic, transfer the data over the
things, right. So, it is used to allow the process to speak to one another same or different
machine some analogy like telephone is used to allow one person to another in that that
is a very straightforward analogy that it allows to this, but socket gives me a mechanism
or method to have this IPC or inter process communication to happen, right. So, in order
to establish a socket; so, what we do I the socket the socket mechanism to be supported
by the system in most of the Linux system, they are supported. So, what you require you
require a socket to be opened at the client end. So if I server end. So server opens up a
what we say some sort of a half socket, right. So, it its own IP own port and the protocol
right and wait on that port that is client to get the request. Client on its other end opens
up another half socket like its IP port and the protocol and it knows that client server IP
right, that has to be known right. If I want to do a FTP to a remote machine I need to

157
know the IP or the URL or the name of the things like you know that iiitk www dot
iitkgp ac dot in or unless you know this name then you can’t find the iitkgp page.

Now this name will not be applicable for any communication over the network right. So,
network layer understands only the IP address. So, that has to be resolved by the DNS.
So, DNS returns a IP. So, in other sense I should know the IP address in some way or
other of the destination. So, the client sends a say some sort of a connection request to
the server server on things, if it is find the format, etcetera everything protocol wise
matching, then establishes this 5 tuple. And that establishes a socket between these two
client server client and server. Using this socket id the rest of the communication goes on
like data transfer and others, etcetera, both way, etcetera.

(Refer Slide Time: 16:49)

So, when two process located on the same machine to communicate we defined a
association defined a association and a socket. So, these are the as we have discussed, so
which will have a protocol, IP local IP, or I say client IP client port server, IP server port.

158
(Refer Slide Time: 17:06)

So, a typically also called a half association as we are discussing that at the things. So,
protocol local IP local port or protocol client IP client port or protocol remote there is
server IP server port and it once that communication path is there established and the
goes on. So, that is in some sense defines that how this client server protocol works.

And all of our discussion what you are working on like most of the protocols are client
server based as of now right, so one of the protocol very predominant protocol is the FTP
we are mostly used to that. So, it has a

(Refer Slide Time: 17:48).

159
So, what it facilitates transfer of files over network, it is a client server model often
works with TCP or connection-oriented reliable service and also telnet protocol. The
definition or the spec of the FTP is defined in RFC959 those who are interested can look
into those RFCs, RFC.

(Refer Slide Time: 18:12)

So, a FTP uses TCP at the transport layer. So, it is the application layer down the layer
down layer is the transport is the TCP to provide reliable end to end connections and
implements two type of connection managing the data transfer.

So, first of all it uses TCP layer in the transport mode and then it implements two
connection. So, one for control and one for data, we’ll come to that. The TCP client
initiates the first connection, referred to as control connection right on well known port
21. So, that initial connection is the port, it is it is on this port that the FTP server listens
for the accepts of the new connection, so that means, FTP server if my linux time I say
ftpd it once it initializes, or in other our socket terms makes a half socket and listens to
that port 21, is any FTP requests there? sort of thing and the FTP client coming out from
any port, it does not matter and then hits to that particular server at port 21, right. So, it is
the default port of port 21.

So, when you give FTP by default, it knows that it goes to port 21 if you want to change
the port 21 to some other port at the server end, if you have changed then the that
particular port to be the connection request should come to that particular port suppose

160
the port is instead of 21, it is say something 8 8 8 8 or something right. So, it has to be
equal on 8 8 8 8. So, that it says that you go for that service at that particular port, but
anyway without going to that complicacies we see that its port 21 is the default port. The
control correction is used for all control commands a client server uses to log on to the
server, manipulates file, terminates session, etcetera, right. This is also connection across
which FTP server will send messages to the client in response to this control command,
etcetera. So, those are those are also defined in the things, we will see that some of the
popular control commands, data commands etcetera at the end of this lecture.

(Refer Slide Time: 20:20)

The second connection of the FTP is referred to the data connection. So, typically the
data connection is established at port 20.

So, 21 is the control port 20 is the data connection; however, depending on how the how
the data connection is established, both the client server might be might use ephemeral
ports. So, that can it may happen that 21 is the control panel, but the data client server
can agree upon to use a the some other ephemeral port for that things. FTP transfers data
over the data connection. FTP only opens a data connection, when the client issues a
command requiring a data transfer, right such as request to retrieve a file or list the list of
files, etcetera, different kinds we will again we will has a has mentioning I will see will I
will show you some standard commands anyway those are things available in any book
or any over the network, but nevertheless we will popular commands data, data transfer

161
commands also, we will show you. The data connection is unilateral - file can transfer
data only from client to server or from server to client or not both. So, that is one way
either this or this. So, it is not the both can cannot go simultaneously, right, the data
connection can be initiated either by the client or the server the data connection initiated
by the server are active, while those initiated by the client are called passive, right. So, it
can be initiated by the both the things and the connection established by the server are
called active connections or the initiated by the client are passive.

(Refer Slide Time: 21:59)

So, if we look at the basic operations so, it is a client server model. So, it is based on
what; we have discussed at the initial part of this lecture. So, connection is control
connection is typically port 21 uses to send and receive FTP commands. Data connection
is typically port 20 used to upload and download files right, process the data transfer
process two type of things are processes are there, one is the data transfer process or let
us refer it as DTP, establishes the connection and managing the data channel. Another
what we say protocol interpreter or pi, right. So, interprets the protocol let us let DDP be
controlled using command received from the control channel. So, the one is protocol
interpreter to interprets the protocol and the DTPA data transfer protocol uses the
command to transfer the files.

162
(Refer Slide Time: 22:59)

So, again to continue with the basic operation.

So, to as we had discussed there are two mode; one is active mode control connection
port client, there are large port numbers server at port 21, data communication port is at
the client is N plus 1 server is port 20, right. So, this is the in active mode in the passive
mode control connection port. So, client a large port number should be more than 1023
and server is port 21 data connection client is again N plus 1 server, large port number of
any greater than 1023; that it means that not those reserved port or restricted port.

So, file transfer mode can be either ASCII that is txt, html and etcetera, etcetera or it can
be binary like doc, pdf, some media file so on. So, you need to define I can define that
the type of things whether it is ASCII or binary or bin can be defined and can be
transferred.

163
(Refer Slide Time: 24:00)

So, the same thing if we try to look at that the client FTP is build with a protocol
interpreter, a data transfer process and a user interface. So, if you if you have your FTP
client like there are very there are several open source client. So, you it has a user
interface and underlying it has a protocol interpreter and a data transfer process or PI and
TTF, right a DTP data transfer process.

So, what it does at the server end also there is a protocol interpreter and DTP. So, it one
is for the control connection, one is the data connection and we have two file system
right, at the client side one file system and also server sign two file system. So, either file
data can be transfer from here to here or other way, but we have two file system. So, at
the client end, client has a user interface to do that right, there are command line things
also those who are accustomed can do FTP connection and do the commands at the basic
at the at the command line.

164
(Refer Slide Time: 25:11)

So, FTP clients user interface communicates with the protocol interpreter which manages
the control connection the same thing, PI translate any application specific command to
the RFC architect FTP command. So, that there is a application specific command, so it
should be RFC architect FTP command it has to be there otherwise the server side will
not understand or the same thing true for server to client side. So processes command
and then communicates these control commands to the server end. The FTP server PI
receives this command and then initiates the appropriate processes to receive to service
the client request right. If the request require the transfer of data if there is a data transfer
involved, the data management is performed by this DTPs, right both the end and both
the client server applications, right.

So, first the PIs PI will take care of that control connection established and if there is a
data transfer involved then the DTPs will come into play. After the completion of the
data transfer the data connection is closed, control is returned to the PIs of the client and
server applications and only one data transfer can occur at each connection if multiple
data transfer are required on a single FTP session, one distinct control connection will be
opened for each transfer right, either, it can be managed at the upper level that going on
doing that at the or user interface or the FTP client program takes care all the individual
data connection has to be established right for the each data transfer.

165
(Refer Slide Time: 26:55)

So, if you look at the user perspective. So, what is the user perspective connect to the
remote host, navigate and manipulate the directory structure right. I can go to the
directory structure of the remote host or there if there is a permission is there, I can
manipulate. List files available for transfer. Define the transfer mode, transfer type and
data structure right, once I want to transfer. Transfer data to and from the remote host.
So, either it can be from to client to the server or server to the client. Disconnect the
remote host whenever the whenever the work is over. So, that they can be the typical
way of looking at it.

(Refer Slide Time: 27:39)

166
So, this is a typical scenario say workstation FTP client equates to a FTP server. So, it log
on to the FTP server navigate to the correct remote directory right to where the data is
there, specify the file type that what sort of file is there, send that means, whether you
will require binary, ASCII and type of things, send the file, put that is the data if I want to
retrieve file, then get process, then terminate the session by quitting it.

So, this is a typical way of looking at it when I put some data from this local host to this
remote host or where it acts as a FTP client and this is a FTP server.

(Refer Slide Time: 28:24)

So, there is another concept called TFTP. So, it is I thought that it would be good to
know. So, it is a for known as trivial FTP protocol. So, it is a low payload FTP protocol,
right. So, typically widely used in say you want to upload a configuration file in a router
or network device and type of things, where much resource are not enabled, this TFTP
plays a important role, this simplistic approach has many benefits over traditional FTP as
because it is a very simple vanilla approach to the things used by diskless devices to
download firmware at boot time, right. So, diskless devices used by any automated
process for which the assignment of a user idea password is not feasible; that means,
there are that is that much resource is not there, small application size allowing it to be
implemented in various devices right, various low resource devices and in environmental
resource there is resource requirement is not is much layer or lace or constrained

167
resource requirement TFTP is implemented on the top of the UDP user datagram
protocol.

This is interesting right, FTP is typically over TCP, TFTP is typically over UDP, that it is
not reliable transfer. The TFTP client, initially send retry request through the well known
port 69. So, it is not that our port 21 like that. The server and the client then determine
the port that will use for the rest of the connection. So, initially that request 69 and then
agreed upon a thing. TFTP lacks most of the features of FTP and instead, it is limited
only reading a file from a server or writing a file to a server. So, it is more of a updating
or reading or updating the server. TFTP has no provision for user authentication in that
respect it is insecure protocol, but the the places or the, but the situation where we use,
we it plays the important role like up updating a firmware and those things where I can
ensure security by different mechanisms, right, I that compromising that channel may be
more difficult, because there may not be external connection like that and other things.

(Refer Slide Time: 30:46)

Then we have some quickly go to some commands these are available in the books these
are these are taken from different sources including books. And what I thought that it will
be these are the typical command it will be good. So, USER, PASS, ACCT, etcetera like
user information, password, account information, re-initialization, logout, aborting,
previous commands are some of the access commands.

168
(Refer Slide Time: 31:09)

Some of the file management command like CWD change to another directory or delete
to delete a file or MKD making it directory and so and so forth. So, these are some of the
commands which are file management command.

(Refer Slide Time: 31:36)

These are some of the data formatting commands as we are discussing TYPE to define
whether it is ASCII or FD or what sort of file is there it STRUCTURE whether it is a file
or record or page MODE whether it is stream block or compress mode and type of

169
things. So, these are all definitions, you can define which are related to the data
formatting.

(Refer Slide Time: 31:48)

And there are file transfer command like RETR, retrieve files, STOR store files and so
and so forth, right.

So, there are several sets of transfer file there is a command called STAT to return the
status status of that set of files. So, with this what we see a in this particular today’s
lecture, we primarily discusses that how what is the basic philosophy of client server, we
just introduced there socket program, we’ll in some of the subsequent lectures or some of
the session, we will try to will show you some how this programming can work and how
we can write your own network label programs into using this socket.

So, that we will, so we discussed about FTP, one of the very predominant application
layer protocol used for primarily for transferring data, uses two ports one for control and
the data port and also another variant of FTP, which is a low payload FTP or TFTP,
which is used for several firmware updates and other configuration updates in devices
with constrained resources. So, with this let us stop let us stop our today’s discussion.

Thank you.

170
Computer Networks and Internet Protocol
Prof. Soumya Kanti Gosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 08
Application Layer – IV ( HTTP, HTML, TELNET )

Hello. So, we will continue our discussion on Computer Networks and Internet
Protocols. So, we are discussing primarily on Application Layer Protocols and which
today we will be primarily focusing on HTTP, HTML and TELNET. Though HTML is
not a protocol it is a language but it comes hence in an with HTTP. So, I thought that it
will be good to talk about little brief about HTML. Most of you may be already familiar
with HTML but to for the sake of completeness, we will have a quick discussion on
HTML protocol, right.

So, what we have seen in previous lectures? So, it is primarily a client server model
where the server is active on some system on a particular port of the system, right; like a
server program is active on a particular port and the client from other system or from the
same system request the server for that service, right. So, primarily, in any client this
type of client server paradigm, we require this five element or five tuple to be there, one
is that server IP, server port, client IP, client port and this protocol number or protocol ID,
right.

So, this five will be there. Any of them is different will give a unique type of
connectivity. That’s why, even if you open up number of pages by the same browser,
from the same server, it is it is not the it never happens that one page, you request a page
for one, like see one particular link, you click in one browser and the it comes up in the
other browser, right. So, it is the, is the this five tuple decides that how the whole
uniqueness of the connectivity. One thing to be remembered that this can be anywhere in
the things, the overall networking paradigm takes care of the thing, right.

So, some of the, some of the communication is connection-oriented, so or some sort of a


TCP type of protocols are there and some of the things are connectionless or UDP type of
protocols are there. The beauty of this layer or the layering technique is that every layer
basically concerned with the functionality of its peer at that layer only, right. So, rest of
the things that taken care by the underlying layers to be there like, if I have n layer in

171
which it do not support reliable service, but the so, I need to have a other mechanism to
take care at the upper layer etcetera to have a reliability, etcetera. So, any way that is a
layer to layer phenomenon, the peers talk at the layer at the that phenomenon only, right.

So, if we look at our HTTP type of protocol, then what we see it is a Hypertext Transfer
Protocol allows primarily allows web document to be communicated over the network.
And in doing so, what we get realized in a in a sense, it is the basic foundation to for the
realization of this dub dub dub www world wide web. So, the whole World Wide Web is
one of the predominant things which is, which makes it happening is this HTTP protocol.

So, HTTP protocol that supports communication between the web browser and the web
server, so here we say HTTP server and the HTTP browser, right or in other sense, HTTP
browser are clients right like our Internet Explorer or Mozilla or Chrome or anything,
any browser which are a primarily HTTP client and the HTTP server as the other end of
the thing. It can be in the same machine, can be in the same network, can be in a different
network, different machine and anything right. The only thing is that it should have some
sort of connectivity between the thing.

So, a web browser is a typically known as a is referred as a HTTP server or rather HTTP
server is referred to as web browser whereas HTTP client is synonymous, more
synonymous with the sorry, web server is a HTTP server and the web browser is the
HTTP client. And we predominantly we are having two version; one is the HTTP 1.0 that
is RFC 1945 specified.

172
(Refer Slide Time: 04:59)

So, if you if those who are interested, can open up the RFC and see that how this
definition is there and RFC 2616 which is the HTTP 1.1, right rather HTTP version 1.1
specifies a persistent connectivity by default otherwise, the connectivity are not
persistent.

(Refer Slide Time: 05:18)

So, HTTP is a application-level protocol with the lightness and speed necessary for
distributed hyper media information system. Now, one thing we need to keep in mind
that in that when we are when we are exchanging information or data over across the

173
across the network, it need to be light weight so that I can have, first of all the
characteristics is distributed, I heterogeneous systems are storing the data and there is a
constrained on the bandwidth or the at the backbone bandwidth.

So, in order to address that, what it requires the lightness and for the speed necessary for
distribution hypertext information, why this hypermedia type of information? See I
should have in some generic way of representation so that it can inter operate easily,
right. I do not have any control like you do not have any control that how HTML, how
the data is stored in IIT Kharagpur website or a web server, right. Similarly, in your
organization web server, we do not have any control or the other people.

So, but to when I am keeping in something web server at IIT KGP, that the basic idea is
to distribute the data, right. It is not for only for my consumption, but the rest of the
world what I want to show need to see it. In order to achieve these, there should be a
some sort of formatting where easily which is easily parsable which we can interrupt,
interpret or parse in a much easier way. So, this HTTP gives a basis for that, its a
protocol which supports that. So and it is transport independence, transport independence
means underlying transport layer independence.

Though it is generally take place over TCP connection, HTTP comes by default with the
TCP connection. However, protocol itself do not depend in on the specific transport layer
when the protocol itself is not specify that this transport layer is this transport layer is
mandatory etcetera, but the predominant protocol, predominant underlying protocol or
by default what we consider that the there is a connection-oriented or TCP type of
connection is there at the transport layer, right. So, that HTTP tries to the - HTTP takes
care is basically work over this any transport layer but primarily TCP is the predominant
protocol.

174
(Refer Slide Time: 08:02)

So, its as a simple structure. It says a client sends a request, server returns a reply right.
So, it is a very vanilla type of tracker request response thing, HTTP can support multiple
request reply exchanges over a single TCP connection right. Like if I have a underlying
one transport layer connection, HTTP can support multiple request respond exchanges
over a particular connection.

The well known port for the HTTP is port 80, right. So, the by default if you do not
specify anything, the port is port 80 right, but other ports can be used. So, if you again
come back to the thing, like whenever you say, when we type key in into the browser say
“www iit kgp dot ac dot in” or say “www nptel” or say “nptel dot iitm dot ac dot in” or
something, “nptel dot iit kgp ac dot in”, so what the this browser or the client does? It at
the underlying, it has to because it is a name cannot be communicated. So the first of all
the name is converted to the as a IP address, right and by default as you don’t specify
anything, by default it will take port 80 as the port right, otherwise, you need to specify
the port like you have to specify xyz dot com colon say port 7126; that means, you are
specifying that it hit to that port. By default, as the as the HTTP server this is to port 80.
So, it is the default port, other ports can also be very well used.

So, overall architecture as it is a basis for www. So its a distributed if you look at the
World Wide Web, it is a distributed client server service, in which HTTP client browser

175
can access a service by from a HTTP server, right. So, it is a HTTP client server service.
So, there are client so, who are the parties?

(Refer Slide Time: 10:09)

Client, Server, there is a URL or Uniform Resource Locator and there are Cookies, right.
Cookies as you there is primarily to remember your previous data or it helps in a
maintaining your session but primarily, what you say we require a URL for connectivity,
a client or a browser for request and server for responding.

(Refer Slide Time: 10:32)

176
So, if you look at the thing, so that the client is sending request for a particular site,
getting a web page back, it may have link for other web page to connectivity, it gets this
back. So, it this way it goes on referring to the web pages, right. So, this is typically and
it can be any type of number of connectivity, etcetera.

(Refer Slide Time: 11:00)

So, if we look at little bit on the browser point of view, so what at the browser end, what
it is having? It is having a controller which is which can have different type of protocol
to support right like HTTP, FTP, TELNET, SMTP and type of things and if it is the
controller hits, if it is a normal HTML page or static page type of things, it goes and get
the things, there can be JavaScript where you where you which you which is a
dynamicity brings into the things or there are other Java programs the Java is one of the
thing. So, that what we say that you can, you can have program level or some sort of a
API level things, right.

So, this one is that you request for a page you get the page, one you run the thing at the
server site, you run something and the client site the reflection is there right, like say I
send a roll number, get the rank. I send a particular bank account number, get some status
report of the things. So, that can be one way of looking at that, there can be other things
like some sort of a things which can be need to be checked at the client end, like I enter a
roll number: typically, say roll number is a only numeric character, numeric you need to

177
enter the numeric but instead if you enter a character set or say puts a character, it says
that it is a invalid thing.

So, there is that that I can do at the client end, no need of bringing this whole thing to the
server, check it and flash it back. So, that I can have a client side scripting or server side
scripting, those things are supported by the HTTP protocol.

(Refer Slide Time: 12:42)

And URL as we all know, it is a protocol like if it is a HTTP colon name or IP again
colon port slash the path where you want to access; like if that is not by default if it is a
port 80, then the port is not required, right. So, it can be HTTP, it can be FTP right;
anything any protocol which support this type of thing. So it is a Unified Resource
Locator or uniform resource locator and we this is the overall structure, this is already
known to us. If your HTTP protocol HTTP server is running in some other port, you give
the port number.

178
(Refer Slide Time: 13:23)

So, typically web document can be grouped into three broad categories right, one is
static, you request and get the page; one is dynamic, you request get something executed
and get the page; one is active which is on the on your side of the browser, where you
say some checking, authentication, some processing at the browser end. Like static page,
you request and get the static page there.

(Refer Slide Time: 13:47)

179
(Refer Slide Time: 13:55)

In case of like one common, in case of dynamic, we have a concept of Common


Gateway Interface or CGI. So, through that I can have a request and based on that, the
HTML page dynamic HTML page is written right. In the static page, say I request for a
for something and I get the list of I get a static page of the list of students roll number
verses the name released. In the in case of a dynamic page, I send a request with a
student roll number say and get a data related to the student roll number back to me as a
HTML document right. If the student roll number changes, this document also changes
right. So, that is a dynamicity is there. In other sense, there should be some program
running at the other end, right. Based on your request, it execute and generate a
dynamically a page and returns back. So, that is the dynamicity on the things. One of the,
one of the very popular technique is using the Common Gateway Interface or CGI or
CGI programming some of you might have done.

180
(Refer Slide Time: 15:05)

So, dynamic document also sometimes that we refer as a server side scripting right; so
runs a script inside the HTML document which execute the thing and generate the
generate the dynamic HTML thing. So, that is at the server end, so server side script.

(Refer Slide Time: 15:26)

Similarly, there can be active document which are at the client side or what we say it is a
client side script right. So, I can run a Java applet at the client side and it gets executed, I
request for the thing, it returns a applet and the applet goes on being executed at the

181
client side, right. So, this sort of things it is a also active document, not a static one based
on your request the applet comes is returned back and it goes on executing.

(Refer Slide Time: 16:07)

So, this is also, it is also a active page or dynamicity here or I can have a instead a
JavaScript which will be executed here right. It can be used for some basic level
authentication say whether it is a valid character set or some sort of a those type of things
which can be done at the scripting at the client end without transferring the thing. So we
have this server side scripts which, sorry client side scripts and when you do that when
you say that active documents, right.

So, whenever we are running on something on the server client side is active document,
it is referred as active document. When you are running something at the server side and
the dynamic HTML comes back its a dynamic and if it is nothing is there, you request for
a page, get the output and get the page displayed on the screen and its a static page then
we have a static document.

182
(Refer Slide Time: 17:05)

So, coming back to the thing, so what we have HTTP is a request response thing. So,
again, let me little bit repeat it. So, server is running a HTTP server, typically we refer
this as HTTPD, HTTP daemon right. It is running at the server. Client is the sending a
HTTP client request right. In our cases, it is mostly the browser.

So browser construct the data and send it to the thing and the server response back to the
thing. So the transaction is pretty simple. Every request get a response to the thing.
Typically, this is typically HTTP request response are stateless, that it will not remember
what happened in the earlier state, right. In order to do that, we need to do some other
things to handle that. Anyway, though what at the present we send a request, get a return
back.

183
(Refer Slide Time: 18:09)

So, HTTP Request Response Messages, so what we have? This is again very a standard
format. We have a Request line, a set of Headers, a blank line and the body of the thing.
It may be possible that the body may not be always present in the in the message. In the
in case of a response message, again it has a status line that based on the request, what is
the status line, a set of header lines, blank line and the body of the message right. Again
there can be, there may be possibilities that there may not be message on the thing. So,
this is the basic block of the things but it what are the different type of request, responses
or what are the different type of comments, status reports etcetera, that we will see
slowly.

184
(Refer Slide Time: 19:05)

So, if you say the request and status line, so what we have? The request type, the URL
where the request is there and the HTTP version where which is being used. Similarly,
for the status thing, we have that HTTP version, status code and the status phrase of the
thing. So, particular status code like say 200 is OK, for successful type of status code and
then like that. So it comes to the thing like if you had 404 or 4xx error, those are
primarily error status.

(Refer Slide Time: 19:48)

185
So, there are different HTTP methods. One is say GET method, which request a
document from the server, there is a HEAD method, requests information about a
document but not the document itself right. POST method, sends some information from
the client to the server, PUT sends a document from the server to the client, TRACE
echoes incoming request, CONNECT is reserved method and OPTION that inquires
about the available options.

So, there are different set of methods right, we are discussing some. So, primarily more
popular are Get, Head, Post, Put, these are the most popular widely used, not popular I
should say others are also there etcetera.

(Refer Slide Time: 20:41)

Similarly, if you look at the status code, 100 is a code of continue type of things that the
initial part of the request has been received, the client may continue with the request, this
is the status code. 101 is the switching, the server is complying with a client request to
switch protocols defined in the upgrade header, there are status code of 2xx series that is
200, that is OK, the request is successful; 201 that is created; 202 accepted, the request is
accepted but it is immediately not immediately acted on and 204 no content, that means,
there is no content in the body, right.

186
(Refer Slide Time: 21:29)

So, there is that say that there is no content in the body.

And there are more status report that is 3xx series; primarily moved, permanently or
moved temporarily or not modified this type of things, 4xx series are primarily, so 3xx
series are redirection. So, here what we have seen, 1xx series is informal, informational,
it gives information, it is more for informational purpose; 2xx is mostly reporting
success; 3xx is redirection, so it is any redirection of the page or change or somewhere;
4xx is the client error or the whatever the client sides error that bad request, unauthorized
request, forbidden, not found, methods not allow allowed, not acceptable and these are
set of requests which are at the client error whereas, server errors are 5xx series that
internal server error, not implemented, service unavailable. So, these are all server side
error. So there are client side errors, server side error.

So everything has a status code and if you minutely check that whenever it keeps you
whether accept the, you mostly see this sort of error by that you can decipher that; one is
404 is the most what we say mostly most seen error type of thing that the document not
found type sort of error.

187
(Refer Slide Time: 22:59)

So, if we look at the HTTP header, header name colon a space and the header value. So,
header are different type of header like one is Cache control specify informational
information about the cache caching; Connection shows whether the connections would
be closed or not; Date, current date; MIME upgrade and so and so.

(Refer Slide Time: 23:23)

And there are this, this are mostly request type of header like these are set of request type
of request header. So, what we have seen request header and the response or status
header. So, these are the set of the request header: Accept, Accept-charset, Accept-

188
encoding and so and so forth. So, these are more in detail if you want to look at, those
who are interested look need to be looked into the any standard book or RFC maybe a
good place a look at.

(Refer Slide Time: 23:55)

So, there are response header like Accept-range, Age shows the age of the document,
Public shows the supported list of methods, Retry after specify the date after which the
server is available, Server shows the server name and version number and like that. So
these are different response headers.

(Refer Slide Time: 24:15)

189
So, HTTP Entity headers, so allow say allow the list of valid methods, content encoding,
so these are more related to the entity right. So, that is content length, content range,
content type, when it expires, last modified date, location specifies the location of the
created or modified document. So these are the different entity headers.

(Refer Slide Time: 24:46)

So what we see, it is a rich collection or rich set of commands or control is there. So it


that is why it is able to handle a variety of say media or the variety of data or the variety
of information across the across the www. And we need to also keep in mind that there
are data are stored in a heterogeneous version in across the network and every data has
their own payload or data load which takes time to the thing. HTTP has it is own say
timing issues like how long, suppose I request a particular page, how long I should wait
the page will come right. So, that is a that there is a timeout thing also is there. So
keeping in mind so, in the overall management of this type of distributed and loosely
coupled system, you need to have lot of flags and what we say so called headers and
other informations to handle that.

The example here, a example again from that book that example retrieves a document,
we get a get method to retrieve an image with a path slash usr slash bin slash image 1.
The request line shows the method get and thing.

190
(Refer Slide Time: 26:20)

So, if we come to the example, so this is the request to get method HTTP version 1
accept it is looking for a image and accept this image type of things. If you look at the
header thing, so accept, so the medium format the client can accept, right. So, that it
shows that what are the format it can accept right, it is a image of gif type or image of
jpeg type and the at the other end, it gives a status of 200 that if you remember that the
success header, then the date server is what sort of server, what sort of MIME version is
there how much content length is there and the body of the document right. So, this is the
way request comes. So, if you if you expand the HTTP, it will be looking like that.

(Refer Slide Time: 27:06)

191
Similarly, in another example, so this is a request and this example it is a post, right
where in this example, a client want to send a data to the server. Use post method, the
request line shows the POST, URL and HTTP version 1. There are four lines of the
header. The request body contains the information and so and so, what we see? So, it is a
posting something against the image type, some data and the code either g for jpeg and it
is content is some content length is there; on the other side, the server replies with 200
OK and it is the type of things it is able to handle it is showing, right.

So, it is a response message contains the status line and the four lines of the header, the
created document which is a CGI document that is if you remember a Common Gate
Way Interface document and is included as the in the body of the thing, right. So, it
comes as a request message as is as encoded as a CGI document for the body of the
message.

(Refer Slide Time: 28:12)

Now, just to look at that connecting HTTP server using I can have a TELNET also, right.
TELNET will see subsequently, it is primarily used to connect to some other remote
login type of situation but I can have TELNET, the name of the things it is that I can
have TELNET www mhhe dot com dot 80, right. So it will hit and try to retrieve,
provided that if it is not blocked that the particular TELNET function etcetera but it that
will retrieve back. So, what we mean to say that underlying, I can use some other
protocol at that particular port and if the HTTP server or the server which is listening at

192
the port is responding to the request, it will respond right. In this case, it gets a I a after
doing that I give a get message of a something, this is actually from that data
communication of the Forouzan book.

So, that is the examples on there. And the server in also it responded, we 200 and so and
so forth, right. So, what we see here that it is it is the server which is listening at port 80
in this case. It could have been in other port also, accept that message and respond it
back to the thing and its a, I am sending an HTTP sort of request through a other protocol
that is a TELNET protocol, right. So, this is feasible right.

So, what we see a HTTP is a hyper text transfer protocol where a server side that at the
server is listening to a particular port and the client or client or the clients knows that
which where is the IP and the port of the things. Whenever it wants to connect to the
thing, connect to that particular port and get the result, and based on the things that can
be different type of status right, it can be it mostly it is successful, otherwise if the error
is there, so there should be a error flagging and so and so forth.

And get displayed on the things; another part if you see, it is a it is, it can handle
different type of media. It can handle text, it can handle your different version on the
thing, it can handle image, it can handle video, it can handle voice. So, it is a some sort
of a, it can handle any hyper media type of thing but as the as the communication or the
formatting is in a particular generic format, so it is able to that at the client or the browser
able to accept it.

So, that that’s the beauty of this HTTP which can access across the across the over the
internet. So with this, let us conclude here and we’ll be discussing little bit on HTML and
other TELNET in the subsequent lecture.

Thank you.

193
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 09
Application Layer – IV (HTTP, HTML, TELNET) ( Contd. )

Hello. So, we will continue our discussion on HTTP, HTML and TELNET. So, as you
have as we have seen that that HTTP clients are it works on a client server mode. So,
HTTP client typically browsers will request to the HTTP server which are web server.
And it will reflect it will basically respond the web document to the things right. So, this
documents are typically in a formatted in a in a hypertext markup language right. So, this
is a structured language which allows a parser or HTTP which is there in the HTTP
browser to look at the document and appropriately display the document on the screen
right.

So, what we will do as these days HTML are taught a from the school days itself. So, I
believe that most of you have some knowledge on the HTML, but what we’ll we do, we
will do we will look at a quickly at that different aspects of this HTML document right.
So, before that one thing I thought of mentioning which might have missed in the
previous lecture that is this a concept of HTTP proxy right. So, this is interesting we will
revisit some time at the latter of the thing while look at the things.

(Refer Slide Time: 01:41)

194
Just to have before going to the HTML, so there is a concept of HTTP proxy server or
proxy. So, what it does it proxies for the HTTP server right. So, there are different aspect
of it right. So, it can it can catch something, it can even do some sort of a filtering
operations that who will be allowed, which type of data it can log data and type of thing.
So, there is an intermediate server which access a proxy server. So, there are different set
of proxy server just to mention that there is a this thing called HTTP proxy right. So, we
will come to that in a later stage when we will discussed on a on proxy severs.

(Refer Slide Time: 02:23)

Now, the HTML stands for hypertext markup language, it is a computer language used to
create web pages right. And many of us have tried our hand, but these days lot of tools
are available. So, mostly we are not doing directly HTML coding, but using some tools
to code that. Tags tell the web browser how to display a page right, the tag tells a web
browser how to display a page. Can have either htm or star html extension. So, the page
can be dot html or htm. So, this there are it is a tag language right. Tag means it I will see
that there will be an opening tag and closing tag. And the content the tag dictates or tells
the web browser that how the page need to be displayed, and in which colour, which
format and how it need to be displayed which location and so on and so forth.

(Refer Slide Time: 03:15)

195
So, HTML elements, tags are the elements that create components of the page, tag
surrounded by a greater than and less than and greater than bracket usually come in pairs
right. So, it is there should be a start tag, and there should be a end tag. So, p slash p, so
for say tag for paragraph this is that. Stuff in between are element content right. Tags are
not case sensitive, new standard to use lower cases right.

(Refer Slide Time: 03:49)

So, like a typical HTML document should have a HTML tag of HTML and slash HTML
with source it is a HTML document. There is a header which you can give head that tag,
and header can have title and other things, there can be a body or content tag.

196
(Refer Slide Time: 04:09)

Right like what we see here like these are document type definitions which is in that
DTD which defines that what are the things can be defined in HTML. And if you look at
that HTML, HTML are the container of the whole document. Header is the title of the
page right body of the content of the page. So, it comes up like this.

(Refer Slide Time: 04:35)

Like if we look at the IITKgp page. So, here if you see that is a particular title of the
page is being displayed like which Indian Institute of Technology Kharagpur and type of

197
things right. So, the finally, the thing which is displayed by the browser is a HTML,
some form of a HTML page.

(Refer Slide Time: 04:54)

So, there are different tags it is first of all not possible to discuss all the tags and it may
not be necessary also. So, those who are working on writing HTML should refer a book
or web document some web documents to write things. So, and there are different good
tutorial one that is the one of www consortium or w3 schools are excellent tutorials are
there to for beginners to look at it. So, some popular tags are mostly used one is the
heading. So, you can have different level of headings like a in word document (Refer
Time: 05:36) and there are paragraph insert a line in between and before the a paragraph.

(Refer Slide Time: 05:41)

198
Like here are different types of headings. Similarly, we can have different type of
paragraphs also.

(Refer Slide Time: 05:48)

There are other tags which are interesting what we say link tag right. So, one document
linking to other and type of those. So, three types of link. Link to a page of the same
folder right, you can link to the same folder; link to a page of a different folder; and link
outside the web page on the internet. So, it can be in the same folder the link is there. So,
it can be some data to be popped up or image etcetera. And something in a different
folder, so that link, but within that page or something can be totally outside the page
domain itself.

199
(Refer Slide Time: 06:23)

So, similarly it is like a if I have that link a href www IITKgp ac dot in then go to
IITKgp home page, so I can have this sort of a linking to the things. So, two component,
one is the address and the text describing the component. So, what we see that the text
will be some sort of a hyperlink where if you click it will go to that particular page.

(Refer Slide Time: 06:49)

And we can have different things we can have image image resource tags. So, empty tag
no closing tag here. So, it is image source is the particular url. So, alternate is the
description of the image. And url the points to the location of the particular file which

200
where the file is there it points to the things. And alt describes the image on the screen
reader right. So, what is the description of the image on when we the description is given
on the thing right. So, I can have IIT Kharagpur, say main building (Refer Time: 07:26)
image or I can say something some other particular region image other type of things.

(Refer Slide Time: 07:36)

So, in this one example that same folder sample Pic dot gif document relative link; look
for image in the same folder different folder names. So, I can have slash images slash
samplePic dot gif. Either it may be same folder or in a different folder in that case I have
to specify the particular folder.

(Refer Slide Time: 07:57)

201
So, this is another thing division or section of the document. Use group of elements to
applying format or style example div color, say title of the section, say computer network
like here we have written a page. Say if I try to show you, say I open it in a note pad and
save it file save as, so I saved it on the desktop. Say I say sample HTML say 1 dot html
right. So, this is the file name I saved.

And if I go to this particular sample file where it is saved, let me just check the file
where it is OK let me save in a another folder. Open file, save as in the desktop I have a
folder called SKG sample 1 dot HTML we can save. So, now, if we go to that particular
folder then we can have those data displayed. So, let me check where the SKG say this is
the sample I opened this. Open. So, this is displays, hello from HTML that if you if we
look at we it was there right, sample page, then hello from NPTEL particular color
change in a section etcetera. So, it is getting displayed out here. So, not a good looking
page, you need to have a good aesthetic of having that page to be displayed nevertheless
you can write a very simple page just like that right.

(Refer Slide Time: 10:31)

202
.

Like it is, it will show us like it was showing like this. Similarly, I can have meet my
pages having like in this particular example page that different important links etcetera, I
can able to display those links right.

(Refer Slide Time: 10:41)

So, this is if we look at it a typical HTML document which have a title header, your
contents and so on and so forth.

(Refer Slide Time: 10:52)

203
So, here is another page where the if we write that document I can have this sort of a
document here. Again we can look at this particular thing. Say if I copy these, file save
as let me save as a html 2 dot htm, save. Go to that folder now let me go to skg and then
this is the array. So, course says personal xyz and I think something is there say there is
some error so that is showing something some wrong or things are there. So, it is more of
a other than the syntax, it is if you find it is more of a if your aesthetic sense which
makes a page more appealing and type of things. Definitely a contact content syntax
technology is there, but designing a page is more of a aesthetic of the of the person who
is designing the page, so that that the html.

(Refer Slide Time: 12:12)

204
And we can have different type of things next color text color, link color, background
color, choose font size and type of thing. So, lot of text level things are there. So, with
this we now try to look at this this covers our http and html basics. Some of the aspects
we will be revisiting rather in different cases we will be again picking up some of this
aspect. So, the next thing what we want to discuss is that another protocol which is called
TELNET. So, what we have seen protocol called DNS, http one we like to see this
protocol or FTP and this another very popular protocol for TELNET primarily used for
remotely logging in to a system. So, I can TELNET to a server to another server at a at
the other end of the network or in the same network or a different network.

(Refer Slide Time: 13:15)

So, if we look at it, so there is a telnet client and there is a telnet server. There the client
request goes the input to the things, it open ups takes the action on the things and return
it back. So, if I say that the client program is telnet, the at the server there is a telnet
server should be running. Typically what we say it is a telnet d daemon. So, something
the protocol is telnet; and the application is also telnet. Like if I say the protocol is
capital HTTP the application is small http type of things or the client is there server is
HTTP there, here also there.

(Refer Slide Time: 13:56)

205
So, just to show the thing to telnet is the protocol that provides a general bidirectional
eight bit byte-oriented communication facility. Telnet is a program that supports
TELNET protocol over TCP. So, it is a connection-oriented service. Many application
protocols are built upon the telnet protocol. So, I can build telnet as the some sort of a
piggyback on telnet and build different applications underlying it will be using the
TELNET protocol right, because it has a TCP oriented connection it is a bidirectional
connection and so forth. So, name several protocol exploits this TELNET protocol.

(Refer Slide Time: 14:38)

So, the RFCs 854 TCP connection, the popular telnet port is port 23, but I can do telnet
in other port. Like a way I have seen in the HTTP also the well known port is port 80, but

206
I can do in different port here also. Data and control are over the same connection right.
So, there is a another term comes into play while we talk about telnet is the network
virtual terminal. Intermediate representation of a generic terminal, provides a standard
language for communication of terminal control functions right. So, it is a intermediate
representation of generic terminal, provide a standard language for communication of
terminal control function, so that is a network virtual terminal.

(Refer Slide Time: 15:28)

So, like that what we see underlying TCP is there over that NVT is there, over that there
are different server processes right. So, what we have TCP, NVT server processes, and
this communicates with the server processes, client communicates with the server
process right, so that is the telnet. If I look at, it is the telnet client which is looking at the
telnet server in turn they have both have this NVT or the network virtual terminals. So,
as we have seen intermediate representation of a generic terminal, so that it shows
because telnet at the end you are trying to open up a terminal at the other end right.

So, from here you are trying to open up another terminal, work on that particular other
machines. So, this is there. Provided standard language for communication for the timer
and control function otherwise there will be lot of problem with the escape characters
and type of thing. So, it provides the things. Underlying the TCP is there, that is the
connection-oriented transport layer functionality.

(Refer Slide Time: 16:34)

207
And if you look at the TELNET server have different type of things one is the user
applications right, another is there are different server control or the control interface.
There is a access and multi-user interface right. There are there can be multiple multi-
user interface or telnet need to handle that. So, the client when it connects, it is connects
to the server and server takes care of those at the background thing.

(Refer Slide Time: 17:01)

So, there are several negotiated option that all NVT supports a minimal set of capabilities
right. So the whichever is the system and type of things, it should support a minimum set
of capability. Some terminal have more capability than the minimal set that is absolutely
no issue, but they should have a minimal set. The set of options is not a part of the telnet

208
protocol. This options are not a part of these things, so that new terminal features can be
incorporated without changing the telnet protocol. So, it TELNET protocol is more on
making this communication to happen over this net right.

So, if you are increasing option or changing the option that is without effecting the telnet
protocol. So, it detached it and gives a better interoperability. Two end points negotiate a
set of mutual acceptable options right, so line mode and verses character mode, echo
mode that whatever is there it a echoing back there is a character set EBCDIC versus
ASCII and type of thing. So, they need to the end point need to negotiate mutually on a
acceptable option; otherwise whatever you are keying in need to be transmitted and
executed to the other end that will be a serious problem on that.

(Refer Slide Time: 18:21)

There are several control function. The TELNET includes support for series of control
function commonly supported by the servers right so series of. This provides a uniform
mechanism for communication of control function. So, there is a set of control functions,
which are supported by the server. And this control functions allows this overall
communication thing to happen right.

209
(Refer Slide Time: 18:51)

So, some of the control functions are here, like one is Interrupt Process IP suspend abort
process; or abort output sends no more output to the user terminal. Are you there, some
sort of a are you alive type of things check to see if the system is still running. There is
Erase Character or EC delete last character sent right. So, there is a erase character
control function, because there may be need to delete the last character which may be
something extra character is coming into. Erase line delete all inputs in the current line
right. So, these are the things which are which are different control function a set of some
sample set of control functions of the TELNET.

(Refer Slide Time: 19:44)

210
So, all TELNET commands and control flow throw the same TCP connection. So, there
is one thing. So, there is no separate data and control connection unlike FTP right there
was port 20, 21, one is data for one is control type of things, they are the same TCP
connection. Commands starts with a special character called interpret command escape
character or IAC code. So, there is a called IAC code is typically 255. And if a 255 is
sent as data, then there should be followed by another 255 right. So, if the data itself is a
255, then it should be followed by another 255. If the IAC is found, the next byte is if a
IAC found, the next byte is IAC, a single byte is represented to application and terminal.
If IAC is followed by any other code, the TELNET layer interprets this as a command
like. So, IAC after that there is any other code the TELNET interprets as a command and
try to execute it as per the protocol for that commands or the rules for that commands.

(Refer Slide Time: 20:50)

So, you can use telnet program to play with TELNET protocol right, or to work with the
TELNET protocol. Telnet is a generic TCP/IP client right. So, it is generic TCP sorry
TCP client. Sends whatever you type on the TCP socket prints whatever comes backs to
the TCP socket, so it is a very simple and vanilla type of things useful for test testing
TCP servers. ASCII based protocols right. So, there are different TCP servers which you
can useful for testing. Even I can test say mail server. So, mail like SMTP is typically in
port 25. So, if I say telnet, some mail server, port 25, it will respond back right. So, this is
this is a mode of a I can we can roughly say it is a mode of a carrier protocol which takes

211
the things and get the commands (Refer Time: 21:49) if that particular thing is allowed in
that particular other end of the server.

So, many Unix systems have these servers running by default, like is one is echo server
which runs in port 7; there is a discard server which is in port 9; daytime server which
responds with the day time is port 13; chargen server which is at port 19. So, these are
the different servers which are different Linux systems run by default.

(Refer Slide Time: 22:20)

Like here if we do a port 7 that is echo server and give something then it responds back
like I say particular this is all fictitious thing means not mean some what we say example
scenario, telnet skg cse dot edu nothing as such nothing is there means no such server.
So, it tries to the IP and then once it is connected, then it gives that particular escape
character. And whatever you give it gives you a return it back. And then once you quit,
then it closes the connection. So, echo server is very handy to see that how whether that
particular telnet server is running or not at the other end and whether it is responding
properly. So, is a first level of cross check on the whole system.

(Refer Slide Time: 23:14)

212
So, if we look at this particular telnet scenario, so it is it is basically what we have say I
can have a telnet client and one end and the telnet server can be on the same system or in
a different system right. So what we what we do telnet to a particular server and then I
can execute some program right. I can access directly etcetera here right. I can telnet to
another server to a particular server and access the things, all provided you have the
access to that particular server, so that means, if not only the requirement of the client
telnet server, there is a requirement of authentication for that or what we say the user
should be authenticated other end. So, when we you go for when we do a telnet, it
usually replies it prompts back by a login password. So, you have a if you are having a
login password into the system, then you logged into the system and then you can
browse to the directory structure, you can execute any program and type of things right.
So, it can be within the system I can do a telnet into the within the system or I can do a
telnet to a other system right. I can do a telnet to a any system over the network right.

And once you there, the connection is established, the connection stays with that, so long
the execution is there or there is some error etcetera and you can whatever the whatever
the permission set provided at the other end is the accessibility of the client or the client
or the user right. So, if you are given access to different directories etcetera you can
access that and so and so forth so that you can do, it is as if you go as a user to that login
from a remote location, so that you can do that.

Okay, so with this let us conclude our today’s discussion. The thing what we have seen
today is two important protocol right which one is making this www to happen right. So,

213
it is the hyper HTTP or hyper text transfer protocol. And along with HTML which is the
markup languages. There are different other markup languages we’ll see some of these
things, but HTML is the most popular things and the browser any browser understand
how to interpret the HTML. So, the browser has a some sort of a HTML interpreter or a
parser, which parse the html tag and displays as per the things which is been given right.
So, this makes that whole information gateway or information all this exchange possible
over this underlying network, so that is the one thing.

Another thing what we have seen is a protocol which is which is a connection-oriented


protocol is telnet which allows to remotely connect to the things right. One is that
extracting information and display on the thing another is remotely connection to a
another server, another machine which is either in the in your own network or own
system I can telnet if the server is running from that I can telnet to the same server or in
any server in the things. It allows me to work on another system and execute the thing
right. So, this and as you have seen it is a very simple type of or very what is vanilla type
of protocol and it allows lot of things to piggy back on it.

So, telnet becomes a carrier to different thing to execute on the things, because it
established a connection connection-oriented service. And any other applications which
want to piggy back on the telnet is it is possible to do that right. And one other type of
things what will be discussing in the in the application layer protocol in our subsequent
talk is one is for this mail type of thing or SMTP type of server. And another is some sort
of a management type of server or SNMP type of server. So, with this let us conclude
today.

Thank you.

214
Computer Networks and Internet Protocol
Prof. Sawmya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 10
Application Layer - V ( SMTP, SNMP )

Hello. So, today we will discuss about two more protocol at the application level, right
SMTP and SNMP. So, we will take a overview of the this protocol. We have already
discussed FTP, HTTP, Telnet and so and so forth on our client server base. So, this case
is also. So, as any application layer protocol, they rely on underlying other layers like
transport IP etcetera, right.

So, SMTP is for transferring mail from one to another. So, mail as we all know or realize
is became a part and parcel of our life, right. Without mail it is not possible, it is
something difficult to communicate also right. So, it is now became slowly becoming
your official channel of communication and several places now official channel of
communication. Another protocol is SNMP which is mainly for management purpose.

Now, you see if you look at the overall networking, even in a small or in organizational
scale like say institute like IIT Kharagpur. There are several departments large
department which has sub networks the institute has different sub networks and several
routers etcetera. Even if we do not go outside the network itself, the internal dynamics of
the network is extremely complicated, right. And to manage this we require something to
some information to do that, right.

So, we can only it is not only when the failure is there signal is not there, but how to
manage this all this underlying network. So, this is one of the protocol which is SNMP
which gives that it helps us in collecting and acting on the informations from different
network resources. So, we will have a brief overview of these 2 protocol and before we
go to the other layer side.

215
(Refer Slide Time: 02:33)

So, simple mail transfer protocol at it stands for is something like that, we have a mail
client at one end, 2 mail client at one end. Popular SMTP server is works on its TCP, on
the basis of TCP and works on port 25, right. So, it is the port 25 where the SMTP server
is active, right. Traditionally, traditionally means what we say, default port is port 25.

So, it was protocol was originated long back with RFC 821 in 1982, then we have 822
for message formatting goal to transfer mail reliably from one thing, one say one mail
mail client to another mail client at the other end, right. Now now whenever there is a
there is a client server protocol, the server needs to listen at one port which is port 25 in
this case. So, whatever mail you are coming received by your mail server like say we
have a mail server is CAC mail server or cac dot iitkgp ac dot in or iitkgp ac dot in is the
our generic mail server here institute mail server.

So, it receives at port 25, by default if not there are other changes in there. There can be
other type of things also, like what we say there can be mail gateway security type of
things. Then we have some other configuration, but nevertheless the standard default
mail gateway is a mail server port is the port 25. So what is there the client over the
network can act with the interact with the server at port 25, right.

216
(Refer Slide Time: 04:36)

So, SMTP clients and servers have 2 major components. One is that user agent prepare
the message, encloses in envelope, like some agents the popular agents initially your
Thunderbird Eudora and you can have lot of other agents. There is a mail transfer agent,
transfer the mail across the internet right, and this is analogous to our postal system in
many way. And there is a as MTA is the client, so corresponding MTA server is there,
and there is a user agent at the other end which reads the message, right. If it is a 2-way
thing, then it can send and it access the server and so and so forth. The server things so, a
SMTP daemons would be running at the 2 end.

So, ideally what I can have? We can have 2 different mail servers things which can
communicate these mails. And we have the other users which poke into this mail server
and get the mails out of it, right. So, I have individual mailboxes like here, we are having
individual mailboxes in our say iitkgp mail server or cac server. And then we are
connecting to the server either through some sort of a directly web link, or I am pulling
that mail to some other client at the things. So we will talk about it, right. So, these are
the user agents, mail transfer agents. So, there is little bit problem in the arrow, it should
have been here, and this should have pointed here, right.

So, SMTP also allows use of relays allowing other MTAs to relay the mail right. So,
other than MTA acting as a server client, server and client it also allows MTA relay. So,
getting a mail, it is relayed to the internet to the other mail and so on and so forth, right.

217
So, mail gateway are used to mail relay prepared by their protocol other than SMTP and
convert it to the SMTP, right. So this basically it relays from one server to another. So,
the mail goes on different goes to this different relays and reach the things. So, there it
acts as a mail we have that mail gateway, which allows that mail to go to the other end of
the thing.

(Refer Slide Time: 06:58)

Now if you look at the typical format of email. So, mail is a mail is a text file envelope
that is sender address, receiver address and other information of the things. Message
there is a email header, defines the sender receiver and subject of the message and other
information and mail body contains the actual information of the message, right.

So, this is the typical thing so, mail from something mailed to the address. And there are
other details and then we have that actual context. So, we have the envelope this is the
overall message which has a header part and a body part.

218
(Refer Slide Time: 07:38)

And if you look at different SMTP keywords or if SMTP what we say that functional
modules; one is HELO: sender’s host domain name, right, MAIL FROM: email address
of the sender, Received To: email of intended recipient, DATA: body of the message and
QUIT or quitting this thing.

So, these are the standard keywords which are there in the mail under the SMTP. If you
remember we were talking about that during our HTTP discussion or HTTP lecture, that
we can use Telnet like Telnet www dot iitkgp dot ac dot in blank, 80 provided that is not
knows any security barrier. So, it will talk to that port 80 and then go on. You can set get
post and type of comment. Here also if I know the mail server and if I that is allowed that
I can connect like that. So, Telnet I can have say cac dot iit kgp ac dot in right. So, it will
return me that after authentication I can use this all, right as a MAIL FROM, Received
To, putting the data and type of things.

So, I can instead of having any separate front end module or agent I can communicate
like this right. So, that is the possibility, that that is the beauty of this having
interoperable services across the thing.

219
(Refer Slide Time: 09:17)

There are a few more key words like reset or verify name to be verified NOOP, TURN,
EXPN mailing list to be expanded help. So, these are extra key words not that what we
say not so popular keywords, but these are the things which are also allowed in the
SMTP.

(Refer Slide Time: 09:38)

There are some status code 2## is the success, then we have 3## command can be
accepted in more with more information, 4## is the command was rejected, but error

220
condition is temporary right and 5## is the command rejected bad user. So, there are
different 3 digits code to handle that this SMTP communication.

(Refer Slide Time: 10:07)

Like here say, MTA this is TCP connection has been established, then the that 220
service ready that that is, the 2 as we have seen 2## is the success thing, then HELO
some message goes and then it says OK like this. So, initially the connection is
established between the two, the client and the server, client request for the connection
the connection establish, the server respond with 220 a service ready. Then it sends a
HELO message and then it responses that it is received and go so and so forth.

221
(Refer Slide Time: 10:46)

So if you go on expanding things. So, it goes from mail from it responded with a OK
message. It is received 2 for this OK message, then the data then start mail input and go
on doing these other information. So, this is the envelope, this is the header with a blank
line, you go on the body of the message right.

So and then it continues once the body once it is terminated. It will come to that, it says
that 250 drive, that the mail has been pushed to the towards the mail gateway or the
MTA.

(Refer Slide Time: 11:25)

222
So connection termination is sending a QUIT a formal QUIT by the mail client, and then
mail 221 receive service close messages sent by the MTA.

(Refer Slide Time: 11:45)

So, one is now there are some problems of in our generic SMTP extends SMTP that it
cannot handle all sort of data set. So that is a SMTP extension what we say MIME
multipurpose internet mail extension. So transformed a Non-ASCII character to a NVT
or Network Virtual Terminal ASCII character right, so, otherwise it will not be able to
communicate with the thing. So we can now we have text, application, image, audio,
video which can be pushed to this all MIME. So what we do usually attach that things in
some form of other with the mail. So those are if there is a Non-ASCII character, there
are there may be problem in transmission because those escape character etcetera may
interrupt the thing, right. So, this MIME takes care of that. So, it converts it to a 7 bit
NVT ASCII which the SMTP envelope takes as a payload, and the communication is
between this SMPT server client at the 2 end. And the other end also I have the MIME
which able to decode and for the user.

So this multipurpose internet mail extension gives a way to communicate between the
two with Non-ASCII type of character sets, right which comprises text, application,
image, audio, video. There can be situation where some of the things are blocked like if
you some of the mail server may not accept application or executable files. Some mail

223
servers may not accept video files, and that some there are may be restriction on the size
of the thing.

So, those are what we say upper layer, yeah or application there are different restriction
on the above SMTP right, basic SMTP allows the communication between the 2 2 SMTP
server client system.

(Refer Slide Time: 13:59)

So, there are typical MIME headers located between the email header, and the body
header like if you remember this was our email header, and the body header and it lies
between these 2, and there is that comes with a MIME version; that is, type of a content
type, contents transfer encoding type, content id and content description. So, these are
the thing which the MIME header contains.

224
(Refer Slide Time: 14:28)

And there are several other constant like what are the different type of things will be
there takes, when takes, multi part message, image, video, audio, application. There can
be different content transfer encoding how to encode the images 7 bit, 8 bit binary, base
64 quoted printable and so and so forth. So, what we see that MIME also has a rich set of
a headers to handle different kind of data.

(Refer Slide Time: 15:02)

So, MTA and mail access protocol, right. So, that is another thing, that if I have a mail
server so, how I can access that mail? So, MTA delivers the email to the user’s mailbox.

225
So, user’s mailbox is lying in the mail server, can be complex with numerous delivery
models routers ACLs and type of things, right. So, there are Exim, Postfix, Sendmail and
these are the different kind of what we say mail server or mail client which acts on the
things. Now this mail access protocol can be used by the user to retrieve the email from
the mailbox. So, two popular thing has POP3, and IMAP4. So, these are the 2 popular
mail access protocols.

(Refer Slide Time: 15:48)

So, what it does? So, it is from the all messages are there in that mail server. So, that so
this POP3, a POP3 actually pulls that message from the mail server or in some cases that
is goes on in push pull form and to the to your that mail access what we are looking at
that mail access protocols, right? Similarly, IMAP also acts in a similar fashion.

226
(Refer Slide Time: 16:24)

But so, post office protocol or POP3 it is simple. Allows user to obtain a list of their
emails. Users can retrieve their mails. Users can either delete or keep mails in their
systems and minimize the server resources. In other sense, this POP3 or even IMAP
allows the user to manage each mail, right and can it is gives a frontend to the user to
handle its mail services, right.

(Refer Slide Time: 16:58)

So, on the other hand, IMAP v4 is the basic philosophy is same. So, it has more features
than POP3. User can check email header before downloading, right. So, in case of

227
IMAP4 the user can check the header before downloading, and then take a call with that
to download or not. Email can be accessed from any location, can search email for a
specific string of characters before downloading, right. So, it can be it can search the
email for a specific string of characters before downloading that, that means, it keeps
more manageability or control to the user to handle his mailbox in other sense. User can
download part of an email; user can create, delete, rename mailboxes of a server. So, it is
a in the mail server in it is own mailbox, it gives at lot of flexibility in handling that a
mailbox. So, that is the part of this in case of a IMAP or IMAP version 4.

So with this we have we see a broad overview of these mail how SMTP works. Now let
us have another protocol that SNMP or Simple Network Management Protocol.

(Refer Slide Time: 18:22)

So SNMP, so fundamental objective or basic objective of SNMP is to manage all aspects


of network as well as application related to the network. So that means, its a more of a
protocol which allows manageability of the network. Rather than other protocols what
we have seen, it is the major purpose is transferring data etcetera from one part to
another, right. Anyway in case of SNMP, it is primarily to manage the network. And
specially the network as it expands, the overall management becomes a major issue, not
only from the failure, but to give a better bandwidth service and so on so forth.

So, two major functionalities of SNMP one is monitor, SNMP implements


implementation allow network administrators to monitor their networks in order to

228
ensure the health of the network, right. So, there are other things, but it to ensure the
health of the network, forecast uses and capacity and in problem determinations. So, this
is one of the thing so that is a monitoring of the network.

The other part is SNMP provides the capability of the network administrator to affect
aspects of the with the network. Values which regulate network operation can be altered
allowing administrator to quickly respond to network problems dynamically etcetera. So,
one is monitoring; so, what is during that it is getting regular information about the thing.
Another is based on that information, the network manager or the administrator can take
a call on the things; that means, it can manage the things like implement new network
changes, improve real time testing and how it is getting affected and type of things it can
do on the network.

(Refer Slide Time: 20:20)

So, as it requires there should be some agents or what we say SNMP agents who will be
reporting the status of the network or information about the network. So, SNMP
implements a manager client sub agent model which conforms very closely to the client
server model, right.

So, it is sort of a agent based things. So, RFC 1157 defines the component and
interaction involved in a SNMP community which include management information base
or a MIB SNMP agent, a SNMP manager, and there are SNMP subagent. So, this

229
constitutes or defined based these are the things which are required for this operation of
the SNMP.

(Refer Slide Time: 21:12)

And SNMP agent is a software that runs on a piece of network equipment. It can be host,
router, printer and others, and maintains the information about the configuration or
current state of the database.

So in other sense wherever this network connectivity is there, if we need to be managed


like specially intermediate things like router etcetera, this SNMP agents runs on a on that
particular equipment. So, it is a software which runs on either in the host, network
printer, in a router and or any network type of devices. And that maintains information
about the configuration and current state of the database, right.

So information in the database is described in management information base or MIBs


right. So it has a particular structure by which these management information bases are
maintained. So SNMP manager is an application program that connects to the SNMP
agent to query or modify the database in the agent.

So the manager connects to the SNMP agent to either query the agent for data or update
the database or modify the database. SNMP protocol is the application layer protocol
used by SNMP agents and manager to send the send and receive data, right. So, it is a

230
application layer protocol used by the SNMP agents and manager to send and receive
data is the SNMP protocol basic protocol.

So, what we have? We have agent which is collecting data, we have a management
information base to have the database. We have a SNMP manager. There is the
application program that contacts the SNMP agents to query and modify the database.
And we have a SNMP protocol is the application layer protocol that is SNMP agents and
manager sends and receive data.

(Refer Slide Time: 23:01)

The management station, so if we look at that particular configuration so, we have this
management station, where SNMP manager process is running SNMP this protocol is
running it runs, SNMP incidentally runs on primarily on UDP. We have on the line IP,
then the IP network and the data things are there. So, if there is a query, it goes through
and access these agents. So, from the manager, the query goes to the agent, the data or
traps comes to the things. This SNMP agent as we are discussing it has a MIB or
management information base, right.

So, it contains the database address. So, the manager this agent is sitting in some network
devices. So, these SNMP messages are communicated between these two, in between
these two SNMP of the manager and SNMP of the agent.

231
(Refer Slide Time: 24:05)

So, what is this MIB? Is specific specifies the management object MIB is a text file. That
describe named object using a syntax which is described in abstract syntax notation 1,
right. So, ASN 1 is a formal language for describing the data and its properties.

So, it is a standard formula standard way of representation. In Linux MIB files are in the
directory that particular directory. And MIB 2 defined in RFC 1213 defines the managed
objects of the TCP/IP network. So, these are the data base of the data which are
contained in the things.

(Refer Slide Time: 24:45)

232
So, which object to be managed? Managed objects each managed object is assigned a
object identifier, or OID. OID is a specified in a MIB file. So, what is the object
identifier is specified in a MIB file. So, the OID can be represented as a sequence of
integers separated by 2 decimal point or a and by a text string, right.

So, it is a sequence of in integer which is separated by decimal points and by a text


string. So, recently here the example was not there. But if you check in any standard
book or thing, so you see that how it is represented. When SNMP manager requests for
the object you send the OID or object identifier to the SNMP agent, right.

So in that way, it can find out that only for a particular data or information if it is
manager is seeking for some manageability issues it can it can hook into like this.

(Refer Slide Time: 25:51)

So, if we look at the SNMP protocol down the line. So, SNMP manager and SNMP
agents communicate by a SNMP protocol. Generally, manager sends queries and agents
and agent responses. So manager sends query agent responses. Exception traps are
initiated by agents. So there if there are external situation the traps are initiated by the
agents which are pushed to the manager. So one side manager or other agent so it get
requests get response. If this is at port 161 get next requests and next response and it
goes on like this. So, it said request and response, and if there is a trap without any
request it can send the trap message to the SNMP manager.

233
(Refer Slide Time: 26:38)

So, in case of a SNMP protocol, it has a get request, request the value for one or more
object, gets next request, request the value from next object according to the
lexicographical order of OID. So a OID has a chronological lexicographical order. And it
requests for that. Set requests, a request to modify the value of one or more object that is
a set request. So, you want it wants to set the request, Get-respond, sent by SNMP agent
in response to the Get-request, Get-next-request or Set-request message, right.

So, what we have? One is that requesting the thing. One is one other type of thing is the
setting the request, that is request to modify some one or more of the object, and it gets a
response of the thing. Trap is a SNMP trap is a notification sent by the SNMP agent
without any query from the SNMP manager to a SNMP manager which triggered by
certain events at the agent. So, agent may have some certain events which it wants to
inform immediately to the manager. So this trap messages are for that.

234
(Refer Slide Time: 27:48)

So, SNMP versions, so, the typically there are 3 versions which are in active use: SNMP
version one that is in 1990 it came up, version 2 c which is 1996 and version 3 2002. So,
these are the things, and in version 2, there is it attempts to version 3 attempts to address
the security issues. So many SNMP agents and managers supports all 3 versions of the
protocol. So there are SNMP agents and manager which supports all these parts, all these
3 versions of the protocol.

(Refer Slide Time: 28:33)

235
So, this is a typical format of SNMP packet which SNMP 1 Get Set messages, clear text
string that is used as a password. PDUs type for SNMP 132 bit and for SNMP 2 it is 64
bit. Unique ID that matches the request with the replies right, otherwise who as is the
request response, so we need to have some unique id to identify that which with whose
response it is.

(Refer Slide Time: 29:10)

Finally, we have a issue of SNMP security, as this it carries information about the
different network devices and accumulate. So, security becomes a major challenge. So,
SNMP version 1, uses plain text community string for authentications as plain text
without encryption in case of SNMPv1. SNMPv2 was supposed to fix security problems,
but effort, but could not the c is the SNMP stands for community type of issues. Finally,
SNMP version 3 has numerous security features. Like it ensures that the packet has not
been tampered with, there is an integrity issue, ensures data is valid source, that is the
authentication. And ensures that the message cannot be read by unauthorized some agent
or person or whatever, that is the privacy or confidentiality is maintained. So what we
see that all these integrity authentication privacy or confidence if there are CIA property
sometimes you say are tried to has been tried to has been attempted in a SNMP version 3.

So this, in this particular discussion what we try to impress upon or what our objective is
to show discuss about one two again popular protocol. One SMTP that is the mail
protocol which we experienced day in day out, SNMP as such we do not experience

236
directly, but virtually the management of the network keeps this whole thing running,
right.

So it is the overall management of the network which makes these things running. And
for that this SNMP with SNMP these agents and the these managers they take care of this
overall management and take corrective actions to make the keep the health condition of
the network in a appropriate state. We have referred some of the references we I have
mentioned and though it is there can be other several internet resources.

(Refer Slide Time: 31:29)

So let us stop at this stage today. And we will discuss about other layers and applications
in the subsequent lectures.

Thank you.

237
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology Kharagpur

Lecture - 11
Transport Layer – 1 ( Services )

Welcome to the course on Computer Networks and Internet Protocols. So, in this course
we are talking about the 5 different layers of the TCP/IP protocol stack. So, till now, we
you have a good idea about this 5 different layers of the TCP/IP protocol stack and
professor Soumya Ghosh has already given you a broad overview of the different
applications that can run on top of the network protocol stack.

So, today I will start with the second layer of the protocol stack, that is the transport layer
of the protocol stack and we look into different services which are there at the transport
layer of the protocol stack and how it helps you to provide end to end connectivity
between 2 machines and transfer data from one machine to another machine.

(Refer Slide Time: 01:09)

So, we look into the various aspects of transport layer protocol stack. So, before going to
that let me give you a brief overview about how different devices in the network are
connected. So, at the 2 ends so we have 2 different devices or 2 different machines. So
these are the 2 different hosts which are transferring data between themselves and at the
two end hosts we have all this 5 layers of the TCP/IP protocol stack, starting from the

238
application layer where you are running certain kind of applications like the browser
applications or like the chat applications. Then you have this transport layer which
provides the end to end connectivity between the 2 layers of the protocol stack, after the
transport layer you have the data link layer which will help you to find out a suitable path
between 2 devices in the network through multiple intermediate devices right, like the
routers at the switches. After the network layer you have the data link layer, the task of
the data link layer is to provide you the channel access mechanisms when multiple nodes
are trying to transmit simultaneously and they are utilizing the same communication
media like the same wireless channel or the same wired network. And finally, you have
this physical layer of the protocol stack which takes care of the physical layer signaling
techniques and the different modulation and the coding schemes.

Now the two end hosts in the diagram they have a both the 5 layers of the protocol stacks
starting from the application layer and the physical layer. Now the intermediate devices
they may not have this all the 5 different layers of the protocol stack. Say for example,
sometime in the network you have this devices which we call as the L2 switch or the
layer 2 switch, the layer 2 switch has the protocol stack up to the second layer like up to
the data link layer. Then you can have this layer 3 devices these are, we call as the layer
3 switches or a router. So this layer 3 switch or the router they have up to the network
layer of the protocol stacks. So, they help you finding out the paths among multiple hosts
or multiple devices in the network, when you are trying to make an end to end
communication. Now the transport layer it sits on top of the network layer and the
transport layer is only there at the two end hosts and the task of the transport layer is to
ensure the end to end performance or the end to end functionalities of the network.

So, we will look into the details that what are the different end to end functionalities in
the network, which can be utilized or which can be implemented as a part of the transport
layer and interestingly you can also write your own program to support or to configure
the transport layer to make two end devices communicate with each other or talk with
each other.

So, we look into all those details in subsequent classes where we will look into
something called as the socket programming, to find out how you can send data end to
end between the two end hosts. So, before going to that let us look into the various
aspects or various design primitives of the transport layer, which is being utilized by the

239
network to ensure reliable and high performance data delivery between any 2 host in the
network or any 2 remote hosts in the network. So, these 2 remote host can be sitting in 2
different countries or 2 parts of the world. So, it may happen that 1 machine is residing at
say here in II, Kharagpur another machine is residing in say at the Google office at USA.

So, whenever you are trying to make these 2 nodes talk to each other, it is just like that
you need to have set up of multiple end to end functionalities. Like the lower layer of the
protocol stack - first of all they are not reliable, there can be packet loss from this lower
layer of the protocol stacks. So, the transport layer ensures the reliability of a data
transmission. At the same time it also offer multiple other services, so let us look into the
details of how this different services are implemented in the transport layer of the
protocol stack.

(Refer Slide Time: 05:33)

So, well so this is this diagram actually gives you the implementation semantics of a
different layers of the protocol stack, if you look into the perspective of an individual
computer or an individual end host. So, if you look into an individual computer - a
computer per primarily have 3 different modules, like at the bottom you have the
hardware module of a computer. Here in case of networking devices this hardware
module contains your network interface card or the NIC. NIC or we call it as the network
interface card. So, these network interface card provides you the hardware layer
functionalities.

240
So this entire physical layer it is implemented as a part of the hardware its a part of the
network interface card. Then on top of the hardware you have the firmware or the device
driver. So, this firmware or the device driver it provides you a way to interact with the
physical layer, so this firmware or the device driver that has the implementation of part
of the data link layer and the part of the physical layer. It varies from a different variant
of network and different variants of vendors.

Say for example, if you think about the wireless network. So, the physical layer it is
entirely implemented in the hardware and also nowadays some part of the wireless data
link layer protocol it is also implemented as a part of the hardware to make it fast or to
make it make it robust in the context of a large number or large amount of data delivery.
On the other hand many of the device drivers in wireless environment as well as wired
environment the data link layer is implemented as a part of the device driver or the
firmware.

So, the device driver or the firmware that you install for your network interface card that
primarily have the MAC layer implementation. Then a part of the MAC layer which is
later on we’ll see that it is called a logical link control module. So, a part of the MAC
layer and then the upper part of the protocol stack like the network layer and the
transport layer implementation, they are implemented as a part of the software at the
kernel of your network protocol stacks. So, it is it is the part of the kernel if you think
about the Unix type of operating system, where inside the kernel you have the
implementation of the higher part of the data link layer which we call as the logical link
control and then the entire implementation of the network layer or the sometime we call
it the IP layer in the context of TCP/IP protocol stack and then the implementation of the
transport layer. The different type of the transport layer protocols which are implemented
as a part of your your software or operating system software or in a UNIX type
environment it is the kernel part of the operating system that implements this transport
layer and the network layer.

Then on top of that you have multiple applications running. So, this different
applications are design by different network designer or different application designers,
we will also learn how to implement a network application which can talk over 2 end to
end devices. So, this applications can be the browser application to access web data or

241
that application can be certain kind of chat application where multiple parties want to
chat with each other or it can be something like a standalone applications.

So for example, in a android based operation system you see there are multiple
application, the Facebook application, the twitter application, the YouTube application
that access data over the internet. So, all this different applications are implemented as a
part of your application layer. Now in below the application layer we have the transport
layer of the protocol stacks. So, you can think of that this transport layer it makes a
interface between the user application and the operating system. So, whenever the data
from the user application is going to the operating system it is going via the transport
layer.

(Refer Slide Time: 09:56)

So, let us look into that how this different layers of the protocol stack adds up their own
header, in the initial discussion of the TCP/IP protocol stack you have got a broad over
view about how the data is being passed through multiple layers of the protocol stack.

So, in the application layer if you think about the context of an HTTP application which
is sending data on top of a browser, so you have this HTTP data that is coming from the
browser and on top of that the HTTP protocol it is it adds up its own header. So, this
HTTP header information it contains the various information about the application layer
connectivity, then this entire data the HTTP data along with this HTTP header that comes
as a part your transport layer data. So, these transport layer data it is the entire data which

242
is coming from the application layer and with this transport layer data we adopt a
transport layer header. So, we will look into the different type of transport layer protocol
like the TCP protocol or the UDP protocol and various other transport layer protocols are
there, like RTP.

So, every individual protocol whichever you are going to use, so as an application
developer you have to mention that which particular transport layer protocol you are
going to utilize, you are going to use for your purpose, whether you are going to use TCP
type of application or whether you are going to use UDP type of application. So, that the
difference between TCP types of application and the UDP type of application, we look
into shortly.

So, so the transport layer it adds up it is own header with the application layer data that
contains multiple information for managing the transport layer protocol. Now this entire
transport layer data and the transport layer header it comes as a data to the network layer
and the network layer adds up its own header then it comes to the data link layer. The
data link layer again adds up its own header, we call it as MAC header in the context of
the data link layer and finally it comes to the physical layer. So, whenever you are
coming to the physical layer you can see that you have a small amount of data which is
coming from HTTP and then different type of headers which are being added by the
different layers of the protocol stack.

So, the application layer it has add up the HTTP header, then the transport layer it has
added up its own header then the IP layer it has added up the IP header. Finally, the data
link layer has added up its own header and the physical layer adds up physical header
and sometime for some protocol it also adds up a trailer, to actually identify an end to
end frame. So, that way the entire thing gets deliver over the network.

243
(Refer Slide Time: 12:43)

Now, if you look into the context of the transport layer, that why do we require the
transport layer in the internet. Now, just below the transport layer you have the network
layer and the functionality of the network layer is to ensure the datagram delivery. So,
when you say it as a datagram delivery it indicates that the network layer whenever it
will receive a packet in the packet or in the network layer context we call it as a
datagram.

So, whenever it will receives the datagram in the datagram it there is this source address
and the destination address field. So, the task of the network layer is to look into the
destination address and accordingly forward the packet to the next hop. So, the network
layer basically ensures that data delivery among multiple hops in your devices say for
example, say you want to transfer a datagram or transfer certain data from 1 machine at
IIT Kharagpur to another machine which is residing at Google USA, say you are going to
access www dot google dot com.

So, whenever you are going to access that and your data need to be transferred from your
machine say currently I am at Kharagpur. So, the machine of at Kharagpur the data need
to be transfer to the Google server which is there in the USA. Now in between there are
this multiple routers which are there we call it as the layer 3 switches or sometime people
call it as a layer 3 devices. So, there are multiple routers there in between so the task of
those routers is to forward the packet to the end host.

244
Now whenever the routers are forwarding the packet the packet to the end host and here
we are thinking about the packet switching principle or packet switching architecture in
the principle of packet switching, packet switching architecture or packet multiplexing
architecture what happens that the intermediate routers they have a finite amount buffer
and the packets are pushed to that buffer. Then the router performs a route look up on the
by looking into the header of the packet and then decide that which particular out going
interface the packet need to be a transferred. Now when a router is doing this task and by
the time it has receiving multiple data from multiple other neighboring routers. So, the
architecture of this entire network is really little complicated.

So, let me just give you an one example, so you have 1 intermediate router here whose
task is to send the data and it is also receiving the data from multiple other routers. So, it
is receiving the data from all this different routers and then it task is to send this data to
some next hop router 1 or 2 multiple next hop routers.

Now this particular router it maintains an interface Q and that interface Q will
temporarily hold all the packets. Now in in any devices this type this particular host or
this particular device it has finite amount of buffer space within it, because it has finite
amount of buffer space within it, it may happen that because of high load in the network
the buffer become full, when the buffer will become full, the packet will start dropping
from the inter intermediate routers.

So, that way the network layer all though its task is to find out or its task is to send the
data from one end host to another end host, many of the times it fails to support
reliability. Reliability in the sense that there is no guarantee that your particular data that
will be transferred from one end of the host to another end of the host. It may happen that
at intermediate routers the packets get dropped because, of this kind of buffer over flow
apart from buffer over flow there can be error in during the physical transmission of the
packet, there can be a channel interference which can happen in the case of a wireless
network.

So there are multiple reasons because of which a packet can get dropped. Now whenever
a packet is getting dropped or the packet is being lost while doing a end to end delivery
of the packet by the by the network layer, so we say that the network layer provides this

245
datagram delivery but this datagram delivery is unreliable, so it supports unreliable
datagram delivery.

Now whenever you are providing unreliable datagram delivery at the network layer, then
at the transport layer your task is to ensure that the packets or the message which are you
trying to send from one end host to another end host that messages are transferred
correctly.

So, in other words what we can say that the application should not get hampered by the
loss of the data from the intermediate routers or the intermediate network devices. So,
the transport layer it takes care of this particular thing. So, the transport layer it provides
reliable data delivery on top of this unreliable data gram delivery, which is supported at
the network layer. So, the task of the transport layer is that to monitor whether a
particular data is being transferred at the other end host or not if it is being transferred, so
it is happy; if it is not being transferred, then the task of the transport layer would be to
monitor that and if it finds out that will certain data got lost while doing transmission, it
task would be to support or to retransmit the data, so that eventually the message that the
application was trying to send to the other end, that is getting delivered. So, one
important task of this transport layer is to ensure this reliable data delivery, so to ensure
this reliable data delivery, transport layer can provide other services like this connection
establishment.

So, the concept of the connection is just to say a hello to the other end hosts. Say for
example, whenever you are making a telephone call, so once the other end picks up the
phone your first voice is or first message is a kind of hello message. So, through the hello
message you want to ensure that the other end is properly able to receive the message
that you are going to transmit. So, once the other end also acknowledges your hello
message by saying another hello and both of you have established the kind of logical
communication or a logical connection between yourselves, then you start talking or start
sending other messages.

So, in the data transfer perspective these connection establishments are just like this hello
messages, say one end of the devices it wants to make sure that the other end is alive and
the other end is ready to receive the message.

246
(Refer Slide Time: 19:46)

So, that is the connection establishment service which is being provided by the transport
layer. Then the transport layer provides end to end packet delivery. So, there are 2
different groups of transport layer protocol 1 transport layer protocol is this UDP or the
user datagram protocol.

So, UDP is not like a transport layer protocol or it does not provide any special transport
layer services. So, what UDP does? UDP just work like a wrapper of this network layer
protocol stack or the IP layer of your protocol stack. So, the task of the UDP layer is that
whatever data you are receiving from the network layer you directly pass that data, do
some small checking and then directly pass that data to the application. So, why we
require UDP because, certain kind of protocol, certain kind of application they do not
require reliability, but the importance is the performance.

So you can understand that whenever you are implementing this multiple type of services
at the transport layer, obviously, it will introduce certain amount of delay in the network
and whenever the transport layer is introduced in this certain amount of delay in the
network, the other end it will suffer from large considerably more delay compared to
normal datagram delivery, because you are providing additional services at the transport
layer.

So, some time the application requires a real time reception of the packet, but it can
tolerate the loss, the channel loss. So, the application does not require reliability that are

247
getting a packet quickly is the major importance. So, in that particular case you do not
implement any transport services at all.

So, we just use this UDP protocol and the UDP protocol helps you to embed this entire
network layer data and pass it to the transport layer and give the data to the application
which is demanding for a service, which is important for, which is important for
application perspective in the context of having application layer data delivery and it
does not demand for a reliable transmission of data.

The transport layer also provides certain additional services like the flow control and the
congestion control. So, this flow control and the congestion control it is just like say
whenever you have 2 different hosts which are trying to transfer data among themselves
and there are this intermediate network, this intermediate network can introduce multiple
delays or packet loss in the network. So the flow control ensures that well this particular
end, say it may happen that the receiver can receive the data at a rate of 1 mbps and the
transmitter can send data at a rate of 10 mbps. Now if that is the case under this
transmitter, so, I am naming it as T and the receiver I am naming it as R. Now if the
transmitters send data at a at a rate of 10 mbps and the receiver can receive data only at a
rate of 1 mbps, so what may happen that the additional data that you are pushing in the
network, that is making the network or that is having a overhead at the network. But
those particular data not getting delivered at the other receiver. Like it is making the
network congested by pushing additional data in the network. But it is it is not making
the receiver to receive the data at that particular rate.

So during that time this particular additional transmission of data from the transmitter
side it is wastage for the network perspective and that is why transmitter and the receiver
need to communicate among themselves, the transmitter and the receiver need to agree
among themselves, so that the transmitter can only send the data that the receiver can
receive, so this particular concept we call it as a flow control. Now there is another thing
in the network which is called as the congestion control.

248
(Refer Slide Time: 24:00)

So, that congestion control is something like this so whenever you are transferring data
in the network, if I just represent the network as a graph where every network devices is
represent at a node. So, in that case this particular node if you just think of an
intermediate node it receives data from multiple other paths. So, you can just think of
this entire network as a anonymous to a as a synonymous to a road traffic network. Now
in case of a road traffic network in a in a road junction in a in a road junction point, if
traffic is coming from multiple roads, in that case it may happen that well this
intermediate junction becomes congested. So, this transport layer of your network
protocol stack it supports congestion control. So, it avoids congestion whenever you are
receiving packets from multiple different paths.

Another functionality of the transport layer is to support ordered packet delivery, so what
is this ordered packet delivery the ordered packet delivery is, so whenever you are
transferring the data between two end hosts, it may happen that well some of the data is
being say you are you are sending data from this host to another host, which is connected
at a different end and whenever your transferring the data it may happen that well a part
of the packet some packets are using this path to reach the host, where as some packets
are using this path to reach at the end host. Now because of the delay difference between
these two paths it may happen that well certain packets reach earlier than other packets.
So, you are say I am giving every packet at a sequence number 1 2 3 4 that way because,
of this delivery to multiple paths it may happen that packet 3 has reached first and after

249
that you have received packet 2. So, you can receive this kind of out of order packet, so
the task of the transport layer is to ensure that even if you are receiving out of order
packets, this out of order packets will be eventually get ordered and it will be delivered
to the application under as a ordered sequence of data. Otherwise the applications will
not be able to able to find it that what is the sequence of data which is being coming. So,
the applications need to always get the data in sequence.

So, this particular module in the transport layer it will ensure the ordered delivery of the
packets over this, unreliable datagram delivery which is been supported at the network
layer. Now in a nutshell, what we can say that well whenever you are transferring data
over the network layer the network layer just ensure of delivering the datagram at the
other end host, which is their your which is working like your destination. But the
network layer it does not support the various required services which are important from
the application perspective.

So in that particular context it is important to provide certain level of end to end service
in the internet. Now this transport layer it provides this sets of end to end services over
the internet. Now in this particular context we’ll we’ll have multiple different services
which are been provided by the network layer and we see that well this TCP protocol the
transmission control protocol, this TCP protocol provides all this different services which
is being required at the network layer, like this connection establishment, reliable data
delivery, flow control and congestion control, as well as the ordered packet delivery.
Whereas, UDP protocol it just work like a wrapper of the network layer protocol to
transfer the data directly to the application layer, without providing any such services
like this connection establishment, reliable data delivery, flow control and congestion
control, ordered packet delivery and so on.

So that way we broadly have 2 groups of protocol at the transport layer, one group of
protocol it task is just to ensure that that data is being sent or the data is being transferred
to the other end, so whatever is being supported by the network layer that services that
directly provided to the application layer. So the UDP protocol belongs to that group of
protocol where we do not support reliability, ordered delivery and all this services and in
this case the application requirement is to ensure only to deliver the packet and it can
tolerate the loss itself.

250
For example, certain multimedia protocol can do that, it can tolerate the loss up to certain
level because, whenever you are receiving data frame by frame wise, the important thing
is that the frame is being received. But even if certain frames in between are being
missed, then the multimedia protocol they can do an averaging of the first frame receipt
and the third frame receipt and from there it can approximate the second frame and play
it.

So, that way up to certain level of data loss it can tolerate this kind of multimedia
protocols, but transferring the data within a predefined time out is very important. So,
because if you implement this kind of services at the transport layer that will take certain
amount of time for processing the data and if there is a loss it will give more priority on
retransmitting the loss segment or retransmitting the loss packet, rather than transferring
the new packet you will experience more delay if you are going to implement those
levels of services at the transport layer.

So UDP provides a service where this loss or reliabilities not important, rather
transferring the data within some timeout duration that is important. On the other hand,
for applications like say file transfer or the web data transfer, reliability, ordered packet
delivery, this particular functionalities are more important so we use TCP kind of
protocol. So if you look into the protocols like HTTP, FTP, those kind of protocol they
uses TCP type of protocol at the transport layer, where as protocols like certain
multimedia protocol as well as the DNS protocol at the application layer it uses UDP
type of protocol.

So, in the next class we will look into the different services which are being provided by
this transport layer and we look into the details of those services, starting from the
connection establishment. So, see you all again in the next class where we look into the
connection establishment paradigm in the context of the transport layer.

Thank you.

251
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 12
Transport Layer – II (Connection)

Welcome back to the course on Computer Networks and Internet Protocol. So, we are
looking into the different functionalities of the Transport Layer of the protocol stack and
in the last class we have looked into that what different services the transport layer can
provide on top of your unreliable datagram delivery that is supported by the network
layer. And what we have seen that the packet delivery, the end to end packet delivery at
the network layer is unreliable, and the transport layer provide certain end to end services
on top of that. So, from today onwards we look into the details of all those services
which are being provided by the transport layer.

(Refer Slide Time: 01:00)

So, the first service that we are going to talk about is about the connection establishment.
So, as we are looking or discussing in the last class, that the two end of the devices
which has the entire 5 layers of the protocol stack, so the two end need to first setup a
logical connection between themselves. And this logical connection is something like
that one person is saying about hello and another person is replying back with another

252
hello message. And they are they establish a logical link among themself and they both
of them become sure that they want to share the further information among themselves.

So this connection establishment is to see that whether the other end of the
communication is live or not whether that is ready to receive the message or not. And if
it is ready to receive the message, if it acknowledges then we can safely start sending the
data. So, in case of your voice network like the telephone network, you can just do it by
saying hello. Because you know that it is a circuit switching network and whenever you
are saying hello, the packet will always or your message with always reach at the other
end. The reliability is not a issue there.

But in case of a data packet switching network, this reliability is an issue, because this
entire packet switching network is working on the basis of king principle where as I was
mentioning the last class that every intermediate devices has certain fixed amount of
buffer and whenever you are putting certain packets into that or certain data into that and
if your network load is too high, it may happen that the buffer becomes full and packet
starts getting dropped from that buffer. If it happens, then it becomes difficult for you to
understand or to ensure that whenever you are saying hello, whether that message is
correctly being received by the other end or the second scenario can be like the other end
is not ready to receive your message and that is why it is not echoing back the hello
message or not acknowledging your hello message.

So, that is why ensuring this logical connection at a packet switching network, for data
delivery, is little bit non-trivial compare to what is being used in case of your traditional
circuit switching network or in the telephone network. So, we will look into the different
aspects of this connection establishment, in the context of transport layer of the TCP/IP
protocol stack, that how you can ensure that whatever hello message you are transferring
to the other end, the other end is correctly receiving that hello message and correctly
being able to decode that hello message. And it is able to send you back with the required
reply.

So, let us look into the connection establishment in details. So, the connection is just like
a logical pipe that ensures that both the ends are now ready to send or receive further
messages or further data.

253
(Refer Slide Time: 04:20)

So let us see a very naive protocol of the connection establishment. So, we have in a we
are in a client server model. So in this client server model, the client is trying to make a
connection with the server.

So, we say that the server is in a listen state, the server is listening for the incoming
connection. So the client sends a connection request message. So, once the client send
the connection request message the sever is in the listen state. So the server can listen
that connection request message and it replies back with the connection
acknowledgement message. So this 2 way hand shaking is likely to work for a normal
connection establishment purpose, but our life is not very simple in case of a packet
switching network.

So, the question is that this simple primitive where the client sends a connection request
message and the server responses back with the connection acknowledgement message.
Just like the hello protocol that we use in case of our telephone network, whether that
will work in the case of packet switching network or data network or not. So, our target
is to look here, that this simple primitive for connection establishment whether this will
work good for a packet switching network or not.

254
(Refer Slide Time: 05:49)

Now, the problem in the packet switching network is that, the network can lose the
packet, there can be packet loss from the network; there can be arbitrarily delay in
delivering the packet. There can be delay in delivery the packet because it may happen
that the intermediate router switch are there, that intermediate routers their buffer is
almost full and it is receiving packets from multiple other links and it need to transfer the
packet one after another.

So, just like a scenario in a road congestion. So, whenever a road become congested then
the speed of the cars becomes very slow. And all the cars are going to enter to a common
road from multiple others road and in the road junction because it has a finite capacity,
that becomes the bottleneck and the congestion becomes there, because of which the
speed of individual cars become very slow.

The same thing can happen in a computer network because a router is receiving packets
from multiple other neighboring routers and when it happens, it may it may result in a
congestion in the network, because of which the rate of packet becomes very slow. And
that is why there can be this kind of arbitrary delay in the network. The packet can get
corrupted as well and there is a possibility of duplicate packet delivery. Because the
transport layer also ensures reliability and the way of ensuring reliability in the transport
layer is just like to monitor whether a packet is being received by the other end or not. If
the packet is being received then I am happy, if the packet is not being received, if I am

255
able to find out that the packet is not being received, then what I will do that I will
returns with the packet after a time out.

Now, it may happen in the network that well the earlier packet that I have transferred,
that packet got stuck somewhere in some intermediate queue in the network because of
the congestion or this kind of network effect. And I am keep on waiting for the
acknowledgement and I do not get the acknowledgement within that timeout duration.
So, I think that well the packet is probably got lost and then I retransmit the packet again,
but whenever I am retransmitting the packet again note that the earlier packet was
actually not lost rather the earlier packet was just waiting in a queue to get it delivered.

So, because of this reason it may happen that well the other end the receiver may receive
multiple packets of the multiple or better to say multiple copies of the same packet which
we call as a duplicate packets. So, it may happen that there is this kind of duplicate data
delivery in their network because of this retransmission to ensure reliability. Now as I
have mentioned that because the packet may get delayed and got stuck in the network
due to congestion, the sender assumes that the packet has been lost, it retransmit the
packet and that way the receiver can get the duplicate packets.

(Refer Slide Time: 08:52)

Now, when it happens, you can think of scenario like this. That well now the server has
received 2 copies of the connection request. So, it has received one connection request
here. But remember that this particular sequence number is not there, in the original

256
packet this is just to give you an indication that well there are 2 different connection
request packets. So, the server has received one connection request packet and then it has
received another connection request packet. It may happen that this particular connection
request packet got delayed and it was transferred by the intermediate router after
sometime. Because of that delay it has received late compared to this first connection
request packet.

Now, the problem for the server is to find out that whether this connection request one
that it has received, whether that is a new connection request or it is a duplicate of the
connection request to that that it has already received. Now the interesting fact here is
that, it may happen that the server has crashed and re-initiated the connection. So
distinguishing between these two becomes very difficult that, whether it is just like new
packet, new connection request message that is being received or it has happened that
well either the server or say for this example the client has crashed after sending this first
connection request packet and then the client is trying to establish another connection
request.

(Refer Slide Time: 10:31)

So, even if you forget this particular scenario it may happen that it may happen that well
yeah.

257
(Refer Slide Time: 10:40)

So, it may happen that say here is your client and here is your server. So, the client has
sent one connection request message, after the client has sent that connection request
message, say at this point the client has crashed. So, there is a crash here. So, the client
got crashed and after some time, the client again re-initiates and it sends another
connection request message to the server.

Now, when the client sends the second connection request message to the server, it
becomes difficult for the server to find out whether this connection request it is a new
connection request or it is a duplicate of this connection request. Because remember that
the server does not know whether the client has been crashed or not, that information has
not reached to the server. So, because of all this reason, the entire principle of connection
establishment in a packet switching network is very difficult, because you need to
differentiate between the original request and it is delayed duplicates and the challenge
comes that how will you differentiate between the original request and the corresponding
delayed duplicate.

So, in the context of connection establishment, we always has this kind of debate. That
whether we will go for the protocol correctness or we want to design a protocol which
will perform good. Because if you want for the correctness what you have to ensure that
you need to add multiple other modules to differentiate between a new connection from a
delayed duplicates.

258
So, the question comes that whenever you will execute those modules for finding out
whether that is a old connection of or a delayed duplicate message or a new connection
request, this entire protocol things become complicated and it reduces the overall
performance because this works like a over head for the data delivery. You are not
actually doing the data delivery, rather you are spending a considerable amount of time
just for establishing the connection. So, that’s why you have this kind of debate on
whether we want a correct protocol or whether we still can work good with a
compromised, little compromised protocol which is not totally correct, it can fail under
certain scenario, but still it will give good performance. So, this delayed duplicate they
create a huge confusion in the packet switching network.

So, a major challenge in a packet switching network is develop a protocol which will be
able to handle the delayed duplicates. So, it is just like that sometime, we design a
protocol which will completely be able to handle the delayed duplicates. So, you will
give the preference over correctness or some time we give preference over performance.
And whenever we give preference over performance still we need to find out a protocol,
which will have at least acceptable level of conformation in handling the delayed
duplicates in the network.

(Refer Slide Time: 13:47)

So let us see what are the different possible solution that can we that can have in this
context. So, first of all you can use throwaway transport address or the port numbers so,

259
we have discussed this earlier that this port number it is a mapping between your
transport layer and the corresponding application. So it may happen that multiple
applications in your machine are trying to use the TCP protocol to transfer the data. So, it
is just like that, you have this application 1 and application 2 which are running on a
machine and both of them are transferring data. Now whenever your network protocol
stacks say this is a transport layer of protocol stack, whenever it receives some data from
a remote host it need to find out whether that particular data is for application 1 or
application 2. So, during that time we use the concept of port number, to differentiate
between application 1 and application 2. So, this port number application 1 runs in one
port say it is running in 8080 port, application 2 runs in a different port say it is running
in 2345 port. By looking into the port number in the transport layer header, we will be
able to differentiate between application 1 and application 2. Now although we’ll be able
to differentiate between the application, but the question comes that can we utilize this
port number to differentiate between the normal packet and the delayed duplicate. Now if
we design a protocol where if a machine get crashed, it will use different port number for
initiating a new connection, if that is the case, then probably we will be able to solve this
problem.

So, it is just like that that our solution says that do not use a port number, if it has been
used once already. So if you have already used the port so, the delayed duplicate packets
it will never find their way to a transport process. So, it is just like that say this
application 1 say application 1, I am writing it an A1. It was initiated a connection
establishment message say port through port 8080 and after that this particular process
get trashed. Now if you are running the application again then run it in a different port
say 8082.

If it is the case and if you are sending another connection establishment message here,
then this earlier connection establishment message that you have sent through port 8080
whenever you will receive a reply of that, say a reply of this connection establishment
message that will also come in port 8080 and the transport layer will not be able to
deliver that and it will correctly discard that particular reply message. And if a reply
comes in port 8082, the reply comes in port 8082, then the transport layer will be able to
deliver it to the application A1.

260
So, this is a possible solution, but the problem comes that this solution is not feasible.
Because we have a finite number of this kind of transport addresses or port number
because we have this finite number of ports. So, you cannot throw out a port number
once it is being used. So, in that case theoretically will be requiring infinite number of
port addresses which is not feasible for the practical implementation point of view, and
whenever also your utilizing multiple application so, there are multiple applications
which are kind to send data over the network.

So, the second solution can be like that give each connection unique identifier, which is
chosen by the initiating party and put that unique identifier in each approach. Now this
approach looks good, but the problem with this approach is that every time you need to
design a unique identifier and you need to ensure that identifies is unique globally. So,
ensuring that identifier is unique globally, again the problem is that what would be your
algorithm to generate that identifier and even if you design an algorithm to generate a
unique identifier, which will be able to sustain even after a system is getting crashed, you
have to obviously, use certain kind of hardware trigger here because you want to initiate
that even after the system get crashed and recover from that crash, it will not use the old
identifier that is being utilized once. So, that is why this particular algorithm also has a
amount of overhead associated with it.

(Refer Slide Time: 18:33)

261
So, the third possible solution that we can utilize is to design a mechanism to kill off the
aged packets or the old packets in the network. So, that is just like the restricting the
packet life time. So, if you look into the problem that we are facing it is because of the
delayed duplicates. So the duplicate packets which have been transmitted earlier, but that
got stuck somewhere in the network, now those packets have been being transferred to
the other end. So, whenever those have been transferred to the other end, then the other
end is in a confusion whether that delayed duplicate is just because the system has got
crashed and now recovered and sent a new packet, new connection request packet or it is
just delayed duplicate of the old connection request packet through which the connection
has already been established.

So, if because all this problems, our life becomes complicated because of this delayed
duplicate. If we can eliminate the possibility of delayed duplicate from the network, then
this entire solution become simple. Now the question comes that how we will be able to
eliminate the delayed duplicate from the network.

And the solution is that if you associate with a packet life time with every individual
packet that you are sending in the network, then you can say or you can design the
protocol that well, once you are sending a new connection request message, you will
make sure that the old connection request message it has already died off or it has
already been taken out of the network, because it is lifetime has been expired.

So, this particular solution 3, it makes it possible to design a feasible solution.

262
(Refer Slide Time: 20:19)

Now let us see that how you can designed it is solution. So, the first requirement is that
you need to restrict the packet lifetime you need to design a way to restrict the packet
lifetime. So, there are 3 different ways to restrict the packet life time. The first one is that
you make a restricted network design; that means you prevent the packets from looping.
You can have a maximum delay bound which also include the congestion delay on every
individual packet.

And if a packet expires that particular time from its originating time, then that packet is
automatically dropped from the network. The second is start second solution is that you
put a hop count information in each packet. So, the idea is that whenever you are sending
a packet in the transport layer in that packet you put a maximum hop count value say the
maximum hop count value is 10.

Now, whenever a packet is being traversed over the network then every individual hop
just reduces that hop count. So, whenever it goes to the first a hop router it reduces it
from 10 to 9. Whenever it goes to the second hop router the second hop router reduces it
from 9 to 8 and that way it goes on. And whenever that hop count becomes 0, it will
simply drop that packet. So, this is a very feasible solution which is in that used in
today’s network, to ensure that a packet is not hopping in the network for infinite
duration.

263
The third possible solution is you put a timestamp with each packet and that particular
timestamp will define the lifetime of a packet. But this particular solution is not very
feasible or not very practical from a network perspective because in that case you require
proper time synchronization among individual devices in the network, which is very
difficult to achieve in a real scenario. Because whenever you have 2 difference system
there will be a certain clock drift between these 2 system. So, ensuring this lifetime based
on the timestamping of each packet where you will be requiring strict synchronization
across different devices, ensuring that is little bit different.

So normally go to the second solution that we put a hop count information at every
individual packet and whenever the packet is being delivered by the network layer to the
routing algorithm, at every individual router or a at every individual hop, it decrements
that hop count value. And whenever it reaches to certain maximum hop, when the hop
count value becomes 0, during that time that the router if it receives a packet or receives
a data packet with hop count value 0, it simply drops that packet.

(Refer Slide Time: 23:04)

Well our entire design challenge here is that, we need to guarantee not only that a packet
is dead, but all acknowledgement of it are also dead. So, this is an interesting
requirement, because whenever you are sending a connection request message it may
happen that from the server side and here is the client side, say from the client side, you
have sent a connection request message and then the client got crashed and it has

264
restarted again say it has restarted again at this point, now here it receives the reply
message.

Now, if it replies the reply message and just before sending, the reply message if it has
sent another connection request, then by looking into this reply the client will be in a
dilemma up whether this reply is the reply corresponds to the old request or it is the reply
corresponds to this new request that it has just sent out. Because remember this, so
although for the explaining purpose I am marking it has blue and brown, but the client
cannot see it as a blue or brown. So, the client just looks into that it is a reply to the
connection request message that it has already sent out and it has got a reply. So, it is in a
dilemma or it will not be able to correctly decode whether that reply is the delayed
duplicate or because of this crash failure the reply of the earlier connection request that it
has sent. So we need to design mechanism to prevent this kind of things so that the client
actually be able to differentiate between this blue and brown. And it can find out that
well the reply message that it has received it is the reply corresponds to the blue request
and not the brown request and it can correctly drop that particular reply message. So, we
need to guarantee that not only a packet is dead, but all acknowledgement to that packets
are also dead.

(Refer Slide Time: 25:06)

So, let us see that how we can do this or how we can handle the delayed duplicates
during the case of connection establishment. So, we define the maximum packet lifetime

265
T. And we make it sure that if we wait for this T duration, then if you wait for this T
duration then, you can be sure that all traces of it, that means, the packet and also its
acknowledgement, they are now gone from the network. So, all the packets and all the
traces of its acknowledgement are dead.

Now, to ensure that in case of a generic transport layer protocol which is also utilized in
the concept of TCP. So rather than using a physical clock because the problem of having
a physical clock is that you require clock synchronization which is difficult to achieve in
the internet scale, we use the concept of a virtual clock. So, what is this virtual clock?
This virtual clock is a sequence number field which is generated based on the clock ticks.
So, it is just like that every individual packet that you are sending out, that individual
packet will contain a sequence number. And by looking into the sequence number, you
will become sure whether that particular packet was the intended packet or not.

So, the questions comes says that how will you design that sequence number or whether
there is still a problem even if you design a sequence number in mechanism.

(Refer Slide Time: 26:39)

So, here is the broad idea that you label every segment to a sequence number, and that
particular sequence number will not be reused within that T second duration. So, what
we say that within that T second duration every segment or every packet that I have sent
into the network, it will die off, the packet will die off as well as all traces of that packet
that means if there is certain acknowledgement for that packet they will also get die off.

266
So, with this particular principle you can say that if you are not going to reuse that
sequence number, within that T second of duration, you will be able to ensure that at any
time, there would be only a single instance of a packet with a unique sequence number.

So, just giving you an one example say you have transferred the packet of say sequence
number 1 2 5, sequence number 125 and you say T equal to 1 minute; that means, you
are trying to ensure that once you have transmitted packet, with say sequence number
125 within this 1 minute duration, this particular sequence number 125 is not going to be
reused. If you can ensure that then you know that after 1 minute duration, the packet that
you have send to it sequence number 125 that is going to die off from the network. So, so
the packet will be there in the network for 1 minute and within that 1 minute duration, if
you are not sending any other packet with the same sequence number the same sequence
number 125, then you will be sure that well no traces of this packet no other traces or the
duplicate traces of the packets will be there in your network. So, so that way you will be
able to ensure that whenever the other end will receive a packet with this sequence
number 125, that is the only packet that is traversing in the network or not a delayed
duplicate of that particular packet. So, this period T and the rate of packets per second
determines the size of the sequence number.

So, we want to ensure that at most one packet with a given sequence number maybe
outstanding at any given time. So, it is just like that once you have sent a packet with a
sequence number 125 within that T second duration or within that T duration, you do not
send any other packet with the same sequence number. So, only that packet with the
sequence number 125 is outstanding in the network within that particular duration.

267
(Refer Slide Time: 29:31)

So, here we have 2 important requirements that we need to ensure. So, this 2 requirement
was published by Tomlinson in 1975 in a part breaking work titled “Selecting Sequence
Numbers”. So, the first requirement is that the sequence numbers they must be chosen
such that a particular sequence number refer never refers to more than 1 byte. So, if you
are using byte sequence numbers. So, byte sequence number means that for every
individual byte that you are sending in the network they has a sequence numbers.

So, that TCP type of protocol it uses byte sequence number rather than the packet
sequence numbers. So, in case of a packet sequence number for every individual packet
that you are transferring in the network, you put one sequence number for the packet, for
the byte sequence number, every individual byte that you are transferring in the network,
you put one sequence number for that.

So, the byte sequence number is something like this like if your packet has some 100
byte data. So the packet has 100 byte data, so in the header field you have 2 different
field. One is this sequence number and another is the length. So the length says that you
have 100 byte data, the sequence number field is a 500; that means, in this particular
packet you have data from 500 bytes to 600 bytes, 501 bytes to 600 bytes. So, you have
total 100 bytes of data.

So, that way you can use the byte sequence numbering to individually identify every
bytes in the networks. So, that would be useful later on we’ll see for ensuring segment

268
wise delivery on top of a transport layer protocol. So, the requirement here is that every
sequence number that you are sending to the network, it indicates to only a single byte
not more than 1 bytes, so there should not be more than 1 bytes in the network for the
same source destination pairs which are referenced by a single sequence number.

Now, in this case the challenge comes that how will you choose the initial sequence
number? The initial sequence number is required during the connection establishment
face, when you are trying to send data to a remote host. So, that was the first
requirement. We will see that how you can choose the initial sequence number during the
connection establishment phase.

(Refer Slide Time: 32:05)

And the second requirement is that the valid range of sequence number must be
positively synchronized between the sender and the receiver, whenever a connection is
being used. So, this means that whenever you have set up this initial sequence number,
then all the subsequent bytes will follow that sequence number. So, this is basically
ensured by the flow control algorithms.

So, later on will see the different types of flow control algorithms, which actually ensures
that once the sender and the receiver or the client and the server has agreed upon the
initial sequence numbers, then the flow control algorithm ensures that well the packets or
the bytes that you are going to transfer, it follows that sequence of the sequence number.

269
(Refer Slide Time: 32:58)

So, the one example can be something like this, say you have a client and you have a
server. Now the client sends request message with say initial sequence number as 1000,
and the server sends a reply mentioning that it accepts the initial sequence number as
1000. Now once this connection establishment is being done, then all the subsequent
packets that is being sent by the client it follows this sequence number space.

So, the first packet say it will start from 1001 and it has the length of 50 bytes. So, this
things I am writing in the form of ‘sequence number, length’. So that means, the first
packets starts from 1001 and it has a length of 50. The second packets starts from then
1051 and it can have a length of 100 then the third packet starts from 1151 and it can
have a length of another 50.

So this particular thing the sequence number is that at what sequence the packets will be
transferred, that is handled by the flow control algorithm. So later on we’ll see that how
flow control algorithm actually ensures that. So this particular mechanism we call it at
between the client and the server between the two ends, you should have a positive
synchronization for ensuring that every individual packets are having following the
sequence number, which have been established during this initial handshaking phase and
the sequence numbering follows that particular principle.

Now, here you will see that once this initial handshaking is done, the problem is gone,
the problem will be taken care of by the flow control algorithm, but the problem is the

270
first requirement which was there, that how will you choose this initial sequence number.
Because for this subsequent packets, say this is packet 1, this is packet 2, this is packet 3,
for the subsequent packets you have this referencing, the reference of the sequence
number that which particular sequence number you are going to use based on what
sequence number has already been utilized.

So, this individual sequence number like 1001, 1051, 1151 they are known, once this
initial hand shaking is done, but this initial sequence number it is unknown. So, that need
to be established and during this establishment of the initial sequence number you need
to ensure that whichever initial sequence number you are going to use, that is not going
to be reused to within certain duration of T.

So, that time bound need to be there and within that time duration that initial sequence
number is not going to be reused such that the server it can differentiate between a
correctly sent connection request and the delayed duplicate of it. So, so that is the broad
requirement that we have in the context of connection establishment.

(Refer Slide Time: 36:16)

Well so this is the problem that we have, like once a particular machine it is once a
particular machine it is trying to send the data it has chosen one initial sequence number,
and it is transferring the data on top of the network and we have a packet lifetime T. And
that means, every by that you are sending using this sequence number field, that will be
there in the network for this time duration T.

271
Now if this connection get crashed and if you are initiating another connection with this
initial sequence number, say with this initial sequence number, then the problem is that
you can see that here you have 2 different packets you may have 2 different packets,
which are there in the network, one is the old packet from the connection 1 which was
still there in the network and the new packet from connection 2. So, there can be a
confusion. So we want to avoid this kind of confusion here, that we want that well the
connection 2 should not initiate from this point. Rather a connection 2 will either initiate
from this point, so you wait for sufficient amount of duration, and then initiate the new
connection with a new sequence number so that you can become sure that this
connection 1 and connection 2 there sequence number field doesn’t get overlap, doesn’t
get overlap.

(Refer Slide Time: 37:51)

Or the second thing is that you use the sequence number which is high enough from the
sequence number field that you have used for the connection 1. During that time, you
also be able to ensure that the sequence number zone of connection 1 and connection 2
they doesn’t get overlap and there is no confusion in the sequence number.

So, that is our requirement. So you want to either either wait for a duration so, that we
make ensure that all the previous bytes with the old sequence number that are gone out
of the network or you use a initial sequence number, which is high enough compared to
the previous sequence number that has been utilized for this connection establishment, so

272
that the connection zone of 2 nodes they doesn’t get with each other. So here in this
diagram this, particular zone this blue zone or here this red zone we call is a forbidden
range. So, we call it as a forbidden range okay? Because once one sequence number is
being used, you should not reuse the sequence number anymore.

So, in the next class we will look into the details about how you can design a mechanism
for selecting the initial sequence number so, that you can avoid the overlapping of the
forbidden zones for two different connection. So, see you all in the next class.

Thank you.

273
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 13
Transport Layer – II (Connection) (Contd.)

Welcome, back to the course on Computer Network and Internet Protocol. So, we are
looking into the transport layer and the connection establishment mechanism in the
transport layer. So, in the last class we have seen that well whenever you are setting up a
logical connection between 2 end host of a network, the challenge is the delayed
duplicate packets.

(Refer Slide Time: 00:52)

So, the delayed duplicate packets may create a confusion like during the connection
establishment phase that whether the packet that you are being received, say if you have
received the delayed duplicate message, whether that delayed duplicate message is or in
other words if I say it more clearly like whenever you receive a duplicate message, you
do not be sure or duplicate connection establishment request you cannot be sure whether
that duplicate message is a delayed duplicate of the earlier one or the client has crashed
and it has re-initiated the connection with the server and that connection request message
is coming from that one.

274
So, what we have looked till now that will the way we can mitigate this problem is by
utilizing a virtual clocking mechanism with the help of sequence number, where we are
utilizing the concept of byte sequence number that every byte in the network will have a
unique sequence number. And during the connection establishment phase, we need to
generate the sequence number in such a way so, that the other end like here in the
exampled a server can correctly identify from a duplicate message that whether this
duplicate connection request is the delayed duplicate of the old connection request or it is
a new connection request after the client has crashed.

So, to do that it can look into the sequence number field and it can find it out, but we
need to ensure here that this connection request sequence number, the initial sequence
number that has been utilized for connection request, it is not going to re-use within a
time duration T which is the maximum packet life time in the network. So, you need to
ensure that with this time out duration T, every instances of a segment or here we are
using byte sequence number. So, every instances of a byte with the sequence number is
only one such instances outstanding in the network. There are not more than one
instances of the same byte in the network, same byte means the byte with the same
sequence number in the network which can create confusion for the other end, for the
receiver.

(Refer Slide Time: 03:09)

275
So, we are looking into this problem from the context of this forbidden region. So, what
we see that whenever connection 1 connection selects one sequence number - so this
particular dark black line indicates, so this line indicates the sequence number that a
particular connection is going to use with the respect of time. Now, if it is using this set
of sequence numbers, so every byte with that sequence number they have a life time here
this life time is T. So, within that life time the packet or the byte can be outstanding in
the network.

Now, in a scenario when this connection is being crashed and you want to initialize
another connection during that time, if this region of the old connection and the
forbidden region, so this region we call as the forbidden region. So, the forbidden region
of the old connection and the forbidden region of the new connection, if that gets
overlapped then there is a there may be a problem of confusion. Why? Because at this
time instance, you have you may have two different instances of the same sequence
number in the network. So, one sequence number is from the old connection another
sequence number is from the new connection. So, you can have one sequence number
from this old connection another sequence number from this new connection and we
want to avoid that. Now, to avoid that, the solution mechanism that we can employ is
something like this, like either you make it separate with respect to time.

(Refer Slide Time: 04:48)

276
That means, you wait for some amount of time before initializing the new connection
such that you become ensured that this particular sequence number which was there say
this sequence number it was completely gone out of the network. So, it is like that this
the same sequence number which was there for this connection 1, that sequence number
had a lifetime up to here. So, that sequence number is out from the network and that
cannot create a confusion anymore.

So, you wait for certain duration. So, here this is the wait duration and then you initiate
with say this is the wait duration. So you wait for this wait duration and then initiate this
new connection such that this forbidden region does not overlap with each other. So, if
this forbidden region do not overlap with each other, you will be sure that, there is
always a single instances of a particular sequence number outstanding in the network.
that is one way by shifting the connection in the time scale.

(Refer Slide Time: 06:18)

Another way is to shift the connection another way is to shift the connection in the in the
sequence number scale. So, you use the sequence number which is high enough of the
sequence number that was utilized for connection 1. So, that you became sure that well
the sequence number field that you are going to use for connection 2 that does not have a
overlap with connection 1.

So, here we are utilizing this space. So, we are we are making a gap in the sequence
number, such that we become sure that whatever sequence number that we are going to

277
use, that particular sequence number has not been used by connection 1. So, this are two
feasible way of setting the initial sequence number in the network.

(Refer Slide Time: 07:11)

Now, let us see that how you can handle the delayed duplicates during the connection
establishment by mitigating this two problem. So, if we ensure this kind of things now
when a receiver receives two segments having the same sequence number within a time
duration T, the receiver knows that one packet must be the duplicate. Say it happens that
well the sequence so, you are always ensuring that within that time duration T, the
receiver cannot receive a packet cannot receives a two different packets with the same
sequence number or two different bytes with the same sequence number. Now, if the
receiver is receiving two different bytes with the same sequence number with the
duration T then the receiver can correctly decode that the second one is the delayed
duplicate of the first one or the visa versa anything can happen and but you can you in
that case the receiver can accept one and can discard the second one that it has received.

278
(Refer Slide Time: 08:23)

Now, for a crashed device, then the transport entity that remains idle for a duration T, if
you are just utilizing this time scale, at time period based sequence numbering to ensure
that all the packets from the previous connection are dead. So, here actually we are
utilizing the first solution that I was mentioning that you wait in the time scale and
ensure that by that time all the instances of the previous sequence number is dead from
the network.

So, whenever you are going to use a sequence number there is no possibility that there
are two bytes with the same sequence numbers are outstanding in the network, but this is
not a good solution because you have to wait for certain amount of duration. So, for that
you can also choose the sequence number in such a way we will see that in the context of
the TCP that you can choose the sequence number in such a way, so that you are
significantly high above the forbidden region of the previous one and you can be sure
that the sequence number has not been utilized by the previous connection, for
connection establishment.

279
(Refer Slide Time: 09:34)

Now, the solution here is you adjust a initial sequence number properly; that means, a
host does not restart with the sequence number in the forbidden region based on the
sequence number it used before crash and at the time duration T. So, it is just like that if
the if you have if the system has crashed then whenever whatever sequence number was
there, the new sequence number that you are going to generate, you generate in such a
way, so that is above the previous sequence number. So, we will see that how we can
generate this particular sequence number.

(Refer Slide Time: 10:12)

280
Now, there can be two different source of problems. Whenever there are two connections
like whenever one connection has crashed and another connection is going to going to
use a initial sequence number field. So, let me just give you one example here. So, it is
just like that one connection it has used this sequence number and then it got crashed and
this is the forbidden region for this old connection, say I name it as connection 1.

Now, say there is a second connection. The second connection is starts from here with
the initial sequence number. Now, if the second connection starts from here with the
initial sequence number and follow this line the sequence number space, then this would
be the forbidden region, there is no overlap my life is happy. But if this particular new
connection starts sending data at a very fast rate, so if it follows this line rather than the
dotted line that I have drawn earlier, then you see that these becomes the forbidden
region and here for some packets you have a overlap. So, you have certain overlap here
in this region.

So, in this region there can be still the confusion about the sequence number whenever
you will receive a packet whether the packet belongs to connection 1 or this new
connection, connection 2 so, if if you increase the sequence number space too fast then
that can become a problem. So, that is why the sequence number need to be increased at
a constant rate or at a bounded rate. So, that the sequence number space or this increase
of the sequence number for the new connection does not overshoot the sequence number
space of the previous connection. So, that they do not overlap with each other.

281
(Refer Slide Time: 12:33)

Another problem is there for selecting this initial sequence number that the data rate is
too slow. If the data rate is too slow like in this example say the initial sequence number
was used like this then the data rate was too slow. So, it started generating the initial
sequence number at a very slow rate and after that it crashed and the new system it just
start using this initial rate that say if I name it as connection 1, that connection 1 used and
this one as connection 2 that connection was 1 used then again there is a possibility of
having a overlap here.

So, both are fast connection and a slow connection can create a problem. So, we need to
ensure that the sequence numbers are always generated at a bounded rate. So, that this
kind of overlapping of sequence numbers between two connection does not happen.

282
(Refer Slide Time: 13:30)

So, how will you do that? So, you can do that that you can bound the maximum data rate
that you can sale over a transport protocol. So, the maximum data rate on any connection
we bound it as one segment per clock tick. So, here we used the hardware clock, but only
the hardware clock of my machine. So, here we will see that we do not require the
synchronization of the hardware clock across multiple machine. So, the hardware clock
of a single machine will serve my purpose.

So, with every hardware clock tick so, the clock tick is the inter packet transmission
duration the clock ticks is adjusted based on the sequences that is acknowledged. So,
TCP uses this concept of self clocking or a virtual mechanism that whenever you
received an acknowledgement. So, this is something like a mix of the connection
establishment under flow control mechanism for handling the sequence number space
that whenever you are receiving an acknowledgement, during that time you make a tick
that you generate new packet or new segment with a new sequence number.

So, you ensure that the no two packets are there in the network with the same sequence
number. So, this also ensures that the sequence number space that do not wrap around
too quickly. So, you have a finite sequence number space in case of TCP kind of
protocol, you have 32 bit sequence number. Now, if you have a 32 bit sequence number
then you can used to 2 to the power 32 different sequence numbers. So, you need to
ensure that this entire sequence number speed does not wrap around too quickly.

283
So that means, if you are sending data at a very high rate it may happen that you are
generating the data in such a rate that you have within that time duration T or even
before the time duration T you have finished this entire 32 bit of sequence number space.
So, that may create a confusion, because that may create a confusion. So, you want to
prevent that and to prevent that you want to regulate the sender flow as well apart from
the receiver flow. Normally with the flow control algorithm, we coordinate between
these sender flow and receiver flow but whenever we are generating the sender packets
you also want to ensure that the packets which are being generated from the sender they
follow certain kind of I will not say it is a constant rate rather they are in within a
bounded rate.

So, that is why the application is generating data as its own rate and the data is being
buffered at the transport layer buffer and the transport layer picks up the packets from
there, picks up the bytes from the there and generate the segments with a predefined
bounded rate. So, that the sequence number space does not get overlapped with each
other. So, we will look all these mechanism in details. For the time being it may be little
unclear or you may have a little bit doubt that the things will be much clear to you
whenever we will look into the flow control algorithms in details, where we look into
that how flow control actually helps in adjusting this entire sequence number space.

(Refer Slide Time: 16:40)

284
Now, the second thing is that, if you remember that the Tomlinson’s, from the
Tomlinson’s proposal that our first requirement was to have a to have a way to selecting
the initial sequence number. So here, what do you want that we do not want to remember
the sequence number at the receiver side. So, the receiver does not want to remember the
old sequence number rather the sender will manage its own sequence number.

So, for that we use a three way handshake mechanism, to ensure that the connection
request is not a repetition of the old connection request. Now, the individual peers they
validate their own sequence number by looking into the acknowledgement. So, this
provides the positive synchronization among the sender and the receiver.

(Refer Slide Time: 17:28)

So, let us look into how this three way handshaking works. So, whenever host 1 is
sending a connection request message. Host 1 sends the sequence number value x, so,
here host 1 sends the sequence number value x and host 2, it sends back with an
acknowledgement. With the acknowledgement it also puts that sequence number x and it
also. So, in case of transport layer normally our connections are bi directional because
the connections are bi directional with this particular acknowledgement, the host 2 also
sends another acknowledgement, sends another sequence number it for reverse
connection from host 2 to host 1 that is the sequence number y.

Now, whenever the host 1 receives an acknowledgement with sequence number x host 1
can verify whether this sequence number which was there in the acknowledgement it is

285
the original sequence number or not it is the sequence number of the connection request
message that is sent it is corresponding to that or not. If it is OK, then it can send the data
with that sequence number x and at the same time it can also send acknowledgement for
the sequence number space or the sequence number that was proposed by host 2 for host
2 to host 1 data transfer. So, this three way handshaking ensures that their all the delayed
duplicates are correctly identified by both host 1 and host 2. So, let us see that how with
this mechanism they can correctly identify delayed duplicate of the sequence numbers.

(Refer Slide Time: 19:12)

So, let us see a case when the connection request is a delayed duplicate. Now, if the
connection request is a delayed duplicate so, the host 2 has received the delayed
duplicate connection request with the sequence number x. So, it sends back with an
acknowledgment of that x. Now, host 1 can verify that this particular acknowledgement
that it has received it is not for a connection request that it has sent. So, that connection
request was a old duplicate that it has sent long back and now host 1 do not want to use
that connection anymore, maybe host 1 has crashed here and then it got and restarted
here, then it got restarted here. So, it do not want to use that old connection request that it
has requested earlier.

So, host 1 can find it out and if it finds out that this acknowledgement is a
acknowledgement a sequence number field which is there in acknowledgement message
it is for a delayed duplicate, then it can send a reject message. By looking into the reject

286
message, host 2 can identify that the connection request that was sent that it was received
it is not going to be accepted by host 1 anymore. So, there is no point in establishing the
connection.

(Refer Slide Time: 20:27)

Now, let us look into another case when both the connection request and the
acknowledgement are delayed duplicates. Now, when the connection request is a delayed
duplicate and host 2 sends back an acknowledgement here with this sequence number x
which it was received as a part of the connection request message and it proposed with a
new sequence number y during that time it gets a reject message. But for the old
duplicate that it has sent, say it has received one acknowledgement here, this
acknowledgement says that it is a sequence number for x, but the acknowledgement
number says that well the acknowledgement number is z.

Now, if you look into this three way handshaking mechanism these acknowledgement
numbers should corresponds to the acknowledgement number should corresponds to the
sequence number that was proposed by host 2 in it is acknowledgement. Now, these two
are not matching. So, host 2 will reject this duplicate acknowledgement. At the same
time, host 1 whenever it has received this acknowledgement message and it finds out that
it do not want to use this acknowledgement anymore because it has crashed here and say
restarted here, then it can sends the reject message.

287
So, with this way you can identify that both the connection request was a delayed
duplicate that was identified by host 1 and it sends a reject message and host 2 whenever
it looks a different acknowledgement number, acknowledgement z acknowledgement
number z compare to the one which it has sent with its own acknowledgement whenever
it finds out that there is a mismatch here; there is a mismatch here it simply discard this
acknowledgement. So that way, you can properly differentiate between with the help of
this sequence number between the normal connection request messages and a delayed
duplicate connection request messages.

(Refer Slide Time: 22:44)

Well so, that was the all about the connection establishment. So, what we have broadly
seen here just to give you a summary of the entire procedure, the connection requesting,
so what we have seen that because packets can get dropped in a packet switching
network, there can be arbitrarily delay in transferring the packet, there can be loss
because of this reason, there is always a possibility of having a delayed duplicate.

Now, what we have learned till now that my major problem is to select the initial
sequence number for connection establishment. Once this initial sequence number is
established, then the flow control algorithm takes care of maintaining the sequence
number for the data pack is that will look later on that how flow control algorithm
actually helps you to set up the sequence number for the data packets or the data
segments in the context of the transport layer.

288
But, the challenge here is to select a initial connection request request in such a way, so
that you can ensure that the forbidden region of a new connection does not get overlap
from with the forbidden region of an older connection. Where both the new connection
and older connection are initiated on the same application at the same source destination
pair. So, they are likely to use the same port. So, in that case our objective is to separate
out a normal connection request from a delayed duplicate connection request and in that
case we take the help of a sequence number.

Now, we have looked into that how to chose a initial sequence number, but whenever
you are choosing the initial sequence number you have to ensure that well your initial
sequence the sequence number field does not increase too fast or too slow such that it
gets overlapped with another connection. In that particular context this rate of control of
sequence number that is taken care of by the flow control algorithm and we ensure that
well the packets are generated or the bytes are not, I will not say generated that the
transport layer transmits the byte transfers the byte in such a rate, so that it is not too
slow or not too fast all the connections follow almost a bounded rate.

But, whenever you are selecting the initial sequence number, you can use this three way
handshake mechanism for selecting the initial sequence number such that such that even
if your connection request is the delayed duplicate or the connection request or the
corresponding acknowledgement is the delayed duplicate you will be able to differentiate
between the old connection and the new connection, by ensuring that the sequence
numbers are not generated from the forbidden range of the previous connection. And you
are making sure that no two bytes in the networks are having same sequence number
between the same source destination pair coming from the same application at the same
time instance.

Now, let us look into the connection release. Connection release is little bit easier
compared to connection establishment because we do not have the problem of sequence
number here, but here we have a different problem. So, there can be two type of
connection release, so one we called as a asymmetric release. So, the asymmetric release
says that when one party hangs up the connection is broken. Now, it is just like that
whenever host 1 is ready to or whenever host 1 is done transferring the data, host 1
breaks the connection. Say it may happen that host 2 now wants to wants to close the

289
connection, host 2 simply sends the connection release message. So, here it is DR data
release message, host 2 sends the data release message and host 2 goes to sleep.

Now, even if host 1 has some data to send to host 2 that particular data if any host 1 sent
it, host 2 may not be able to receive that data. So, there would be a possibility of data
loss with this concept of asymmetric release.

(Refer Slide Time: 27:13)

Now, we can have another variant of these connection release which we call as the
symmetric release. Now, in case of a symmetric release you treat the connection as two
separate unidirectional connection, every individual connection is treated as two separate
unidirectional connection and it requires that each one to be released separately.

So, when both one is released the connection, then the final connection will get released.
Now, this is good when this particular symmetric release is good when each process has
a fixed amount of data to send and it clearly knows that when it has sent it. So, it knows
it has an idea that when it has sent a particular data, but the question comes that can we
design a protocol for the symmetric release? So, let us look into a very simple protocol
that host 1 will say that, I am done; host 2 will say that I am done too. So, when both are
saying that I am done and this one is saying I am done too they will release the
connection. Let us see that whether this protocol works good always.

290
(Refer Slide Time: 28:23)

So, we map this protocol in the context of a problem called two army problem. So, we
have a white army which is there in a valley and the blue army which was there in the
hill now you see that the total total fighters in the blue army it is more than the white
army, but they are separated now, they are in the two part of the hill. So, they need to
communicate with each other to make sure that both of them attack simultaneously; both
of them are able to attack simultaneously then they only they will be able to defeat the
white army otherwise they will be not able to defeat.

Now, the problem here is that if the blue army wants to send a message called attack, this
blue army 1 wants to send that message to blue army 2 they have to go back the valley
which is the vulnerable position. So, it may always happen that one soldier of white army
is able to see that the soldier of the blue army and kill that person and the message is not
delivered in the other way. So, the environment is unreliable.

Now, whenever the environment is unreliable you can see that you will never be able to
make a protocol, correct protocol to solve this particular problem that both the blue army
will come into consensus and they will be able to attack the white army simultaneously
because whenever you are you are sending one soldier of blue army via this valley, blue
army 2 is may not get that particular soldier, message from that particular soldier and
they will not be able to sure that whether to make an attack or what is the current

291
condition. So, we cannot have one protocol to solve this particular problem. So, in this
case the best way you can do is that let every party take their own independent decisions.

(Refer Slide Time: 30:22)

So, that is the protocol we implement here that every individual host so host 1 it will
send the data release message and then it will start the timer. Similarly, host 2 it will send
the data release message and it will start the own timer, whenever it is receiving the
message from host 2 within this time out value it will release the connection and it will
send the acknowledgement, and if host 2 is getting this acknowledgement message
within this timeout value it will release the connection.

292
(Refer Slide Time: 30:59)

Now, let us see that how this protocol works when the acknowledgement is lost. If this
final acknowledgement is lost say this final acknowledgement is lost; if this final
acknowledgement is lost then this host 2 it has started it is timer after sending the data
release message it will not get the acknowledgement. So, it will wait for the time out
value whenever the timeout will occur it will release the connection.

(Refer Slide Time: 31:28)

Then say this particular data release message from host 2 got lost. So, if this data release
message from host 2 got lost, so here host 1 has sent a data release message with host 2

293
received and host 2 has sent another data release message. So, host 1 will get a timeout,
after it will get a timeout it will again send the data release message. So, once it sending
a data release message host 2 will receive that message it will again start the timer send
the data release message. So, once it is it is getting these data release message it will
release the connection, send the acknowledgement and once host 2 will get that
acknowledgement, it will release the connection.

(Refer Slide Time: 32:10)

Now, let us see another scenario when both the data release and the acknowledgement
are lost. So, here this data release is lost and as well as the acknowledgement is lost. In
this case so, if both this messages are getting lost then both the node will wait for a
timeout value. So, here you can specify that host 1 it will try for N different timeouts and
once this N T different timeout occurs it will release the connection and host 2 it will
wait for similarly for the timeout value once the timeout occurs it will release the
connection.

So, here we are we are basically making the protocol from a asymmetric view that we
will wait for certain timeouts and if you are not able to solve the problem with that
timeout value then you independently release the connection, but as we have seen earlier
in case of asymmetric connection there is always a possibility of having a data loss. So,
this particular lecture it has given you the idea about the fast services, fast of the services
which is being supported by the transport layer of the protocol stack, where we need to

294
establish the connection between two remote host which is a kind of logical pipe to
establish the hello messages between two end and because of this reliability problem in
the network, we see that ensuring the connection establishment is a challenge. You can
you can argue that well I have the reliability protocol then why should I bother about all
this difficulties during this connection establishment.

But, you remember that the reliability only comes that when you have set up this initial
sequence number. So, then you can apply your flow control and the reliability protocol
which will look later on we call them as the automated request protocol ARQ protocol.
So, this ARQ protocol they can take care of the loss by retransmitting the packet because
they have a reference frame through which you can it can utilize the sequence number
field.

But, whenever you are setting up the initial connection during that time you do not have
any initial reference frame, like from where you will start the sequence number. If every
connection starts from sequence number 0 then that can be a problem because of that
forbidden region concept that we have looked at here.

Now, to solve this particular problem we have seen that well, by utilizing this self
clocking mechanism through the hardware clock or by clocking from the
acknowledgement you can generate the sequence number fields ensuring that the
sequence number of a connection for the same source destination pairs with the same
port they do not overlap with each other. And at the same time, you are ensuring the
sequence number in such a way, it should be higher enough from the previous sequence
number, so that they do not get overlap and finally, once this sequence number is
established to this three way handshaking mechanism and, during that time you have
seen that if there is a loss or a delayed duplicate of the messages, the other ends will be
able to correctly decode that.

In the context of connection release you have seen that well symmetric release is a good
option - asymmetric release is a good option, but you cannot design a protocol for
asymmetric release in a in a unreliable channel. So, that is why we go for a symmetric
release with the timeout value. So, you will try to make a symmetric release, if you are
not able to do that within certain number of timeout then you forcefully close the
connection. There is always a possibility of data loss, but as I have mentioned earlier

295
there is always a trade off between the performance and the correctness. So, here we are
not going for a protocol which will be completely correct. There can be certain amount
of data loss always due to this symmetric release mechanism. But, our target is to
minimize it as much as possible by utilizing that timeout value. The timeout ensures that
whatever packet that has been sent by the other end, that will reach at the destination
within that timeout value.

So, that is all about the connection establishment and connection release. In the next
class we will look into another service in the transport layer. So, thank you all for
attending the course.

296
Computer Networks and Internet Protocol
Prof. Sandip Chakraborthy
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 14
Transport Layer – IV (Reliability)

Welcome back to the course on Computer Networks and Internet Protocol. So, in the last
classes you have looked various services in transport layer of the protocol stack, and we
have looked into in details the connection establishment and the connection termination
procedure. So, today we look into the second services which is the flow control and the
reliability in transport layer.

(Refer Slide Time: 00:40)

So, the flow control and reliability ensures that whenever you have established certain
end to end connection between the two remote host, so on top of that connection, now
you need to send a sequence of data.

So, in transport layer in TCP kind of protocol you send it in the form of sequence of
bytes. On the other hand in certain version of transport protocols, the data is transmitted
in the form of sequence of packets or sequence of segments. So, in this end to end
connection which is being established on the two end of the devices, the two end devices,
here our objective is the first objective is that the sender should not send more data
compare to what the receiver can receive.

297
So, this particular methodology or this particular philosophy, we call it as a flow control
algorithm. So, the flow control algorithm ensures that the sender is always aware about
what a receiver can receive or how much data the receiver can receive. And, accordingly
the sender adjusted its rate of transmission, such that it does not overshoot the rate at
which the receiver can receive. At the same time, as we have discussed earlier that the
lower layer of the protocol stack is kind of unreliable.

So, whenever the network layer forwards packets or forwards data to an remote host, the
network layer does not ensure that there is a kind of guaranty or assurance that your data
will be delivered at the other end. So, it makes a best try to deliver your data based on
your destination address and finding out the intermediate hops through which the packet
need to be delivered. But on the other hand, this network layer it does not bother about
that how much data need to be pushed to the network or how much data need to be
transferred.

And as a result what happens in a packet switching network that I described in the last
class, that the intermediate buffers, at the intermediate network devices that at the
routers, they may get filled up and you may experience a buffer over flow from those
intermediate routers. And because of that whenever you are delivering a data through this
network layer using the IP delivery method, there is always a possibility that a
considerable number of data frames or data segments, they are getting dropped from the
from the network layer.

Now, the task of the transport layer is to consider that to find out or to sense whether
certain data has been transferred correctly at the other end or not and if it is not
transferred at the other end correctly, then apply this reliability mechanism to ensure that
every message which is send by the application layer that is getting delivered at the other
end eventually.

So, the broad idea is that you sense the channel, you sense the media to find out whether
the data is being transmitted correctly or not, if the data is not being transmitted
correctly, that means, the other end is not able to receive the data. If you are able to find
it out, then retransmit the data to make sure that eventually the data is received by the
other end receiver.

298
Now, in a typical transport layer this flow control and reliability are implemented
together. So, we look into the different mechanism through which we implement the flow
control and the reliability algorithms over the transport layer of a TCP/IP protocol stack.
So, let us proceed with the detailed mechanism of that one.

(Refer Slide Time: 04:25)

So, this is the broad idea of ensuring reliability. So, as I have mentioned that your
network layer provides you an unreliable channel. So, the network layer does not
guarantee that the packet that it is trying to deliver at the other end it will be eventually
transmitted. So, there is always a possibility of buffer overflow from the intermediate
routers because of which there is a possibility of data loss.

Now, we are we are having some hypothetical function or hypothetical method which is
through which we are making a interaction among different layers to make you
understand about the entire procedure. Now if you just think about from the application
perspective, the application always wants or the application always try to have an
methodology through which you will be able to ensure reliability.

So, that means, the application always wants that if a sender is or a sending process is
sending certain message or certain data, that data will be eventually received by the
receiver. So, the receiver will receive all the messages. So, you can just think of an
application like a file transfer. So, the entire large file is divided into multiple chunks and
then the sender process sending the data bits for that file.

299
Now, at the receiver end you need to ensure that all the data that is send by the sender
that is received eventually otherwise you will not be able to reconstruct the entire file.
So, that is why from the application perspective, reliability is at most importance for
many of the application. But as I have mentioned earlier that they are exist a certain
group of applications where reliability are is not that much important; rather delivering
the data or delivering the messages more important within a predefined time or duration.
And in that cases we use UDP type of protocols where reliability is not a concern or
reliability is not used. But for the application, for the set of applications when reliability
is a concern, during that time the application always expects that the data or the message
that is transferred from the application, they will be eventually received at the receiver
side.

Now, the application here expects a reliable channel. So, the question comes that your
network layer is unreliable. So, on these unreliable channels, how can you express or
how can you write a methodology to ensure reliability. So, the idea is there that at the
transport layer, you have this reliable data transfer protocol at the sender side and the
receiver side.

So, this sending sending process at the network layer it is unreliable send “udt_send()”,
that express a unreliable way of sending the data. On top of that you are implementing
this reliability mechanism which is ensuring that reliable data send on top of the
transport layer.

So, whenever you are making a interfacing between the network layer at the transport
layer, there you have this unreliable data send and at the interface of transport layer and
the application layer, you have the interface of reliable data send.

Now, at the other end it receives the data in a reliable way because of this reliable data
send mechanism which is there and this reliable data transfer protocol at the receiver
side, eventually it will receive the message and it will deliver the data to the application
layer.

So, that way the application layer will always expect a reliable delivery of the messages.
And here we will see that in the transport layer, how can you implement this two
mechanism at the sender side, and at the receiver side which will help you to ensure
reliability in the system.

300
So, let us look into this process in details. So, as I as I discussed earlier during the
discussion of a different layer of the TCP/IP protocol stack, that certain services are
implemented in multiple layers of the protocol stack. So, this flow control and error
control these are the two mechanism which are implemented both at the transport layer
and the data link layer. So, the question comes that, why do we need to implement flow
control at the transport layer as well as the data link layer.

So, if you if you just ask the question in this way that let us assume that I have my flow
control algorithm in the data link layer which is being implemented, do I need to have
the flow control algorithm at the transport layer itself?

(Refer Slide Time: 09:05)

So, let us look into one example where you have this flow control algorithm at the data
link layer. So, the data link layer ensures this hop by hop flow control algorithm. So, as
we have learnt already that your data link layer protocol, it ensures the hop by hop
principles, the hop by hop transmission of data where as the transport layer, it ensures the
complete end to end delivery of the data. Now whenever we are saying that the flow
control algorithm is implemented at the data link layer, it is like that this hop by hop flow
controls are implemented.

So, if you think about this as the intermediate routers R1, R2 and R3 and this is the
source and this is the final destination. So, these flow control algorithm at the data link

301
layer, it ensures that you have flow control mechanism between S and R R1 between R1
and R2 between R2 and R3 and between R3 and the D.

Now so, this hop by hop flow control algorithms are there. Now the question comes if I
have this hop by hop flow control algorithm, do I still need to have a flow control
algorithm at the transport layer? Now just think of a scenario that well this link from S to
R1, it is 10 mbps; the link from R1 to R2, it is 5 mbps; the links from R2 to R3, it is 3
mbps and the link from R3 to this D this is 1 mbps.

Now, what happens here that whenever you are implementing this hop by hop flow
control at the data link layer, then from S to R1, the S finds out that well I can send the
data at a rate of 10 mbps. So, it sends the data at a rate of 10 mbps. But then R1 finds out
that it will not be able to send the data to R2 at a rate of 10 mbps, although it is receiving
the data at a rate of 10 mbps, but it requires 5 mbps of transmission. Similarly R2 it finds
out that it will not be able to send data at a rate of 5 mbps; rather it need to sends the data
at 3 mbps and finally, from R3 to D it can only send the data at a rate of 1 mbps.

Now, if S does not know that this entire, so if you look into the effective rate of this
entire end to end path. So, this effective rate of this entire end to end path will be equal to
1 mbps. Now if S does not get this information, S will try to push the data at a rate of 10
mbps and what will happen that R1 will not be able to deliver the data to R2 and so on.

So, that way that additional data which is coming to R1; so, R1 is receiving the data at a
rate of 10 mbps, but it is only able to deliver the data at a rate of 5 mbps. So, that as a
result this additional data that it is receiving, it will get on filling up the buffer space
which is available at R1 and eventually what will happen, that eventually we will
experience the data loss from the buffer due to buffer over flow.

So, there will be a huge amount of data loss because source is transmitting data at a rate
of 10 mbps, but the receiver the other end, receiver is only able to receive data at a rate
of 1 mbps. And as a result this 9 mbps of data that will get accumulated over the different
layers of buffers at different intermediate routers; and after some time it will experience a
drop of data from those intermediate buffers, and this the reason that we are not able to
implement. If we implement this flow control algorithm only at the data link layer for
hop by hop flow control, it is not sufficient. We have to implement it at the transport
layer.

302
Now, let us look into the other way around - like you have this end to end flow control
algorithm and in that case, still we still we require that this flow control algorithm at data
link layer or not. Now in transport layer, what happens that you are only ensuring the end
to end data delivery or end to end flow control algorithm?

(Refer Slide Time: 13:03)

So, you have one router with which your source is getting connected. Then you have this
intermediate network, then another router and then your destination which is there. And
you are only ensuring the flow control among these two end host and just think about the
earlier example that you are sending data at a rate of 1 mbps.

Now, you just think of two intermediate routers here in the network. Now this router has
multiple incoming ports. So, it is just like a road network that you are getting data from
multiple parts all together. So, you are getting data from this link, you are getting data
from this link, you are getting data from this link and so on.

So, that way it may happen that which link is pushing data at a rate of 1 mbps, but this
individual links may push data at a rate of 2 mbps and say this link is pushing data at a
rate of 5 mbps. But this out going link it only has a speed of say 3 mbps. In that case
because this multiple incoming link are getting converged in a intermediate router, it may
happen that the total incoming rate which is being there from multiple others incoming
links that is exiting the total out going capacity that the router has. And because of that
this end to end flow control algorithm, it may perform poorly in this kind of scenario. So,

303
that is why to make it control to have a control, you need hop by hop flow control
mechanism in the network. But here you will see by applying this hop by hop flow
control algorithm in the network. So, what your task would be? Your task would be to
reduce the incoming rate at every individual hop such that intermediate routers is
experience less congestion, less amount of congestion.

So, by doing that you are effectively improving the performance of the system, but
remember that by even after implementing the hop by hop flow control, it may not be
possible to possible to ensure complete reliability that a complete elimination of data
loss. Because you are receiving data from multiple hops and every, where there is a kind
of estimation going on that what should be the ideal rate at which the one ensure send the
data at the other end, and this is the estimation takes some time. So, before the systems
moves to the convergence there is always a possibility of having a significant amount of
data loss.

So, you will not be able to completely eliminate the data loss by applying this hop by
hop flow control mechanism, but certainly you can improve the performance. And that is
the reason we say that flow control mechanism, the error control we will discuss later on.

(Refer Slide Time: 16:03)

The flow control and this error control mechanism at the transport layer; they are
essential whereas the flow control and the error control mechanism and the data link
layer they improve the performance of your protocol.

304
Now, let us look into different type of flow control algorithms and before going to that,
why do we require this different kind of end to end protocols in the network. So, for that
I suggest all of you to read through this particular paper which was which was published
by Saltzer Reed and Clark. So, it is a fundamental paper in Computer Networking that
talks about that, why do you require this kind of end to end protocols in the internet
when there is this hop by hop protocols already existing. So, I suggest all of you to read
this particular paper to get more details about the principles which you are adopted in the
TCP/IP protocol stack to implement this kind of end to end protocols over the internet.

(Refer Slide Time: 17:02)

Now, let us look into this flow control algorithm. So, the simplest flow control algorithm
that we have, we call it as a stop and wait flow control algorithm. So, the stop and wait
flow control algorithm in a error free channel works as follows. The protocol is pretty
simple - that you send a frame or you send a packet and then, you wait for its
acknowledgement.

So, once the receiver receives this frame, it sends back an acknowledgement and the
sender it waits for the acknowledgement before sending the next frame or the next
packet. So, once you are receiving this acknowledgement, then you only send the next
frame. So, that way every frame has an acknowledgement associated with it and only
when you receive the acknowledgement you transmit the next frame.

305
Now, if it is a error free channel it is always guaranteed that eventually the receiver will
receive the frame and it will be able to send you back the acknowledgement and the
sender will eventually receive the acknowledgement, because it is an error free channel
and there is no loss. So, once you are receiving the acknowledgement, you are sure that
the receiver has received this particular frame and so, you transmit the next frame.

So, that is the broad idea of this stop and wait protocol. So, you stop after sending
transmission, start sending the next frame, after sending one frame then, wait for the
acknowledgement; one you have received the wait, then you send the next frame.

(Refer Slide Time: 18:21)

Now, let us look into this flow control algorithm in a noisy channel, the same Stop and
Wait protocol. So, here we use the concept of sequence numbers to individually identify
each frame and the corresponding acknowledgement. So, every frame is associated with
one sequence number. So, if you look into this example, this frame 0 is associated with a
sequence number. So, this 0 is the sequence number for this frame and then, we are
getting an acknowledgment. So, this acknowledgement mechanism it is sending
acknowledgement 1; it is sending acknowledgement 1 means that B has correctly
received frame 0 and then it is expecting for frame 1.

So, then you send the frame 1. So, once you have B has receive frame 1, then it sends
acknowledge 0; that means, B has received frame 1 and it is waiting for the
acknowledgement 0. So, that way in a noisy channel, the first reason is the first principle

306
is that you separate out every frame with by using the a corresponding sequence number
which will be uniquely identify every frame in the channel.

Now, because it is a noisy channel, there is a possibility of having a frame loss because
this frame is being lost from the network. So, if there is a frame loss, so we will not send
back any acknowledgement. So, you wait for a timeout value. So, A will wait for a
timeout value and once this timeout expires, then A will returns with the frame.

Now, one interesting question here is that what can be the maximum size of the sequence
number in stop and wait? So, in stop and wait you can see that at one instance of time,
only one frame can be outstanding in the network. So, whenever you have send frame 0,
unless you are getting the acknowledgement from that frame; you will not send the next
frame. So, that is why 2 bit sequence number will be sufficient and because of this reason
you can see from this diagram that, every frame is associated with one sequence number
and the sequence numbers are 0’s and 1’s. So, repeated 0’s and 1’s so; that means,
whenever you have send frame 0, unless you are getting this acknowledgement with the
expected frame 1; you will not send frame 1.

So, you can always be sure by looking at the acknowledgement that which for which
frame this acknowledgement corresponds to. If you are getting an acknowledgement 1;
that means, you have correctly received frame 0 and you are expecting from for frame 1.
So, that is the reason that we use 2 bit sequence number for a this flow control algorithm
using stop and wait and this kind of algorithm where we are utilizing the concept of
sequence number and applying flow control algorithm in case of a noisy channel, and
you can see that by applying this flow control algorithm in a noisy channel, we are also
ensuring reliability in the system.

So, we are also ensuring that the receiver receives all the frames correctly. So, if there are
if a timeout occurs then you retransmit that frame again. So, that this frame 0 eventually
receives by the receiver B. So, that way you are also ensuring reliability in the system
and this flow control and reliability algorithm all together, we call it as a automatic
repeat request or ARQ algorithms.

So, now onwards we look into these ARQ algorithms in details, the different versions or
the different variance of ARQ algorithms.

307
(Refer Slide Time: 21:41)

Well, so this is a kind of sender side implementation of this stop and wait ARQ algorithm
in the form of a state transition diagram.

So, here the thing is that this you can think of the initial state. So, the initial state talks
about that you wait for call 0 from above; that means, you are waiting for frame 0
initially. So, the event which is there it is in the sender side. So, you are from the
application layer you are sending a reliable data delivery. Now once this things happens.
So, at the transport layer side, you are making a call to reliable data delivery to send with
this data.

Now, how it ensures the reliable data delivery? So, you need to map this rdt to the
corresponding udt call because if you remember that earlier, we have seen that at the
network layer the calls are unreliable calls like this udt calls. So, for that what you are
doing that you are appending one sequence number with this packet you are providing
the data and some checks some checksum, we will discuss later on to ensure the error
free transmission of the data. Then you are sending the data over unreliable channel and
starting the timer.

Now, whenever you are waiting for the acknowledgement 0, you are moving to the state
that you have sent the packet 0. So, you are waiting for the corresponding
acknowledgement. So, here once you are receiving a packet and if you are finding out
that the packet is corrupted and in that case, you are in the same loop, you again wait for

308
an acknowledgement. If a timeout occurs, then again you send the packet, you retransmit
the packet through this udt send mechanism. You retransmit the packet and start the timer
again. And then once you are receiving the acknowledgement, then you move to this
state, that wait for call one because you have received that acknowledgement, now you
want to send the next frame that is frame 1. So, in that case you have received the packet
from the upper layer and once you have received that packet and that packet is not a
corrupted packet and it is the acknowledgement corresponds to frame 0. So, you are
moving to this state. Once you are in this state in that case, you are waiting for receiving
the packet from the upper layer. So, once you have received the packet from the upper
layer, then you make this send call with the data with this frame 0 and the same process
gets repeated that you append this sequence number; sequence number 1 along with the
data and the corresponding checksum and then send the packet through the unreliable
channel. And you move for waiting for that corresponding acknowledgement. And the
same process gets repeated, that if you are receiving the data and the packet is corrupted,
you are in this loop. If a timeout occurs, then you transmit the packet again and start the
timer again and then whenever you are receiving the acknowledgement; that means, you
are receiving a non corrupted packet and you have received the acknowledgement
corresponds to frame 1; then you stop the timer and wait for this frame 0.

So, that way you send this frames one after another frame 0’s and frame 1’s, one after
another and you move through this state transition diagram to send the packets one after
another. And ensure proper flow control along with the reliability in the system.

309
(Refer Slide Time: 25:19)

Well so, let us look into the problems which are associated with stop and wait type of
flow control or ARQ algorithm. In stop and wait ARQ, first of all every packet needs to
wait for the acknowledgement of the previous packet. So, until you are receiving the
acknowledgement for the previous packet, you will not be able to send the next packet.

Now, for if you think about bidirectional connections, for bidirectional connection, you
can use two instances of stop and wait. One instances of stop and wait will ensure one
instances of stop and wait will ensure transferring of data from A to B and another
instances of stop and wait will ensure transferring data from B to A, but this will again
result in a significant waste of network resources that for both the side you have to wait
for the acknowledgement.

So, one possible solution to solve this particular problem is that you can piggyback data
and acknowledgement from both the direction. But even if you are piggybacking data
and acknowledgement for the both the directions, so piggybacking here means that
whenever you are sending a data frame, along with the data frame, you also adds up the
acknowledgement.

So, this data is say this is going for sequence one and along with the data with sequence
one you send the acknowledgement for the previous one which is coming from B to A.
So, it is like that say this is B and this is A. From B to A you are sending one data packet;
for B to A whenever you are sending a data packet say A has earlier send a packet to B.

310
You are sending the acknowledgement along with whenever you are sending the data
packet to A.

So, although this piggybacking mechanism is more efficient compared to compared to


this using these two instances of stop and wait, but still it is wasting a huge amount of
resource because for all packets you need to wait for the acknowledgement.

So, you will not be able to parallely transmit the packets in the network. So, to solve this
problem we use a class of flow control algorithms which we call as the sliding window
protocol. So, sliding window protocols are a pipe line protocol where you can send
multiple frames or multiple packets altogether without waiting for the corresponding
acknowledgement. So, you can send multiple frames and all the frames can go in a
pipelined way.

(Refer Slide Time: 27:49)

So, a broad idea of this sliding window protocol is something like this. If you look into
the stop and wait protocol, so the stop and wait protocol you are sending only one data
packet. So, only one data packet can be outstanding in the network.

So, once this data packet is received by this receiver, then this receivers send back the
ACK and once you are receiving that ACK at the sender, then only you will be able to
send the next data packet. In case of my pipeline protocol or the sliding window

311
protocol, what we do that we can send a sequence of packets and parallely we can
receive the sequence of acknowledgement.

So, that way we will be able to use this pipeline concept over the network where you
could be able to send a sequence of packets all together and parallely you can receive a
sequence of acknowledgement. So, that way, you will be able to utilize the network
resource more efficiently because nowadays, now with this particular approach of sliding
window protocol, you will be ensuring that more number of packets can be pushed to the
network if the network has that much of capacity. And parallely we will be able to
receive the acknowledgement and you will be able to adjust your transmission rate
accordingly so that you can receive the packets correctly at the other end.

So, this is the broad idea of the sliding window protocol. And in the next class we look
into this sliding window protocols in details.

So thank you all for attending the class.

312
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 15
Transport Layer – V
( Sliding Window Protocols )

Welcome back to the course on Computer Network and Internet Protocols.

(Refer Slide Time: 00:24)

So, in the last class we have discussed about this flow control and reliable data delivery
protocols over the transport layer and we have looked into the details of the stop and wait
flow control and reliable protocol; which we call as the stop and wait ARQ.

313
(Refer Slide Time: 00:44)

And there we have see that this stop and wait protocol in case of stop and wait protocol,
one major disadvantage is that, you can have only 1 packet outstanding in the network
and that is why you are not able to utilize the full capacity of the link. So, for every out
going packet you have wait for the acknowledgement, unless you are receiving the
acknowledgement, you will not be able to send the next packet.

In case of the sliding window protocol we want to ensure a pipeline version of the
protocol where you can send multiple packets all together in a pipeline fashion. So, we
will look into the details of the sliding window protocol about how we can achieve this
pipelining and at the same time you can receive the acknowledgement parallelly and
accordingly control your transmission rate.

So, the broad idea is something like this if you look into this diagram you can see that
initially I started sending 1 packets, here I am I have started sending 1 packets and once I
receive the acknowledgement for that 1 packet, I increase my window size to send more
packets in parallel. So, here we are sending 3 packets in parallel, then again we have
increased it to 4 packets and that way, you can push the packets parallelly in the network
such that by following a mechanism, such that it does not exceed the capacity of that
particularly link. So, let us look into different sliding window protocols in details.

314
(Refer Slide Time: 02:13)

So, the broad idea of a sliding window protocol is as follows, that each outbound
segment in the network, it contains a sequence number. So, the sequence number field is
from starting from 0 to some maximum sequence number say for example, if you are
using a n bit sequence number, then the sequence number space can go from 0 to 2n-1.

Now, the sender it maintains a set of sequence numbers corresponding to the frames it is
permitted to send. So this particular set of sequence number we call it as a sending
window, similarly, the receiver it maintains a set of frames which it is permitted to
accept, we call it as the receiver window or receiving window. So, let us look into an
example in details to clear this concept.

315
(Refer Slide Time: 03:01)

So, here in the sender side so, this bounding box is the sending window. So, what does it
mean? So, this is the sending window here and this is the receiver window or the
receiving window. Now, the sender window indicates that well at a time you can send
frames or packets from 0 to 6 without waiting for the corresponding acknowledgement.
So that means, you can send this frames in parallel. So, you can send a frame 0, then
immediately you can send frame 1, then you can send frame 2 without waiting for the
corresponding acknowledgement.

And the receiver window say that here the receiver window side is 1 2 3 4 5 6 7 so,
receiver window says that well you can receive 7 frames all together and once you have
received 7 frames, you will not be able to receive any further frame without sending back
an acknowledgement. So, what happens here that well the sender keep on sending the
frame and once the sender gets back an acknowledgement, so, here say in this example
the sender has transmitted frame 0 followed by frame 1 followed by frame 2, it is
sending the frames in parallel without waiting for the acknowledgement, but whenever
the receiver has received frames 0’s and 1’s it sends the acknowledgement for frame 0.

Whenever, the receiver is sending the acknowledgement for frame 0, so, the sender what
it does that it shifts the sending window for 1 unit. So, it has already received the
acknowledgement for this frame so, it does not bother about this frame anymore because
this frame has correctly being transmitted. So, my sending window becomes from 1 to 7,

316
once you have received acknowledgement for 0. Similarly, the receiver window also get
shifted because you have already send a acknowledgement for frame 0; that means, this
frame 0 has correctly received and you do not bother about this frame anymore.

Then you send the receiver sends the acknowledgement 1, so, once the sender receives a
acknowledge 1, so, frame 1 has also been correctly transmitted it is able to know that
information. So, it sends it shifts the sending window for 1 again, now my current
sending window becomes 2 to 2 3 4 5 6 7 and again starts from 0. So, this is the repeated
sequence number. So, we will look into the relation between these windows size and the
sequence numbers in the subsequent discussion.

So, that is the idea of this sending window and the receiving window. So, the sending
window basically says that you can send that many number of frames without waiting for
an acknowledgement. So, if you are if you have sent all the frames of your sending
window and you have not received an acknowledgement, you will not be able to send
any more frames any further until you are receiving an acknowledgement and you are
shifting the frames to the right side. So, that is the broad idea about the sliding window
protocol.

(Refer Slide Time: 06:04)

So, here is an example of a sliding window protocol with a 3 bit sequence number. So, if
you have a 3 bit sequence number, that means, your sequence number space can be from
0 to 23-1, that means, from 0 to 7. So, here is the sequence number from 0 to 7 so, say at

317
the sender side you have sent one frame. So, this is a example where we are using this
sequence number field in a circular queue fashion. So, after sequence number 7 again the
next frame will be marked as sequence number 0 and we are considering as window size
of 1.

So, my window size is equal to 1, so window size of 1. So, the sender here it has
transmitted say 1 frame so, once this sender has transmitter 1 frame, the sender is
blocked at that position. So, the receiver is expecting for receiving this frame 0, so, the
initially the sender has not transmitted any frame, but the receiver is expecting frame 0,
receiver is expecting frame 0. Now, sender has transmitted say frame 0 and the sender is
blocked here because my window size is 1 and sender is transmitting the frame, the
frame is on the channel, receiver is still expecting frame 0, now say receiver has received
frame 0. So, once receiver has received frame 0, receiver is expecting from frame 1 and
receiver has say send back the corresponding acknowledgement. So, the
acknowledgement is there in the channel the sender is again blocked with the frame 0,
because it has transmitted that. Once the sender receives that acknowledgement, so it has
now at this position so, the sender is ready to send frame 1 and the receiver is at this
point expecting from frame 1. So, a sliding window protocol window size 1 is somehow
synonymous to a stop and wait flow control algorithm, because for every individual
frame you are waiting for the acknowledgement, but if you increase the window size
gradually you will get the feel of parallelism.

So, if you make the window size 2 from 1: that means, you can send 2 frames in parallel
without waiting for the acknowledgement. So, once you are you have sent 2 frames then
you wait for the acknowledgement and in between if you receive an acknowledgement,
you can slide the window. So, that from there the name sliding window comes, you can
slide the window and you can send frame 3. So that way this entire sliding window
protocol works.

318
(Refer Slide Time: 08:43)

So, let us look into that how the sliding window protocol work in a noisy channel. So, in
case of a noisy channel, similar to the stop and wait protocol we also implement
similarly a timeout mechanism. So, if you have transmitted data segment, if that segment
is getting lost or sometime the acknowledgement can also get lost. If the segment or the
corresponding acknowledgement get lost and you have already sent all the frames or all
the segments in your in your say, sending window, and you are waiting for the
acknowledgement corresponds to that then, a timeout may occur.

And if a timeout occurs then the question comes that which particular frame you will
retransmit. So, the question comes that: how does this ARQ protocol will handle the
timeout? So, timeout occur means, the receiver was not able to receive the frame
correctly and in case of a sliding window protocol you have send the set of frames and
for those set of frames the receiver has not received the frames, either the frame has been
lost or the corresponding acknowledgement has been lost. So, the question comes that
how does sender will react to it this particular loss when a timeout has occurred in the
network.

So, there are two different mechanism to handling this timeout, one mechanism is called
as go back N ARQ and the second mechanism is called a selective repeat ARQ. Now in
case of an go back N ARQ if a particular segment say segment N is lost then, all the
segment starting from segment 0, so, here I am assuming that segment 0 is the start of the

319
sliding window to segment N are retransmitted. So, in a broad way that all the frames,
which are there in the current sliding window all those frames are retransmitted if there is
a timeout.

In case of the second methodology which is called as the selective repeat ARQ in case of
selective repeat ARQ, you only send the lost packet or you selectively transmit
retransmit the packet which has been lost in the channel. Now, whenever we say that you
need to selectively transmit the lost packet or which has been not received by the
receiver or the corresponding acknowledgement has been lost and the sender has not
received that acknowledgement.

Then; obviously, there should be some mechanism to identify those packets because, the
first mechanism there go back N ARQ is simple enough. If you are having a timeout; that
means, you have not received an acknowledgement and you are not receiving an
acknowledgement means you retransmit all the frames, which are there in your window
your current window. But, if you are going to selectively retransmitting the frame then
you have to identify that which particular frame has been lost.

So, for that we have one special type of acknowledgement which is there in selective
repeat ARQ, we call them as the negative acknowledgement NAK or some time in TCP
it calls selective acknowledgement or SACK. So, this negative acknowledgement NAK
or SACK, they informs the sender about which packets need to be retransmitted; that
means, the receiver has not received those packets and it is expecting those packets.

So, those information is passed to the sender with the help of the NAK packet or with the
help of this SACK packets. So, this NAK and the SACK packets the negative
acknowledgement and the selective acknowledgement packets, it helps you to find out
that which particular packet is expected by the receiver and like that receiver has not
received those packets and it retransmit only those packets. So, let us look into this two
protocols in details the go back N ARQ and the selective repeat ARQ.

320
(Refer Slide Time: 12:36)

Well first let us look into this go back N ARQ so, this go back N ARQ the sender
window implementation is something like this. So, here we maintain two different
pointer so, one is called the base pointer so, this base pointer is the pointer from where
your current window starts. So, your current window starts from here so, this is pointing
by the base pointer so, base pointer. So, this indicates that all the frames before this base
pointer has been acknowledged.

So, this frames has been already acknowledged. Well so, you have already received
acknowledgement for this frames, now these are the frames in your current windows. So,
this is the this is your current window so, the base pointer points to the start of the
window and in this current window you can send multiple frames without waiting for the
acknowledgement and assumed that you have sent up to this frames. So, this setup
frames sorry so, not so, this set of frames has been transmitted.

So, this next sequence number this is another pointer so, this next sequence number
points to the frame which you can send without waiting for the acknowledgement. So, up
to this frame you have already sent and you are waiting for the acknowledgement for
these frames and then you can send this particular frame further without waiting for
anymore acknowledgement.

So, that way with the help of these three parameters the base pointer which points to the
starting of the current window, the next sequence number: the next sequence number

321
points to the frame which you can transmit without waiting for the acknowledgement and
the window size parameter: the window size parameter indicates that what is your
maximum window size; you can maintain the sliding window at the sender sides sender
side, for go back N ARQ.

Now, here if your next sequence number if your next sequence number becomes equal to
your base plus window size: that means, you have transmitted all the frame. So, here
actually in this diagram, base plus window size plus 1 if it is like this so, if you the next
sequence number is pointing to this white frame; that means, it is out of your window,
current window. So, you cannot transmit this frame unless you are receiving the
acknowledgement for this frames which you have already transmitted.

So, once you have received these frames so, you can shift the base pointer. So, if you
received the acknowledgement for these 5 frames up to this frame then, you can shift the
base pointer from here to here and accordingly the window size becomes here to 5 more
frames up to here. So, you will be able to utilize this next sequence number to send more
frames in parallel.

(Refer Slide Time: 15:52)

OK, now the go back N ARQ mechanism in a noisy channel works in this way. So, you
have transmitted say frame 0, frame 1 and at this pointer the receiver has sent
acknowledgement 0. So, you have transmitted frame 2 then, frame 3 when once you have
received the acknowledgement 0 then; that means, you can reset the timer for 0.

322
And you can send 3 because, it belongs to your current window size you transmit the
frame 3 and then you received the acknowledgement number for 1 once you are
receiving the acknowledgement for 1 you can reset the timer for 1 and you can send
frame 4 because you have you have more provision to send more frames in the current
window and you transmit frame 4.

Now, at this point say assume this acknowledgement from receiver gets lost. So, once the
acknowledgement from receiver gets from this receiver gets lost so, you are keep on
waiting for getting this acknowledgement because, at this point you are full with your
current sender window so, we are here assuming that my window size is 3. So, because
my window size is 3 so, window size is equal to 3 because my window size is equal to 3,
so you have already received acknowledgement for 0 and 1, but now you are you have
transmitted frame say transmitted frame 2, 3 and 4 and you are waiting for the
corresponding acknowledgement. And here this acknowledgement for 2 got lost, so this
timeout for 2 is running.

So, after some time, this timeout will for 2 will occur. So, once this timeout for 2 will
occur, you retransmit all the frames here so, in case of go back N ARQ. So, in your
current window you had the frame 2, 3 and 4. So, you again retransmit frame 2, frame 3
and frame 4 and again then you can get the acknowledgement immediately for
acknowledgement 2, acknowledgement 3 and acknowledgement 4 once, you are getting
this 3 acknowledgement, acknowledgement 2 3 and 4 then you shift the window further
from 2 3 4 to 5 6 7 so, by transmitting those frames. So, that way this entire go back N
ARQ protocol works and the broad idea is here that once this time out for 1 frame
occurs, then you retransmit all the frames which were there in your current window.

323
(Refer Slide Time: 18:26)

Well so, this is the implementation of the go back N ARQ so you are in the waiting state
initially. So, you start with the base as 1 and the next sequence number 1. Now you are
going to getting a call for reliable data send from the application layer. So, you check
whether your next sequence number is less than base plus N, if your next sequence
number is less than base plus N; that means, you are able to send more data. So, you send
the packet with that particular sequence number, you construct the packet by appending
that next sequence number along with the data and the checksum.

So, that way you are constructing the packet and with this sequence number next
sequence number and then you are utilizing this unreliable channel at the network layer
to transfer this protocol. Now, if your basis becomes equal to the next sequence number
you start the timer and increment the next sequence number OK? So, that is the case and
otherwise you refuse the data so, otherwise you refuse the data means from this else is
coming. So, if your next sequence number is greater than base plus N, that means, you
are trying to transfer a frame - you are receiving a frame which is outside your current
window. So, if it is outside your current window you do not transmit that frame.

Now, if a time out occurs you again start the timer and sent all the packets from base to
next sequence number minus 1. So, you transmit all the frames which are there in your
current window. Now whenever you are getting a packet and that packet is not corrupted,
in that case you are checking that what is the corresponding acknowledgement number

324
and you are updating the base pointer accordingly. So, you are updating the base pointer
according to the acknowledgement number that you have received plus 1 so that means,
if this is your window size and this was the base pointer, now you have receive the
acknowledgement for this one. So once you have received acknowledgement for base
one this one, then you move the base pointer to your next frame. And if the packet is
corrupted, then you do not bother about that, you are again in the wait loop. So, that way
you can implement this go back N ARQ mechanism.

(Refer Slide Time: 20:46)

Now, similarly at the receiver side the receiver side whenever it is receiving a packet the
packet is not corrupted and it has the sequence number which is equal to the expected
sequence number. So, you extract the packet deliver the data to the application, construct
an acknowledgement with the expected sequence number and use the unreliable channel
at the network layer to transfer the packets and implement your expected sequence
number.

And if the default case is you transmit that acknowledgement and otherwise you just wait
it is expected sequence number you initiate the system with expected sequence number
1. So, that is the way we implement the receiver at the receiver side for go back N ARQ.

325
(Refer Slide Time: 21:41)

Now, let us look into that what is the relation between the window size at the sequence
number in case of go back N ARQ. Now, in case of go back N ARQ the frames that have
been transmitted, but not yet acknowledgement acknowledged those frames we call as
the outstanding frames. Now assume that MAX sequence MAX SEQ MAX sequence
this your maximum sequence number. So, if MAX sequence is your maximum sequence
numbers then you have MAX sequence plus 1 distinct sequence numbers from 0 to up to
MAX sequence. So, this is the available sequence number space which is there with you.
So, if you are using say n bit sequence number then this MAX sequence is 2 n-1. Well so,

you have from 0 to 2n-1 is the your total sequence number space.

Now, this maximum number of outstanding frames; assume that it is equal to the window
size. So that means, your windows size is equal to max sequence. So, that as an example
in case of our go back N ARQ protocol what we try to ensure, we try to ensure that your
windows size is equal to max sequence.

326
(Refer Slide Time: 23:06)

That means if you are using n bit sequence number then, your window size w will be
equal to 2n-1. So, you can see that it is always 1 less than the total number of distinct
sequence numbers that you have. So, for example, if your sequence numbers are some 0
to 7; that means, you are using a 3 bit sequence numbers.

So, you can have maximum number of outstanding frame equal to 7. So, your window
size can be equal to 7 and it is not 8 so, you have 8 distinct sequence numbers here from
0 to 7, but we are not making window size equal to 8 rather we are making window size
equal to 7. So, let us see why so, let us see that why my window size is equal to max
sequence and not equal to max sequence plus 1 although I have max sequence plus 1
distinct sequence numbers.

327
(Refer Slide Time: 23:59)

So, here is an example here I am taking an example, where your max sequence is equal
to 3 and window size is equal to 4. So, max sequence equal to 3 means, you have 4
different sequence number 0 1 2 and 3 and I am making window size equal to that. So, if
that is the case now think of a scenario when you have you this is your current window
size you have transferred frame 0. So, it has received frame 0 sent back the
acknowledgement, but the acknowledgement is lost then, the sender has transmitted
frame 1.

So, it has already send the acknowledgements so the receiver has shifted its window. So,
receiver has shifted its window and receiver has sent the acknowledgement 1, again this
acknowledgement got lost. The sender has transmitted frame 2 receiver has receive this
frame 2 shifted its receiving window size and it has transmitted the acknowledgement
that acknowledgement got lost, the sender has finally sent 3. So, the 3 has being received
by the receiver so, receive has received that frame it has shifted the window and it has
sent the acknowledgement again acknowledgement got lost.

Now, here is a typical example, where the receiver has correctly received all the frames,
but it was not able to send the acknowledgement, it has sent the acknowledgement, but
all those acknowledgement got lost in the channel so, all this acknowledgement got lost.
Now in this case, now the sender will experience a timeout because the sender has not
received any acknowledgement from the receiver side. So, sender will get a timeout and

328
sender will send this frame 0 so, when the sender is sending this frame 0 unfortunately
here in the receiver side you can see the receiver is also expecting frame 0, but that is the
next group of frame.

So, this is the next group of frames not the intended frames. So, this was the actual
intended frame, but you have sent a frame with sequence number 0, you have send this
frame, but a receiver will correctly think this frame has this expected frame 0 which is
not the correct frame. So, we see that there is a problem here when all the
acknowledgement got lost in the channel.

(Refer Slide Time: 26:16)

Now, let us see the an example that when your max sequence is 3, but the window size is
also 3 and the window size is not 4. In that case, the sender has send 0 1 2 3 1 and 2
because my window size is 3 you can send maximum up to 2 and then you have to wait
for an acknowledgement. Now in this case, if all the acknowledgement gets dropped so,
you can see that the receiver is now expecting from frame 3 and the sender will
retransmit frame 0 or better to say from 0 to frame 2. Now whenever the receiver is
sending the frame 0 to frame 2 the receiver will be able to correctly decode that these are
not the expected frame.

So, it will be able to discard the wrong frames correctly and send an acknowledgement to
the sender saying that this frames I have received. So, it will be able to find out that well
the sender has possibly not received the acknowledgement, it will retransmit those

329
acknowledgement. If the sender gets back those acknowledgement, then the sender can
shift the window further and start transmitting the data from frame 3. So, you can see
here in this example that with maximum sequence as 3 and window size as 3, we will be
able to correctly find out that whether retransmission is a duplicate one, is a delayed
duplicate or a new one.

So, here in this case the receiver is expecting frame 3 because of the retransmission you
are retransmitting frame 0 1 2 the receiver will be able to correctly decode that, which
was not possible in the earlier case that we have looked into. So, because of this we keep
window size 1 less than the maximum sequence number space that you have. So, if you
have n bit if you have n bit window size then we have sorry, if you have n bit sequence
number then, you have 2n-1 as your maximum window size.

(Refer Slide Time: 28:22)

OK, now let us look into the selective repeat protocol. In case of selective repeat protocol
what you can do that you can acknowledge intermediate frames and some frames may
remain unacknowledged. So, what we have seen that in this particular case in case of
selective repeat, you do not need to need to retransmit all the frames once there is a
timeout, rather you selectively retransmit the frames. So, here in the sender window size;
it may happen that well there are some intermediate frames here this had been same, but
not yet acknowledged, but the frames here this frames they got acknowledged so this
intermediate acknowledgements are there.

330
Now in the receiver side the this is the receiver view of the window size, so the receiver
it also has a base pointer, this base pointer points that well the receiver is expecting to
receive this particular frame. And, it has not received this frame and it has received all
other frames which is received out of order because this particular frame has not been
received yet rather you have received this frames. So, this has received out of order so
you have put those frames in the buffer and send the acknowledgement for them.

So, that is the view of window for the sender and the receiver where certain intermediate
packets got acknowledged and some of the packets that are not got acknowledged and
the packets which are not got acknowledged, that need to be retransmitted. So, this is the
idea of the selective repeat ARQ.

(Refer Slide Time: 30:04)

So, you are transmitting frame 0, then you are transmitting frame 1, at this time you are
you have transmitted both frame 0’s and 1’s. So, here we use something called a
cumulative acknowledgement. So this cumulative acknowledgement says that well, once
you are receiving an acknowledgement 2, that means, frame 0’s and 1’s have been
received correctly and you are expecting for frame 2.

Now, assume that you have transmitted frame 2, once you have got this
acknowledgement the sender shifts the window, once the sender shift the window and it
has the transmitted frame 2 assume that that frame 2 got lost and then it is able to send
frame 3. So, it has transmitted frame 3 so, the receiver has received frame 3 once the

331
receiver has received frame 3 then it has received this frame out of order because it has
not received frame 2, but it has received frame 3.

So, it puts frame 3 in the buffer and sends a negative acknowledgement. So, once the
sender receives this negative acknowledgement it retransmits frame 2. So, that is the idea
of the selective repeat ARQ where you can send this negative acknowledgement and
keep the out of order frames in the buffer. And from this negative acknowledgment the
sender will be able to understand that which frames needs to be retransmitted and
accordingly those frames are being retransmitted.

(Refer Slide Time: 31:32)

Well, similarly we look into a bound on the window size for selective repeat. Similar to
the earlier case, so, we have MAX sequence plus 1 distinct sequence numbers from 0 to
MAX sequence. But in this case, in selective repeat, my window size will be max
sequence plus 1 divided by 2. So, an example is that if you have 3 bit sequence numbers
from 0 to 7. So, you have 8 different sequence numbers, so, your number of outstanding
frames; that means, your maximum window size will be equal to 2 3/2 which is equal to

4. So, 23/2; that means, MAX sequence plus 1’s becomes 2 3, 23/2 which is becomes
equal to 4.

332
(Refer Slide Time: 32:24)

So, let us see an example that why this holds true so, similar to the earlier case here you
need to remember that whenever you are sending certain frames, the sender can send
acknowledgement in between. So, negative acknowledgement in between. So, here the
sender has sent so, I have taken an example where my MAX sequence is 3. So, if my
MAX sequence is 3; that means, my earlier ideal window size should be equal to 2 to the
power if my max sequence is 3 then my window size should be equal to (3 + 1)/2; that
means, equal to 2, but here we are using a window size 3, 1 more than the actual it is
window size that we should use.

So, here let us see that what is the problem if my window size is 3, then the sender sends
all the frames 0 1 and 2 and then similar to the earlier case that all the acknowledgements
are lost. Now, if all the acknowledgement are lost the receiver has received frame 0 1 and
2 so, now, the receiver expecting frame 3 0 and 1 and sender gets a time out, once the
sender gets the time out, sender starts sending frame 0. So, once the sender frame 0, now
in this case remember that the receiver can receive frames out of order which were not
possible in the case of go back N ARQ. But because the receiver can receive frames out
of order, receiver will think this 0, as this 0 which it was expecting, but this was not the 0
it 0 that was being transmitted, this 0 was being transmitted. So there would be a
confusion here. So, let us see that by utilizing window size as (3 + 1)/ 2 = 2 how can we
solve the problem.

333
(Refer Slide Time: 34:12)

So, here we keep the window size as 2 so, if I am keeping window size as 2 then the
sender sends 0 and 1 and waiting for the acknowledgement similarly all the
acknowledgement got lost. So, it has sent frame 0 and 1 and so, it is expecting frame 2
and 3, but if there is a time out here the sender retransmits frame 0. When the sender is re
transmitting frame 0 it can correctly find out that it is expecting frame 2 and 3 not frame
0 and 1 so, it can discard the frame correctly. So, we can see that particular confusion
which was there that can get resolved if I using window size as max sequence plus 1 by
2. So, here it is equal to 2 3 plus 1 by 2 equal to so, with this particular window size we
are able to resolve this particular confusion. So, that is all about the sliding window
based flow control algorithms, the go back N ARQ and selective repeat ARQ mechanism
which helps you to send the packets in a pipeline fashion and at the same time helps you
to resolve for loss. So, in the next class we’ll look into some other aspects performance
aspects of transport layer protocol and during the discussion of TCP we will see that how
this flow control algorithms are actually implemented in TCP type of protocol.

So, thank you all for attending the class.

334
Computer Networks and Internet Protocol
Prof. Sandip Chakraborthy
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 16
Transport Layer Performance

Welcome back to the course on Computer Network and Internet Protocols. So, in the last
class we have looked into to the two different services of transport layer. So, we have
looked into the connection establishment in details and then, the flow control and
reliability support protocols like this ARQ protocols in details. We have looked into three
variants of ARQ protocol - the stop and wait protocol and two different sliding window
ARQ protocol go back N and selective repeat.

(Refer Slide Time: 00:54)

So now, we look into certain performance issues in transport layer and along with that
we will look into that how we can improve the end to end performance of a protocol or
during the data transmission. So, here our broad objective would be look into the details
of transport layer protocol performance and how you can improve it by incorporated
incorporating certain additional features over the transport layer.

335
(Refer Slide Time: 01:20)

So, the first things that we are going look into in details is a parameter which has
significant impact over the transport layer protocol. And based on that you can modify
the protocol parameters or you can tune the protocol parameters or some time it will also
help you to choose that which variant of protocol you should use in a practical purpose.
So, for example, by this time you already know three different variants of ARQ
protocols; the sliding window ARQ, the two different sliding windows ARQ go back N
ARQ and selective repeat ARQ and along with that stop and wait ARQ.

Now, if I ask you the question that for a typical network like said some network
parameter is given that the network has this capacity, this end to end capacity, this is the
amount of delay for transmitting a packet. The question comes that can you tell a feasible
choice of which particular sliding window type of protocols or whether you are going to
use this stop and wait ARQ protocol. So, which particular ARQ protocol you are going to
use for your network.

So, for that, one important parameter that will help us in this decision making is
something called a bandwidth delay product. So, first we look into the details of
bandwidth delay product and its implication over the selection of window size for sliding
window protocol as well as the choice of choice of particular protocol in protocol
designing.

336
So, let us look into the concept of bandwidth delay product. So, as the name suggests that
bandwidth delay product is product of link bandwidth and the link delay. If you consider
an, end to end link. So, if your end to end link has a bandwidth of say 50 Kbps and it has
one way transit delay is 250 millisecond, then your BDP is 50 kilo bit per second into
250 millisecond comes to be something similar to 12.5 kilo bit.

So, if you just think about TCP or transport layer segment point of view, so segment is
the transport layer data that you want to transmit. So if you think about that you have a
1000 bit segment size, so this BDP bandwidth delay product comes to be something like
to 12.5 segments. So, that is the definition of bandwidth delay product.

So, let us look into that how this bandwidth delay product has an impact over your
protocol performance or your design choice of a particular transport layer protocol. So,
you consider the event of a segment transmission and the corresponding
acknowledgement reception. So, this entire thing takes a round trip time. So, what is a
round trip time?

So, you have a sender here, you have a receiver here; say this is your sender, this is your
receiver and in between you have the network. The sender and receiver is connected. So,
you transmit a data frame and you get the corresponding acknowledgement. So, you have
transmitted a data and you have got an acknowledgement. So, this total time like the
moment you have transmitted the data from there the moment that you have received an
acknowledgement, if you find out this timing difference; this will give you a round trip
time or an RTT.

So, a RTT is basically twice the one way latency. So, because you can see that it will
take; if your one way latency is something similar to say 200 millisecond, then it will
take 200 millisecond to transfer this data frame and another 200 millisecond to get back
the acknowledgement frame. If you are thinking of that there is no congestion in the
network or there is no kind of uninterrupted delay or unintended delay which is their in
the network. If you just think about your network is behaving very smoothly, there is no
such intermediate delay components which will increase your delay, end to end delay.
And your delay the total end to end delay can be approximated with the propagation
delay. Then with that particular concept you can think of that well this RTT will give you
an approximate time that what will be your end to end delay of transmitting a packet

337
because you are sending the data you are getting the acknowledgement. You are
measuring the time difference between them and from there you can make an estimation
of the RTT. So, this RTT becomes twice the one way latency.

Now, if you just think about an end to end link. So, the maximum number of segments
that can be outstanding during this duration is equal to 12.5, that was your bandwidth
delay product. The one way bandwidth delay product, the bandwidth multiplied by one
way latency into your if you think about it into 2 equal to 25 segments. So, the 25
segments can be outstanding. Why this is so?

(Refer Slide Time: 06:25)

So, let us look into one example that if you just think about sender; so, this is your sender
and the other end you have the receiver. You can just think of this entire thing, this entire
logical channel in between has a pipe. Well now this particular pipe, so whenever you are
thinking about this two way communication, that you are sending data through one pipe
and you are receiving acknowledgement through another pipe, well so this is the pipe for
sending the data and this is the pipe for getting the acknowledgement.

So, the total number of request that can be outstanding within this two pipe is like the
total amount of bits that you can push in this two pipe. Now this latency is that how
much time will it take to transfer a bit from this sender to this receiver. So, if you just
think about the latency; so, this latency denotes the length of the pipe. On the other hand,
if you just think about the bandwidth, bandwidth gives the area of their, this particular

338
circle; that means, what is the cross section area of this pipe. So, that is signifies by the
bandwidth.

Now if you multiply bandwidth with latency, you can think of it as the amount of data
that can be there inside this pipe. Now because if you have two way communication; in
one way you have the data and another way you have the acknowledgement. So, by a
principle of this sliding window protocol, the acknowledgement will filled up this pipe
where as the data, will filled up this pipe, and that way the acknowledgement which are
filling up this pipe, the data will for those particular acknowledgement will be stored
inside the receiver buffer because receiver has received this data. So, this buffer will
contain the data that has been received. So, the receiver has this amount of data and the
receiver has started sending the acknowledgement. So, this acknowledgement is filling
up this pipe and at the same time the sender has sending the data that data is filling up
this data pipe.

So that way, if your bandwidth delay product is, according to the earlier example is 12.5
segment, so you can have 12.5 segments of data which is filling up this pipe say this data
is filling up this pipe. And another 12, say another 12.5 segments of data which are being
there in this buffer and the corresponding acknowledgement is filling up this second
pipe. So, that way total 25 segments of data can be there which is outstanding, so which
is there in the link as well as which is there in this receiver buffer.

So, that way you can say that your maximum window size, the sender window size
which can be there, so if you think about this as the sender window, I am writing it as
‘swnd’. So, the sender window is the maximum amount of segments that can be
outstanding in the network and for that you can wait without getting an
acknowledgement. So, if you make the sender window size equal to 25 segments, then
you can be sure that well whatever data you are pushing in the network that data will use
the entire capacity of the channel. And that way you will be able to sure that well it will
have, it will provide you maximum utilization of that end to end channel, the maximum
utilization of the pipe which is there in between the sender and the receiver.

So, this gives a theoretical bound, the maximum bound on this on this window size, the
sender window size will which will provide you the maximum capacity. Now just
relating it with the sequence number that we have discussed earlier, the relation between

339
the window size and the sequence number, so, once you choose the window size in this
way, say you have chosen the window size w in this way. Now assume that you are using
a go back N ARQ protocol, if you are using a go back N ARQ protocol and you know
that in that case, your maximum window size can be 2n-1. So, from there you can find out
that what should be what should be your sequence number space. So, how many bits you
should reserve for the sequence number such that you can have the expected window
size, and at the same time that window size will fill up the end to end capacity of the
network.

Similarly if you are using selective repeat ARQ, for a selective repeat ARQ, you know
that w is equal to 2n/2. So, you can you can select the window size in you can select the
sequence number in such a way so that this particular relation holds. So, that way am you
can you can find out the maximum window size which will provide you the maximum
utilization of the channel. And accordingly you can set up the sequence number space for
different flow control algorithm.

(Refer Slide Time: 12:16)

So, now the thing is that like this. This is the description that I have given like ideally
what we can think of that the maximum number of segments that can be outstanding
within this duration is these 25 segments which is equal to the channel capacity plus 1.
So, this plus 1 is like that the acknowledgement for one frame which has just received by
the sender. So, the sender has not processed it yet.

340
It is just received by the sender. So, that is why we adopt this 1 here which gives you the
maximum link utilization. So, it is just like that you have filled up this entire two pipes
and one acknowledgement has just received at the sender. So, you have filled up the 2
pipes which are there in between and so, one data pipe and one acknowledgement pipe
and one acknowledgement has just received at the sender. So, that way it comes equal to
2BD plus 1.

So, the window size equal to 2BD plus 1, it will give you the maximum link utilization
where BD denotes the number of frames equivalent to BDP. So, this is an important
concept to decide the window size for a window based flow control algorithm; so the
example that I have given you earlier.

(Refer Slide Time: 13:43)

So, let us see an example of this. So, consider a network with link bandwidth end to end
link bandwidth as 1 Mbps, the delay equal to 1 millisecond and you consider a network
where as segment size is 1 kilo byte equal to 1024 bytes. Now the question is that which
particular protocol would be better for flow control whether you are going to use a stop
and wait protocol or a go back N protocol and selective repeat protocol. So, for to solve
this problem, so, we first compute the BDP, we see that the BDP comes to be 1 Milli byte
1 Mbps into 1 millisecond equal to 1 kilobyte; that means 1024 byte. So, the segment
size is eight times larger than the BDP.

341
So, here am here your BDP is 1 kilo bit and your segment size is 1 kilobyte because your
segment size is one kilobyte; that means, the link cannot hold an entire segment
completely. So, the pipe that you are considering here between the sender and the
receiver; so here this pipe assume that this pipe considers both the data and the
acknowledgement, data plus ACK pipe. So, this ACK pipe this data plus ACK pipe it
will not be able to hold this entire segment inside that because BDP comes to be 1 kilo
bit where as your segment size is 1 kilo byte.

Now in this case, the sliding window protocols do not improve performance because
why because we will not be able to send multiple segments in parallel even one segment
is not able to fill up the your pipe completely; because one segment is not able to fill up
your pipe completely. There is no reason to send multiple segments in parallel because
any way you will not be able to get the advantage of parallelization in this particular case
where your link bandwidth is 1 mega bit per second and delay is 1 millisecond.

So, under this particular case it is always good to choose a stop and wait protocol
because stop and wait protocol has the least complexity. So, sliding window protocol as
you understand, because of the design choice, it has more complexity, you have to
maintain the sender window, you have to maintain the receiver window. Then you have
to maintain the sequence number field; all this different overheads are there. But with a
stop and wait protocol, the logic is pretty simple that you send segment and then wait for
acknowledgement once you are getting acknowledgement, you send the next segment.

So, that way your stop and wait protocol will have significantly more - sorry
significantly less overhead compared to a sliding window protocol. And because here,
we see that we are not getting the advantage of parallelization, we always prefer to use a
stop and wait protocol under this particular example scenario.

So, this gives you an intuition or an example that how this parameter BDP bandwidth
delay product help you to make a design choice that which particular sliding window
protocol, you should use to improve the network performance with having minimal
complexity. And the same time the example that I have given you earlier that bandwidth
delay product will help you to choose the optimal window size that what window size
you should use such that you can utilize the maximum capacity of the network. And once
you have selected that window size and your happy with a sliding window protocol

342
based on this philosophy, you can find out that what sequence numbers space you should
use such that there is no am no confusion in the protocol design during the execution of
the protocol. Like the examples that we have looked earlier in the case of sliding window
protocols; different variants of sliding window protocols like the go back N protocol or
the selective repeat protocol. Well.

(Refer Slide Time: 17:32)

So, from here let us look into that how we basically interface the application layer with
the transport layer at the sender side. This will give a design idea that how will be able to
design a transport layer protocol. So, the example that I have taken is from the Linux
operating system. So, you have the user space and the kernel space. At the user space,
you are running certain application that is sending the data. So, you have certain system
call at the kernel the write() system call and the send() system call – we’ll look into all
this system calls later on whenever we discuss about the socket programming. So, there
are this system calls through which you can send the data to the kernel, from the
application.

Now, here you have this transmission rate control module. This transmission rate control
module based on your flow control algorithm, it will use this function. So, this name of
this function are hypothetical not directly matches to it what is implemented in the
Linux, just to give you an idea about how you can implement your own transport
protocol.

343
So, you have a function called TportSend, it is triggered periodically based on your
transmission rate control your based on your flow control algorithm; based on your
window size that how much data you can send. So, this particular function is being called
and the data is sent to IP, the next layer of the protocol stack, the network layer of the
protocol stack.

Now you can think of that this rate and this rate are asynchronous. So, here the
application can generate data at a more high higher rate compare to the rate at which the
transport layer can send the data to the other end. So, this transmission rate control may
find out that well the optimal rate is something equal to 2 Mbps where as the application
generates rate at a at 10 Mbps.

Now if this is the case, the application generates rate at 10 Mbps and the transmission
rate control generates rate of 2 Mbps.Oobviously, you need to have intermediate buffer
which will store that data.

(Refer Slide Time: 1942)

So, at whatever rate the application is generating the data, some time it may be higher
than the rate at which this transmission rate control module works. So, this application, it
will write the data in the buffer and then this TportSend() function. It will pick up the
data from the buffer based on the rate that is being provided by the transmission rate
control module and the data will be send to the next layer of the protocol stack.

344
Now, in this case it may happen that different connections, you may have different
connections at the application layer. They are treated differently. So, we need connection
specific source buffering. So, this particular buffer we call it as a source buffer. So, for
every independent connection that you have from the application layer, we have one
transport layer buffer associated with it. And then there is another interesting fact is
about this write call, the write call through which you are sending data from the
application. This write call it blocks the port. So, here is your port through which you are
uniquely identifying an application. So, it blocks the port until the complete data is
written in the transport buffer.

So, it is just like that it may happen that well some time your transmission rate control is
sending data at a rate of 1 Mbps and application is generating data at a rate of 10 Mbps,
the example that I have given earlier. So, application is sending data at a more higher rate
compared to what the transmission rate control is sending the data to the lower layer of
the protocol stack.

So, after some time; obviously, this buffer has a finite space. So, the buffer will get filled
up. Once the buffer gets filled up, so then the transport layer it blocks the application to
write any more data in that buffer to avoid the buffer overflow from this transport layer
buffer.

(Refer Slide Time: 21:39)

345
Now, let us look in to the receiver side. So, the receiver side the idea is again similar. So,
your TportRecv(), the transport receive function; it will receive the data from the
network layer. So, once it has receive the data from the network layer, it will look into
the port number in the transport layer header. So, by looking into the port number, it will
decide that in which application which transport layer queue it should fill it. So, this
transport layer queue is for one application, this transport layer queue is another
application. So, every such queue is bounded to it one port because as you have seen
earlier that this port number it uniquely identifies an application. So, based on that, you
put the data in the buffer. Now from the application side you make a read call or a
receive call which you through which you will read the data from this buffer. And here
the method is something like that whenever you are making a receive call; it will wait on
this CheckBuffer() function. It may happen that whenever the application is making a
receive call during that time, this received buffer is empty it has not received any data.
So, the call will be getting blocked here. And the moment you receive the data in this
buffer, it will send the interrupt signal to this call and this call will get the data from this
buffer and send it to the application.

So, with the help of this interrupt, we can make this receive call to interact with this
buffer. Now here you can see that this receive call, it is a blocking call, the read call or
the receive call; it is a blocking call until the data is received, then the complete data is
read from the transport buffer.

So, it is like that whenever you have made a receive call, during that time the call is
getting blocked at this port until you are getting a data in this buffer. And once you are
getting a data in this buffer, then use a this check buffer function, it will send interrupt to
the read call and the receive call and it will get this entire data from the buffer and
release this particular call.

So, that way you can see that both of this calls are kind of blocking call at the sender side
as well as the receiver side. So, the sender call gets blocked when the buffer is full, the
receiver call gets blocked when the buffer is empty.

346
(Refer Slide Time: 24:04)

So, the question comes that how can you organize this buffer pool? So, there are multiple
ways you can organize the transport layer buffer. It is a software buffer. So, in case your
segments are of same size. So, all the segments are of same size, you can organize the
buffer as a pool of identically size buffer; that means, you can hold one segment at every
individual buffer. So, a segment contains certain number of bytes. So, your individual
buffer size will be equal to your segment size and every individual buffer contains one
segment and this buffer pool they can contain multiple segments all together. Now for
variable segment size you can use this chained fixed size buffer. So, it just like a linked
list.

So, your individual buffer size is the maximum segment size and say individual buffers
are connected by a linked list kind of data structure and they entirely construct the buffer
pool for a particular transport layer port number corresponds to an application. Now in
this case, if you are using chained fixed size buffer, the space would be wasted if
segment sizes are widely varied. So, if one segment is 1024 kb, another segment is 10 kb
in that case, you can have a significant amount of free space here which is being wasted.
Now if you make a small buffer size, then you need multiple buffers to store a single
segment which adds the complexity in the implementation.

347
(Refer Slide Time: 25:41)

Now, in this case we use the variable size buffers. So, with the variable size buffer, so
here is an example of a variable size buffer. So, you have the pool of buffers which are
connected via linked list data structure and they will have variable size. The advantage is
that you can have a better memory utilization, you can reduce the amount of loss or
amount of memory space wastage. If you have a large data large segment, you put it in
the large buffer; if you have a small segment, you put it in a small buffer. But the
disadvantage is you have a complicated implementation because individual buffer spaces
are dynamic. So, you have to dynamically allocate the memory.

The third solution that we prefer is to use single large circular buffer for every
connection. So, we have a kind of circular buffer and that circular buffer contains
individual segment. So, in a circular buffer you can have one segment of say 1 kb size,
another segment of having 4 kb size, another segment of having 10 bit size and that way.
So, you can put individual segments of different sizes one after another and ultimately
you can have a unused space which can be used to store the next incoming segments.

So, this single large size circular buffer, it provides a good use of memory when the
connections are heavily loaded. Because if the connections are heavily loaded again, you
are going to use or going to waste huge amount of memory space inside the buffer
because you are using a fixed size buffer, then in that case the variable size buffer may
perform well.

348
So, that way your choice of designing a transport layer buffer depends on what type of
applications, you are going to use and what type of data the applications are going to
generate; so based on that you can decide that which particular buffer will be more
suitable for your application.

So, this gives you this particular lecture give you a broad idea about your design choice
of multiple transport layer parameters and how it impacts the transport layer protocol
performance. And we have looked into a hypothetical implementation of different
transport layer functions and how the transport layer calls are getting interfaced with the
application layer and in that particular scenario what type of transport layer buffers you
can use based on your need of the application.

So, in the next class we will continue from here and look into one another service at
transport layer like the congestion control mechanism. And then, we will go to the details
of the transport layer protocol implementation. We will talk about the TCP and UDP
protocol implementation in details.

So thank you all for attending this class.

349
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 17
Buffer Management and Congestion Control

Welcome back to the course on Computer Networks and Internet Protocols. So, we are
discussing about the transport layer and various services under the transport layer.

(Refer Slide Time: 00:29)

So, in the last class we have discussed about the basic performance modules in the
transport layer along with a hypothetical transport layer protocol that how will you
interface the transport layer with the application layer . So, continuing from that point, in
this lecture, we will discuss about the buffer management mechanism in the transport
layer and then we will look into the details of the congestion control algorithms.

350
(Refer Slide Time: 00:54)

So, coming to the buffer management; so, as you have looked into the last class that at
the sender side as well as at the receiver side, we maintain a transport layer buffer which
is a software buffer maintain as a queue and in that queue, at the sender side, whenever
you are sending some data, you put the data in that queue and then based on your rate
control algorithm, the transport layer will fetch the data from the queue and send it to the
unreliable IP layer of the network layer.

On the other hand that the receiver side, you have a queue where the data from the
network layer is put into the queue and then the application will fetch the data from that
queue. Now let us look into this diagram. So, here at the network layer, this ip receive is
again a hypothetical function that receive the data from the ip layer on the network layer,
and it put the data into the queue and this queue is the buffer at the transport layer
corresponds to an application, and we use port number to identify that in which buffer
you need to put the data.

So so, once this network layer put the data at the transport layer, then the application,
from the application, you have to use the read system call or there are other system calls
like the write system, the write system call through which you will receive the data from
the transport layer. So, this read system call which is the part of the socket programming
that we will discuss later on in details.

351
So, the read using the read system call, you will receive the data from the transport
layer. So, if you are using this write call at the sender side, then you can use the read call
at the receiver side at the application to read the data and regarding this transport layer
implementation, as we have seen that this entire part of the implementation of the
protocol stack that is implemented inside the Kernel, if you consider an a Unix type of
operating system or broadly, you can say that this protocol stack is the part of the
operating system where as this application is written in the user space.

So, the frequency of the read call that is actually managed by the application which you
are writing and the application is using this socket programming that we will discuss
later in details; it will use the socket programming to read the data from this transport
layer buffer. Now it may happen that well application is reading the data, data at one
speed where as the network, it is receiving the data at another speed.

Many of the times, it may happen that will the network is sending the data at a more
higher speed compared to what the application is reading, say may be the network is
receiving data at a rate of some 1 Mbps and the application is reading the data at the rate
10 Kbps. So, the application is reading the data at a rate of 10 Kbps means at that rate,
you are executing the read system call. So, you are may be coming at every 1 second and
you are making a read system call with the buffer size of 1 Kb - 10 Kb. So, you will
receive the data at a rate of 10 kbps because of this difference, we face certain problems
because the data that will get buffered inside this transport buffer.

So, because you are receiving data at a higher rate so that particular data will get buffer
inside the transport layer, buffer inside this particular queue and after sometime, it may
happen that the queue becomes full. If the queue becomes full, that will be a problem
because in that case, if the senders sends more data to the network, then that particular
data will come here at the transport layer, but because this buffer has become full, you
will experience a packet drop from this particular buffer.

Now, you want to avoid that. Now to avoid that; what you have to do? You have to tune
the flow control algorithm. So, how will you tune the flow control algorithm? You have
to have something called a dynamic buffer management where this receivers buffer side,
it is changing dynamically, it is changing dynamically because of this rate difference
between the application layer and the transport layer, at rate at the rate at which it is

352
receiving the data from the network layer, because of this rate difference you may face a
problem you may have dynamically changing buffer size.

Now, to handle that; what you have to do, like you have to send that information to the
sender side so that sender can stop sending data, unless there is sufficient space in the
receiver buffer. So, this particular concept, we call as the dynamic buffer management at
the receiver side. So, let us look in to this concept of dynamic buffer management in little
details.

(Refer Slide Time: 05:53)

So, in case of dynamic buffer management for window based flow control for sliding
window based flow control, what you have to do that the sender and the receiver needs to
dynamically adjust their buffer allocation.

So, that is based on the rate difference between the transport entity and the application,
the available size of the receiver buffer may change; so, in this particular diagram. So,
these are the set of segments that the application has already read out. So, that has went
from the application buffer. Now this is your complete buffer size. Well, so, this is your
complete buffer size. Now out of that there are 3 segments, which are already they are
inside the buffer.

So, these segments are waiting inside the buffer for the application to read them. Now
here the free space that you have in the receiver buffer that is this amount. So, you need

353
to advertise this amount to the sender. So, that the sender doesn’t send more data
compared to the what the receiver buffer can hold. So, the sender should not send more
data compared to the receiver buffer space. So, you need to dynamically adjust the
window size; the sender window size based on the availability of the receiver buffer
space.

So, what we have looked into the window based flow control algorithm that you can
dynamically tune the sender window size and the sender window size basically depicts
that how much data you can send to the receiver without waiting for the
acknowledgement. Now if you send the feedback from the receiver side to the sender
that when the receiver has this much of buffer space available, then the sender can set its
window size to maximum that value. So, that it will never send data to the receiver more
than that particular size.

Now, once the receiver will receive that data, after receiving the data, the receiver can
again send an acknowledgement. Once this data has been read by the application and
when it is sending that the acknowledgement with the acknowledgement, it can announce
the available buffer size. So, let us look how this particular procedure works.

(Refer Slide Time: 07:55)

So, here is an example. There are 2 nodes A and B. They are communicating with each
other.

354
So, the first message is that A request for the 8 buffers. So, here we are representing
buffer at the number of segments that you want to transfer and we are assuming that
every segment is a fix size although that does not hold true for TCP, but here this is just
for simplification, we are making an assumption that every segment has of same size and
the receiver at the sender, sender A. So, A is my sender who will send the data and B is
my receiver who will receive the data.

So, the sender first request for 8 buffer. So, A wants 8 buffer space from B, but B finds
that well only 4 buffer space are available buffer space for 4 segments are available. So,
A sends back an acknowledgement with an acknowledgement number along with this
buffer space value. So, the buffer space value is mentioned as 4 that determines that A
will only grant 4 messages from message 0 to message 4 or for segment 0 to segment 4.
Now A sends 1 message; so, once A sends this message, this data with sequence number
0. Now at this time, A has sent 1. So, A has 3 buffers left, then A sends another message
A m1. Now A has 2 buffers left, then A has sent another message and assume that this
message has lost.

Now, this message has lost. So, although at the receiver side, you have 2 buffer space
left, but A thinks that there are only one buffer space left because A has already sent 3
segments. So, at this stage B acknowledges 0 and 1. So, once B acknowledges 0 and 1; A
send B sends an acknowledgement 1. So, here this acknowledgement is a cumulative
acknowledgement. So, once you are sending back acknowledgement 1; that means, you
are acknowledge acknowledging both message 0 and message 1 along with that it is
advertising that the buffer space is 3.

So, A get an update that well this message 0 and message 1 has been successfully
received by the receiver and it has a available buffer space of 3. So, A again sends
message m3 because it has sent message m2 already, it has sent message m2 already. So,
it does not know that whether the message has been received or not then it again sends
m4 and finally, sends m2.

So, after sending this 3 it the advertised buffer space was 3. So, it has sent 3 message. So,
once it is it has sent 3 message, during that time, A cannot send anymore data because A’s
sending window was set to 3. So, it has already transmitted 3 3 messages. Now at this
stage, this B, it sends an acknowledgement saying that acknowledgement number equal

355
to 4. So, when this acknowledgement number is equal to 4, at this stage A finds out that
well, all the 4 messages starting from m1, starting from m2, m3 and m4, they got
acknowledged because 4 is again a cumulative acknowledgement.

So, at this stage, there was a timeout for there was a timeout for message m2 for which it
has not received the acknowledgement and it transmits that message again. So, B has
received m2, m3 and m4. So, B has sent an acknowledgement 4 with buffer space 0. So,
with this buffer space 0, what A is acknowledging? The A is acknowledging that that this
particular message, all the message has been received by B, but it does not have any
buffer space available; that means, the application has not read that data. Now once the
application has read that data, A sends another acknowledgement saying that the
acknowledgement number the same acknowledgement number 4, but announcing the
buffer space as 1.

So, at this stage, A makes one buffer space available, B makes 1 buffer space available to
A saying that it can send one more message, one more segment. So, here you can see that
once you are advertising buffer space 0, after that, once that buffer space becomes
available, you need to send another acknowledgement, otherwise, the sender will get
blocked at this stage because the sender; once it gets that the buffer space is 0, it will not
send anymore data.

So, it is it will get blocked here. So, that way the things get continues continued. So, here
in this case, A A sends the data and gets blocked and then it gets an acknowledgement
number with buffer space 0, here A is still blocked, then A A can send get get another
message with the available buffer space.

So, here you can see that well, it may it may sometime happen that that because of you
are sending this advertisement that that you have do not you do not have any sufficient
buffer space, there is a possible possible deadlock at the sender side, because the sender
can find out or sender can thinks of that no more space is available at the receiver side.

Now, to avoid this particular thing, what you have to ensure? You have to ensure that the
acknowledgements are flowing in the network continuously. So, in this particular
example, if it happens that well initially, you have advertised that the buffer space is 0,
then B sends another acknowledgement saying that the buffer space is available, but
somehow this acknowledgement got lost.

356
So, because this acknowledgement got lost, the system can lead to a deadlock unless B
sends another acknowledgement after it gets a timeout. So, it need to explicitly tell to A
that now sufficient buffer space is available. So, A will be able to send more data. So, in
that particular case, you have to ensure that after every timeout, B should if B is not
receiving any more data from A and the connection is still open. So, B should send the
duplicate acknowledgement announcing that it has sufficient buffer space to receive
further data, otherwise, there is a possibility of having a deadlock in case the
acknowledgement get lost.

Well so, this is the concept of dynamic buffer management at the transport layer.

(Refer Slide Time: 14:41)

Now, we will see another important aspect of the transport layer which we call as the
congestion control. So, what is that congestion control? So, you just initially think of a
centralized network scenario. So, each node has an edge. There is an edge between 2
nodes and we have an edge wait.

So, this edge wait signifies that what is the capacity of that particular link, say if you
want send some data S to D, at that case, if you want to find out that what would be the
capacity of that flow what would be the maximum capacity of that flow.

So, you can apply this max flow min cut theorem which is being covered in the
algorithmic course. So, you can apply the max flow in cut theorem and from the max

357
flow min cut theorem you can find out what is the minimum cut here. So, just by looking
into the scenario, this seems to be the minimum cut because this is the minimum cut. So,
you can send a maximum flow at the rate of 6 plus 4 plus 10 plus 2, 12.

So, you can send a data at the rate of if you send a think as the unit as Mbps, so you can
send the data at a rate of 12 mbps from S to D. Now if you have this kind of centralized
scenario, you can apply this kind of algorithm, this kind of mechanism to restrict your
flow rate to 12 Mbps, but if it is not there, if it is not there, then how will you be able to
find it?

Now, your flow control algorithm will not be able to guarantee that your transmission is
always restricted to 12 mbps because you are getting the rate from multiple paths and the
thing is restricted to this maximum segment size that is an approximate calculation that
we have looked earlier. So, because of that it may happen that in a distributed scenario,
the sender may push more data compare to this 12 Mbps bottleneck capacity which is
there in this particular network. So, this capacity is the bottleneck capacity. So, if you
want to send some data from S to D even if there are no other flows in the network, you
will never be able to achieve more than 12 mbps.

Now, the scenario get more complicated if you have multiple flows, if you think of that
there is another flow from this S 1 to D 1, that will also use these links this individual
links in the network, you can think of that there is a link from here to here with the
capacity of 4. Now it will use this particular link. Now this flow may go through any of
this link and there would be this kind of overlapping among multiple end to end flows
and they will share the capacity in this bottleneck links.

So, this entire thing is difficult to implement in a real network, because in a real network,
you have to implement it in a distributed way. So, in that particular concept, the
congestion may occur in the network where this bottle neck links in the bottleneck link,
you are trying push more than the capacity of the particular bottleneck link. Now if you
want to push more data compared to the bottleneck link, capacity of the bottleneck link,
what will happen that the intermediate buffer at the nodes, they will get filled up, you
will experience packet loss, which will reduce the end to end transmission delay or
which would fill increase the end to end transmission delay significantly.

358
(Refer Slide Time: 18:18)

So, from here let us look into that how your bandwidth changes when you allocate start
more flows between the same source destination pair. So, initially say your bandwidth
allocation we are normalizing it in 1 mbps. So, initially if you have a single flow, so we
just think of a network like this. So, you have say this network and you are you are
sending a single flow from this source to S1 to destination D1 and assume that this
bottleneck link capacity is 1 Mbps.

Now, if that is the case, then once you are starting flow 1, then flow 1 will be able to use
this entire 1 mbps bandwidth which is there in this bottleneck link. Now say after some
time at once again you start another flow from says this S2 to D2. This is say flow 2.
Now if you start that then this link capacity is 1 mbps. So, this link is being shared by
both F1 and F2. So, ideally what should happen that well whenever you are starting this
particular flow, it will it will the entire bandwidth the bottleneck link bandwidth will be
divided between F1 and F2. So, everyone will get approximately both flow 1 and flow 2
will get approximately 0.5 mbps of speed, if their sending rate is more than 0.5 mbps.

So, in that case, this entire bottleneck capacity is divided between flow 1 and flow 2 and
after sometime say you have started another flow, flow 3 which has required which
whose required bandwidth is little less, say its required bandwidth is something close to
say 100 kbps. If that is the case, it will drag this 100 kbps bandwidth from here and then

359
the remaining bandwidth will be shared between flow 1 and flow 2, and flow 1 and flow
2 are utilizing both this bottleneck bandwidth.

Now, after some time if flow 2 stops, then flow 1 say flow 2 gets stops, flow 2 flow 2
finishes, at that time flow 1 will get the bandwidth which is close to 900 m, 900 kbps and
flow 1 is utilizing some 100 kbps. That way this entire bandwidth allocation among
multiple buffer multiple flows gets changed over time.

(Refer Slide Time: 20:59)

So, in this context, the congestion we discussed the congestion controlled algorithm in
the network. So, this congestion control algorithm, it is required because this flows they
enter and exit network dynamically, the example that we have seen and because of this
reason, applying an algorithm for congestion control in the network is difficult because
you do not have this centralized network information, like the first example that I have
shown you where you can apply this min cut theorem to find out the maximum flow
between one source and one destination.

The scenario is much more difficult here because every individual router do not have
this entire network information, even the end host do not have that entire network
information and a distributed or in a decentralized way you have to allocate the flows
among flow rates among different end to end flows. So, we apply something called a
congestion avoidance algorithm rather than a congestion control because apriori

360
estimation of congestion is difficult. So, rather than going for congestion control, we go
for congestion avoidance.

So, the congestion avoidance is that whenever there is a congestion, you detect that
congestion and then try to come out of that congestion. So, how will you do that? So,
you regulate the sending rate based on based on what the network can support. So, your
sending rate now is the minimum of something called the network rate and the receiver
rate. So, earlier your sending rate was equal to the receiver rate.

So, based on the buffer advertisement that was given by the receiver, you are controlling
you window size and you are sending the data at that particular rate. Now you are
sending rate will be the minimum of your network rate, what the network can support
and what the receiver can support. So, this network rate, receiver rate it comes from the
flow control algorithm. So, the it comes from the receiver advertise window size for a
sliding window based flow control. So, the receiver is advertising that particular window
information and this network rate you do not have any control over the network rate or
rather to say you do not have any estimation mechanism over the network rate. So, what
you can do that you can gradually increase this network rate component and observe the
effect on the flow rate. So, ideally what can happen in case of wired network, if you
assume that the loss due to channel error is very less; that means, if there is a loss from
the network that loss is coming due to the buffer overflow at the intermediate routers.
Now if buffer overflow happens that gives an indication that, well the total incoming rate
to the buffer exceeds the total outgoing rate from that buffer.

So, as an example, if you just think of an intermediate buffer intermediate buffer queue it
is receiving data from multiple flows and there is some outgoing rate the outgoing rate
can also be multiple. So, assume that total incoming rate is λ and total outgoing rate is μ.
Now if your λ is more than mu, this indicates that after some time the buffer will get
filled up and once the buffer will get filled up there will be packet drop from the buffer
and you will experience a loss.

Now, if you observe a packet loss here that indicates that the total incoming rate to the
intermediate buffer is exceeding from the total outgoing rate; that means, λ is more than
μ. So, this gives an signature of the congestion; that means, if just think of a road
network see assume that you have road network something like this.

361
(Refer Slide Time: 24:32)

So, this is an example road network. So, the cars are coming to this road. So, this is the
bottle neck here. So, see here the total capacity that it can support if the total incoming
capacity that from this 2 roads are exceeding this capacity so, you will experience the
congestion here. So, the same things happen in case of network and we are sensing a
congestion from this packet loss because packet loss gives an indication that the buffer
that you have, that buffer is getting exceeded.

So, you identify it as a congestion and you again drop the network rate. So, the broad
idea is that you gradually increase the network rate at some time, you will experience,
the packet loss the moment you are experience the loss, then you drop the rate and again
increase the rate and again whenever you’ll get a loss, you will drop the rate. So, that
way we apply the congestion control algorithm in the network.

362
(Refer Slide Time: 25:36)

Now, the question comes here that how will you increase the rate. So, we see the first we
want to see the impact of network congestion over good put and delay. So, what we see
that if you look into the network good put that the number of packets per second that you
are receiving at the transport layer and with the offered load. So, you have a maximum
capacity. So, normally what happens that well the rate gets increased up to the maximum
capacity.

But at the moment there is this congestion, you see a certain drop in the good put
because your packets are getting dropped and if packets are getting dropped, the flow
control algorithm will try to retransmit the packets. So, you will get a certain drop here,
we call that the congestion collapse. Now when the congestion collapse happens, you
experience a significant increase in the delay.

Because packets are getting dropped, the flow control is trying to retransmit the packet,
if at that time the link is not able to come out of the congestion, again that retransmitted
packet will fall in the congestion and there is a high probability that the buffer is still full
and the packet may get dropped. So, because of that, the total end to end delivery of the
successful packet that may get decreased.

363
(Refer Slide Time: 26:49)

So, to ensure congestion control over the network we need to ensure another thing which
we call as the fairness. So, what is fairness, the fairness ensures that the rate of all the
flows in the network is controlled in a fair way. What do what does mean that? Now bad
congestion control algorithm may affect fairness; that means, some flows in the network
may get starved. So, because because it is flowing in the congestion, you can just think
of a scenario in a road network, if you are falling in a congestion, if a car is falling in a
congestion, so the car can have a very bad luck or have a huge delay to reach at the
destination. So, the similar thing may happen in the network that some flows may get
starved.

Now in a decentralized network, ensuring hard fairness is very difficult because you
again you require the entire network information and want do some mathematical
calculation to find out this min cut from that min cut theorem, what would be the
available capacity and restrict the bandwidth to that particular capacity. So, doing all this
calculation of a on a central network is very hard. So, rather than providing this kind of
hard fairness, what we try to do? We try to allocate what is called as a max min fairness.

So, what is a max-min fairness? So, an allocation is max min fair if the bandwidth given
to one flow cannot be increased without decreasing the bandwidth given to another flow
with an allocation. So that means, in an allocation say you have 2 flows say λ 1, λ2, we

can say that this λ1, λ2 is max min fair if you make λ increase λ1 to some value epsilon,

364
then you have to decrease λ2. So, λ2 needs to be decreased. So, you cannot increase the

value of λ one without decreasing the value of λ 2. This particular allocation, we call it as
a max min fair allocation.

(Refer Slide Time: 28:46)

So, let us look into an example of max min fair allocation. So, in this particular example
we have multiple flows here. So, you can see that this is the bottleneck capacity where 3
flows are sharing the link. So, 3 flows are sharing the link means each of them will get
one third of the bandwidth. So, this particular link is shared by maximum number of
flows.

So, this is shared by 3 flows this is shared by 2 flows, this is shared by 2 flows and this is
shared by one flow. So, here is the bottleneck. So, each of them will get one third of the
bandwidth if they are getting one third of the bandwidth, the flow which is this flow
number D, it will use one third of the bandwidth, this flow number C and it will use the
one third of the bandwidth. Then flow B which is moving from here because of this
bottleneck capacity, it is using one third of bandwidth. So, it will utilize one third of
bandwidth in this link. So, in this link the remaining capacity is 2 third. So, this flow A, it
can use the 2 third of the bandwidth. So, this is the max min fair algorithm because if
you want to increase the bandwidth of this from one third say for flow B, if you want to
want to increase it from one third you have to decrease the band width of flow A.

365
Similarly, if you want to increase the bandwidth for flow C or flow D because you can
see that in this link the total capacity that is being utilized two third, it is not utilizing the
full capacity here also, it is not utilizing the full capacity and just by taking that if you
want to increase the capacity of any of this link because of this bottleneck capacity
distribution, you have to decrease the capacity of say flow B. So, this particular
allocation is a max min fair allocation.

(Refer Slide Time: 30:36)

Now, in a distributed way we can we can ensure max min fair allocation by applying this
AIMD algorithm. So, we call it the algorithm as additive increase multiplicative decrease
which was proposed by Chiu and Jain in 1989. So, the algorithm is something like this.
So, you increase the flow rate additively, but drop the flow rate multiplicatively what is
mean by that.

So, let wt be the sending rate and a is an additive increase factor and b is the
multiplicative decease factor. So, whenever you are increasing the rate that mean the
congestion is not detected, you provide an additive component, but when congestion is
decremented you provide the multiplicative components. So, the value of b is from 0 to
1. So, if you are multiplying by b; that means, you are dropping the rate.

So, the example of a additive increase multiplicative decrease is that say you increase it
linearly in additive way adding a fixed component whenever you are increasing, but
whenever you are dropping you make a significant drop. Now let us see that how this

366
additive increase multiplicative decrease. So, this part is the additive increase and this
part is a multiplicative decrease. So, how these additives increase multiplicative decrease
can help in ensuring fairness.

(Refer Slide Time: 31:54)

Now, let us look into another variant which we call as the AIAD or MIMD. So, AIAD is
the additive increase additive decrease you increase additively as well as decrease
additively. MIMD is you increase multiplicatively as well as you decrease
multiplicatively. So, we are taking an example of 2 users who are sharing the bottleneck
link.

Now, if 2 users are sharing the bottleneck link. So, this line gives you the fairness.
Because this line with the 45 degree slope, its says you that well if you take one point
here, that both user a and user b gets almost equal amount of bandwidth or in hard
fairness, they get equal amount of bandwidth. So, this line gives me the fairness line.

(Refer Slide Time: 32:38)

367
Similarly, this line gives you the efficiency line, because here the total allocation has
reached to 100 percent. Now if you start from this point and with this additive increase if
you increase the bandwidth once you exceed this line; that means, you are putting more
data than the capacity of the link, this hundred percent bandwidth link. So, you will
experience a packet loss; that means the notion of the congestion.

Now at this case if you want to decrease the bandwidth in a additive way, you just
decrease it parallelly. So, you can see that if you are doing a additive increase and
additive decrease you will just oscillate around this efficiency line, but that is not the
optimal point. We want something here this is the optimal point where both the flows
will get 50 percent of the 50 percent of the available bandwidth and together they will on
the efficiency line that means the 100 percent.

So, we want to reach at this point. So, in additive increase additive decrease, you will
just oscillate on the efficiency line. Similarly on the multiplicative increase and the
multiplicative decrease, you will oscillate on the this efficiency line because you will
increase in the same rate and drop in the same rate. But if you are going for additive
increase multiplicative decrease, the scenario becomes something like this.

(Refer Slide Time: 34:04)

368
So, the scenario become something like this. So, you are you are starting from this point
you are making a additive increase, then you make a multiplicative decrease then again
you make a additive increase you make a multiplicative decrease you make a additive
increase and the multiplicative decrease. So, gradually you will move towards the
optimal point.

So, if you are making as an additive increase followed by a multiplicative decrease gain
a additive increase followed by a multiplicative decrease and both the users are following
this principle, gradually, they will come to the optimal point similarly if you start from
here you make a additive increase and then towards this center point make a
multiplicative decrease again make a additive increase make a multiplicative decrease
gradually you will move towards this optimal point.

So, that way this AIMD algorithm additive increase up at 45 degree and multiplicative
decrease towards the line points to origin, if you apply this particular algorithm, you can
converge towards the optimal point. So, this particular algorithm is used by TCP to adjust
the size of the sliding window to control the rates that will look into the details sometime
later. Well, so, in this particular lecture you got the broad overview about the congestion
control algorithm and with this lecture, we have covered basic services which are being
offered at the transport layer.

So, in the next set of lectures, we will look into more details of the transport layer from
the protocol perspective, and also we look into that how this different services can be
combined together to build up the final services.

369
So thank you all for attending, hope we will meet in the next class.

370
Computer Networks and Internet Protocol
Prof. Sandip Chakraborthy
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 18
Transport Layer Primitives

Welcome back to all of you in this course on Computer Network and Internet Protocols.
So, till now at the transport layer we have to looked into different kind of service
primitives.

(Refer Slide Time: 00:25)

So, going from there, now we will look into that how you can combine all this service
together and develop an complete end to end transport layer protocol. So, we look into
this combination of multiple service together here and then we’ll go to the details of the
TCP protocol in details.

371
(Refer Slide Time: 00:45)

So, as we have discussed earlier like at the transport layer whenever you are interfacing
it with the application layer with specific application service. So, the transport layer it is
providing you the end to end connectivity. So now when the transport layer is providing
you the end to end connectivity, it may happen in a hypothetical scenario that there are
say one single machine which is trying to communicate with another machine.

(Refer Slide Time: 01:14)

So, this is one desktop D1 this is another desktop D2 we have communicate over the
internet. So, this is my internet cloud and there are other machines which are available

372
there say D3 and D4. Now on this machine and a single machine there can be multiple
application which can be running all together say this is A1, this is A2, here you are
running again 1 application A1 other application A2 here you are running say 3
applications A1, A2, A3 here you are running 1 applications say A 4.

So, that way on a single machine because we are utilizing this kind of multi-tasking
environment, they are can be multiple such applications which are running all together.
Now it may happen that in a transport protocol that application at D1, so application at
D1 wants to make communicate with application 2 at D3. So these two application need
to communicate with each other. So, at the network protocol stack what you have to do?
You have to first uniquely identify this machines that D1 and D3 want to communicate
and that is not sufficient at the same time you need to ensure that the application 1 at D1
wants to communicate with application 2 over D3.

So, A1 over D1 wants to communicate with A2 over D3. So these communication path
need to be established. So, the question comes that how will you uniquely identify a
machine, and then how will you uniquely identify an application running on top of a
machine. So, to look into that, we use 2 different addresses here, so we have the network
layer on top of the network layer, we have the transport layer and on top of the transport
layer, I have the application layer and as we discussed earlier, that this part it is
implemented as a part of your operating system. And then the transport layer they are
sending these end to end segments. So, the packets are going via the network layer, but
we are considering transport layer pipe a logical pipe between these 2 transport layer
entity.

373
(Refer Slide Time: 03:45)

Now, to identify these transport layer entity we use this port number, so the port number
uniquely maps this transport entity to a particular application. So, the example that we
are talking about that application 1 on D1 wants to talk with application 2 at D3. So,
these individual applications they are identified over the network with the help of this
port number. Similarly individual machines at the network that are identified by the IP
address, so we bind the IP address with this network layer and we bind the port number
with the transport layer.

So, this transport layer header, it uses this source port number and the destination port
number that will look into when you look into the details of the TCP protocol and a UDP
protocol, that at the transport layer header you have to provide the source port number
and a destination port number. So, this source port number and a destination port number
will uniquely identify the application, which is trying to send the data or which is trying
to receive the data. So, that is the usefulness of the port number.

374
(Refer Slide Time: 04:58)

Then on top of this transport layer we logically define a pipe, so this is again a logical
pipe and you want to implement all the services transport layer services on top of this
logical pipe. So, it is just like in the telephone call you are making a hello, so whenever
you are making a hello you want make sure that the other person is correctly receiving
your message and whenever you are saying something that hi how are you. wait for some
amount of time if you are getting the respond that hello I am well, so you are happy that
the other end has saved your message.

If you have said that hello how are you and you are waiting for some 2 minutes and no
response is coming, then again you will say that hello are you hearing, so those are the
protocols those are the kind of logical channels which you are establish establishing.
Now all your messages like whenever you are saying: hello, how are you - this message
is embedded to a signal, and then transferred over the physical wire which is there to
connect your telephone network.

So, the same way things happens in the data network, whenever sending data from the
transport layer, the transport layer is assuring end to end that you are able to send the
data correctly at the other end of the system and the other end of the system is receiving
the data correctly, because as we are looked into that the lower layer of the protocol stack
starting from the network layer and the below they are unreliable, so packet may get
dropped from there. So, because packet may get dropped from there, at the transport

375
layer actually sense that whether the packet is getting dropped from there and if packet is
getting dropped, it is identified with the help of that sequence number, if the packet is
getting dropped then you retransmit the packet over the same pipe.

So, unique pipe here between 2 transport layer entity, it is identified with the help of this
IP address, which is the network layer address. So, at the network layer I have this IP
address and here I have the port number. So, I have this source IP, I have source port, I
have destination IP, I have destination port, which is uniquely identified this pipe, but
remember another point that we have discussed earlier like if a system is getting crashed,
and it is restarting you have to also have an initial sequence number and to avoid the
delayed duplicate, you need to ensure that that sequence number initial sequence number
which you are generating, it is not using any sequence number of the forbidden region
from the previous connection, which is utilizing the same source IP, source port.
destination IP. destination port pair. So, that is why this initial sequence number, say
source sequence number and this destination sequence number, they also become part of
uniquely identifying this logical pipe.

So, in TCP or in transport layer protocol, TCP kind of transport layer protocol we
identify this logical pipe with the help of this 6 tuples, the source IP, the source port, the
source initial sequence number, the destination IP, the destination port and a destination
initial sequence number.

(Refer Slide Time: 08:18)

376
OK. Now, let us look in to some hypothetical primitive to enable user to write a transport
layer application. So, the thing is that if you again remember that at the operating system
level, I have the implementation of the transport layer and then the network layer and
then the lower layer of the protocol stack and this part is implemented in your inside
your operating system and in the userspace you can write your own application. Now if
your application say if you are building a chat application and in that chat application if
you want to send data over the network then your application need to directly interface or
directly interact with the transport layer.

Now whenever you are saying that you need to directly interact with the transport layer,
your operating system should provide certain primitives through which you will be able
to make your transport layer active and then send the data to your transport layer. After
that, everything will be taken care of by the transport layer and other lower layers of the
protocol stack. But from the application layer you should ask for the specific service that
you want from the transport layer.

Now to get those service let us first try to design a hypothetical transport layer protocol,
by utilizing the various services that we have learnt till now and after that we look in to
the TCP protocol in details. So, that way understanding TCP will be much easier for you.
So, to look in to this hypothetical protocol we are thinking of a client server this
application. So, I have a server, that server is ready to accept the connection, then I have
a client, the client can send certain messages to the server. For the time being, just think
of a hypothetical protocol where the client will send the server as a message like hello
server and the server will listen that message and reply back to a client that I am fine. So,
to do that what the server has to do the server has to first to be in the listen state, what is
this listen state? The server here it is waiting for an incoming connection because, see
whenever you want to connect to something if the machine is not in the listen state, you
will not be able to initiate a connection, you will not be able to randomly initiate a
connection with any of the machine in the world, the machine need to be ready to accept
the connection. So, whenever you say that is the server is in the listen state, what we are
ensuring? We are ensuring that the server is ready to listen some message. So, initially
the server is in the listen state then we have the connect states, so in the connect state
from the client you are sending so the server and this is the client.

377
(Refer Slide Time: 11:00)

So, the server is in the listen state, now from the client side, you are making a connect
call. Whenever you are making a connect call, then you are actually asking the transport
layer to initiate a end to end connection, so the transport layer will initiate a connection.
So, if it is a 3 way hand shaking that we have learnt earlier, it will used the 3 way hand
shaking for initiating the connection. Then once this connection is established, then you
can call the send function from your application program to send the data, send the data
to the corresponding server.

Now once the server gets this data, so server need to accept the data from the transport
layer. So, if you remember earlier the diagram like the data will come and the data will
keep on waiting on the receiver buffer at the transport layer. And from the application
you have to make certain function call to get the data from that transport layer buffer. So,
for that we have this receive call, so the server will make a receive call to receive the
data from the transport layer buffer. Now that way, you can send that hello message and
the server can say I am fine, server can again make a send call to send server can again
make a send call to send for the data and that way this call can go on. So, once this data
transfer is complete, then you send the disconnect message or disconnect function call to
disconnect this particular connection.

Now here the interesting point is this connect and the disconnect call. So, in a transport
layer if you want to get the transport layer services along with connection established

378
state. So, what you have to ensure that whenever you are making a send call or the
receive call, you are there in the connect state. That means, before you have made a send
call and a receive call, you need to ensure that well the system has already established
the connection.

(Refer Slide Time: 13:17)

So that means to initiate a connection what you have to do, you have to write the code in
this way that if connected, I am just writing some pseudo code, then send; else wait. So
that is at the sender side okay? Similarly at the receiver side it will be if connected, then
make a receive call; else wait for the connection. Now in this case you can see that well
every time you want to make a call to the send or receive, you have to check that the
system is in the connected state. So, if only the system is in the connected state then only
we will be able to make a call to this send or receive function.

379
(Refer Slide Time: 14:25)

So, that way that way, this particular primitive is important because, what we say that the
transport layer needs to remember the state of the pipe, the pipe logical pipe that we have
defined earlier, so that appropriate actions can be taken. So, if you are making a send call
before initiating the connection, so that call is not a valid call. So, we need a stateful
protocol for a transport layer, so what is mean by a stateful protocol? That with every
connection, you will remember that what was the state of that particular pipe through
which you are going to send the data.

(Refer Slide Time: 14:56)

380
So, first you have to initiate a connection. So the system is in the connect state, the
example that I have given you, that the client is in the connect state, the server is in the
listen state, you have sent a connection request and got an connection acknowledgement,
both are in the established state. Established state means the connection has established
then you can send the data, make a send call to send the data, the server can make a
receive call to receive the data even if after that the some server wants to send the data
server can make a send call and the client can make a receive call. And once this is done,
then you can make a disconnect call to disconnect this particular request. So, this
established is the state that the server and the client need to remember before making the
send call and the received call.

(Refer Slide Time: 15:50)

So, this entire thing we can represent in the form of a state transition diagram. So, this is
an important concept with the concept of this transport layer, where if you want to
maintain transport layer services you need to maintain this state of your pipe, logical pipe
that you are defining on top of the transport layer. So, this state transition diagram will
tell you that on reception of which message, how you are moving from one state to
another state. So, let us look in to this example in details, so initially you are in the idle
state, now in the idle state so you make a connect call.

So, once you have connect call, so this solid line is the client side and this dotted line is
the server side. So, you have make a connect call, so once you have make the connect

381
calls, that time this is you have made a active establishment, active establishment means
you have initiated the connection; similarly the server it has received the connection
request segment. So, once the server has received the connection request segment it is in
the passive establishment state; that means, it has got a connection request message they
need execute the connection primitive; that means, if it is a 3 way hand shaking it
execute that 3 way hand shaking, otherwise it send the acknowledgement and it moves to
the established state.

Similarly the client when it gets the connection accepted segment it received this
connection established segment, accepted segment and it moves to the established state
and in this established state, you can start transmitting the data whenever you are in the
established state.

Now to come out of the establish state, you have disconnect the things, then again if the
client initiate the disconnection message, so connect connect the client execute the
disconnect primitive; after the client execute disconnect primitive the client has executed
it. So, it is the active disconnection after that similarly at the server side the server, if it
receive the disconnection request segment. So, it moves to the passive disconnection
then once it execute the disconnect primitives, send the acknowledgement, the server
moves to the idle state; similarly when the client receive this disconnection request from
the server that gives an acknowledgement to its request, it moves to the idle state.

So, that way so this client by executing this connection primitive, it moves to the
established state, the server moves to the established state and you execute the
disconnect primitive and move to the idle state back again. And here you can see that this
state transitions are initiated by sending some messages or receiving some messages and
whenever you are in a proper state then only you are allowed to do further task. For
example, whenever you are at the established state then only you are able to execute the
send and a receive call, otherwise you are not allowed to do that.

382
(Refer Slide Time: 19:08)

Well, so this is the server side and this is the client side that we have discussed.

383
(Refer Slide Time: 19:16)

So, in the context of transport layer till now I have use this terms segment, packet, frame
interchangeably everything to point that a network packet which is going over the link,
but technically we make a differentiation between the segment, the frame and the
packets. So, in general at the transport layer whatever you are getting, so that is called a
segment.

So, at the segment is the concept at the transport layer. Now after getting a segment at the
transport layer, you add up the segment header at the transport layer and pass it to the
lower layer that is the network layer. So, this entire thing that you are passing to the
network layer, that becomes the network layer payload and in the network layer that
concept we call it as a packet.

So, packet the term packet is normally used to denote the primitive at the network layer,
with that you adopt the packet header and send this entire thing to the data link layer. In
the data link layer, this entire thing that you are receiving from the network layer that is
termed as a frame, so this is the frame payload. At the data link layer, you add up the
frame header with the frame payload and send it to the physical layer for physical
transmission.

So, the segment it is used at the transport layer, so in the transport layer the data
primitive we call it as a segment, at the network layer, the data primitive we term it as a
packet or in the contest of UDP we call it as a data gram and then at the data link layer

384
we call it as a frame. So, till now you have used the term interchangeably, because this
terminologies has not been defined to you, but now onwards we’ll use this terminology
whenever we are there at a particular layer of the protocol stack. In the context of flow
control, I have used the term frame and segment interchangeably because as we have
seen that this concept of flow control is there at the transport layer as well as at the data
link layer. So, the flow controls are executed on top of segment as well as it is executed
on top of frames, so we should not have any confusion there; but for the other primitives
try to utilize this proper term which is there.

(Refer Slide Time: 21:33)

OK. Now, let us look in to this entire transport layer process flow by combining all the
service primitives that we have learned. So, initially you need to have this connection
establishment. So this connection establishment it initiate a connection by selecting the
initial sequence number. And whenever you are selecting the initial sequence number,
you need to ensure that this initial sequence number do not fall within the forbidden
region of the previous connection between the same source IP, source port, destination
IP, destination port pair. And that is why we include the sequence number as a part of
identifying these end to end type, which we normally call as socket in the terms of Unix,
later on will look how we do the programming on top of a socket.

So, this same logical pipe is termed as a socket, so we defined uniquely identify a
connection uniquely identify a socket with the 6 tuples, the source IP, source port, source

385
initial sequence number, destination IP, destination port and destination initial sequence
number.

(Refer Slide Time: 22:39)

Then comes the flow control and reliability, once you have set up these initial sequence
number then that initial sequence number will be used further to ensure the flow control
and reliability with the help of your ARQ protocols. So, this ARQ protocols see it
ensures the flow control and reliability, so the sender will not send data at a rate higher
than the receiver rate; as well as in the congestion control prospective we have seen that
the sender rate should be minimum of the network supported rate. That means, the
congestion rate and the receiver rate. Then the sequence numbers, they are used to
uniquely identify each byte for a byte sequence number or if you designing a protocol
with the packet sequence number with fix size packets, then this, this sequence number
will denote uniquely identify a packet and loss in the communication part it is handled
through retransmission in the flow based flow based control mechanism in the based
flow control mechanism. So, you make a retransmission to retransmit the packet over
that same connection, then we have the congestion control the congestion control
algorithm it reduces the transmission rate once congestion is detected.

So, we have seen that the sender rate I am writing it has srate is minimum of the network
rate and your receiver rate. So, this receiver rate is something that is advertised by the
receiver with every individual acknowledgement and this network rate the idea is that

386
you apply this a AIMD protocol additive increase multiplicative decrease protocol to
ensured both efficiency and free on a simultaneously. And with this help of the AIMD
protocol what you do in case of congestion control, you gradually increase the rate and
you see that this rate will gets saturate when it will reach at the receiver rate. So, ideally
let me try to draw a proper diagram so that the things become easier for you to
understand.

(Refer Slide Time: 24:45)

So, initially you increase that so I am I am here with respect to time, I am plotting the
sender rate for congestion control algorithm. So, initially which increase the sender rate,
so once so my formula is that sender rate is equal to minimum of network rate and
receiver rate. So, initially you start network rate with a very low rate say some 1 kbps.
And gradually try to increase it, so whenever you are increasing it the minimum is
becoming the network rate after that when the network rate will exceed the receiver rate,
it will get saturated here, so this is my receiver advertised rate.

So, after that once you are experience a packet loss, you are experiencing a packet loss
here, so once you are experiencing a packet loss, you apply this AIMD concept additive
increase multiplicative decrease concept to drop the rate again and start this procedure
again gradually increase the network rate ok. At this point if the receiver advertise some
different rate it will get saturated here, after that if the network again advertise that well
it can support higher rate again you start increasing it based on the network rate it will

387
get saturated here, based on the receiver rate and then it increases again and some time if
there is a congestion detection with the help of a loss with the detection of a packet loss,
you again drop the rate.

So, that way the sender rate gradually increases in a transport layer and it helps you to
find out to handle the congestion as well as the flow control simultaneously. So, here we
can see that this is the flow control algorithm and the congestion control algorithms are
coupled together.

(Refer Slide Time: 27:04)

So, this congestion control it reduces the transmission rate once congestion is detected
and as you have seen that it improves the performance for end to end data delivery. So,
dynamically based on this rate, you start sending the data, other end to receive the data
send back the acknowledgement and accordingly will process it and once you want to
close the connection the data transmission is over. Then you execute this connection
closure primitive, that close the connection when the data transmission is complete. And
as we have seen earlier that although asynchronous closure is good, but asynchronous
closure is not possible to implement in a distributed system with unreliable channel. So
we go with synchronous closure with timeout.

So, that is all about the basic service primitives of transport layer, in the next class
onwards we’ll start looking in to the transmission control protocol or the TCP protocol in
details which is widely used in the network. So, around 80 percent of the traffic over the

388
global internet it uses this TCP protocols; so will look into the TCP protocol in details
which is a widely accepted transport layer protocol.

Thank you all for attending this class.

389
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 19
Transmission Control Protocol – I (Primitives)

Welcome back to the course on Computer Network and Internet Protocols.

(Refer Slide Time: 00:20)

So, till now we looked into the details of the transport layer, and what different services
is being provided by the transport layer. Now we will take a specific example a transport
layer protocol which is widely used in the networks. So, more than 80 percent of the
traffic over the internet it uses this transmission control protocol to transfer end to end
data. So, we will look in to the details of this Transmission Control Protocol or TCP in
short. And later on we will look into that how you can write an application with the help
of such a programming to send or receive data over TCP connections. So, let us start our
journey to learn the TCP protocol in details.

390
(Refer Slide Time: 01:03)

Well, so this TCP it was specifically design to provide a reliable end to end byte
streaming over an unreliable inter network. So, what is meant by unreliable inter
network? By the time I hope it is clear to you that the network layer, the IP based
network layer that we are considering it is providing unreliable service because of this a
buffer filled up are buffer over flow from intermediate routers, there is a possibility of
packet drop. And whenever there is a packet drop from this intermediate routers, the
network layer does not take care of that.

So, the transport layer, if you want to provide the reliable service on top of the transport
layer, that needs up needs to take care of that packet drop. So, TCP is the protocol which
supports this reliability on top of this unreliable internetwork. And by internetwork we
also look into that different parts of the network may have quitely different topology. So,
it may happen that well one part of the network is using wireless technology, one part of
the network is using wired technology, another part of the network is using say like that
optical communication technology.

So, there that can be this kind of the various type of technologies which are there in the
underlying network, and on top of that I need to transfer the data. So, for example; if you
just think of an example when you are doing Facebook on top of your mobile; so,
whenever you are doing Facebook on top of your mobile so, the first hop is wireless,
from mobile, from your mobile to mobile destination that part is wireless.

391
So, that uses a different set of protocol at the data link layer. Then from that destination
to this mobile switching center, that part is the wired network. And that uses high speed
ethernet networks. So, there it uses another set of protocol. Now from there from this
mobile switching center to the service gateway, because say you are just accessing the
Facebook server and the Facebook server is somewhere there in say USA. So, you need
to send the data to USA so, the gateway which is connecting this Asian network to the
US network that uses optical fiber cable in between. So, you need to transfer the data on
top of that top optical fiber cable. So, the underlying network is hugely different to which
different properties, and you can have different type of packet loss, delay, retransmission
on top of this unreliable network.

Now TCP is a protocol which is designed to handle all this different challenges. So, let us
look that how we use TCP to handle this different heterogeneity this different challenges
in the networks.

(Refer Slide Time: 03:53)

Well so, TCP dynamically adapts to the properties of the inter network, and is robust to
face many kind of failures which may happen in the network.

But this TCP protocol has a long history. So, the base TCP protocol it came as a part of
this RFC 793. So, this RFCs are some the full form of the RFC is request for comments,
and this RFCs are you can think of it as a standard document for a protocol specification,

392
which is published by IETF Internet Engineering Task Force, which is a global body to
handle protocol standardization.

So, the first version of TCP came in September 1981 as a part of this RFC 793, and then
it has seen many such changes. So, I have just listed the few changes, this RFC 1122
which does some clarification on the TCP protocol, the some level of bug says then RFC
1323 which was designed and extension of TCP for high performance, then RFC 2018.

So, the standard TCP protocol, it uses this go back N it go back N ARQ for flow control
algorithm. So, RFC 2018 it uses this selective acknowledgement. So, we call it version
call TCP SACK, TCP selective acknowledgement protocol with which uses this selective
repeat protocol to handle the flow control mechanism. In RFC 2581 it discusses about
the TCP congestion control algorithm, RFC 3168, it uses one concept called explicit
congestion notification. Even after that there are multiple amendment over the basic TCP
protocol. So, this TCP protocol has changed a lot from what it was designed initially in
September 1981.

(Refer Slide Time: 05:40)

So, a broad look on the TCP service model. So, all TCP connections they have full
duplex and point to point. So, point to point means they are between 2 end host. And full
duplex means both host A and host B whenever you are making a TCP connection
between them, host A and send data to host B and at the same time host B will be able to
send data to host A.

393
So, TCP it was designed for this point to point data transfer. Data transfer between 2
different machines. It was not designed to support multi casting or broadcasting, when
you want to send data from one node to a group of nodes, or from one node to set of
large set of nodes. So, for that TCP was not suitable. So, this TCP in a (Refer Time:
06:25) Unix-based system it uses the concept of socket, which define an end to end
connection. So the concept of pipe that we are talking about during our discussion of
generic service model of the transport layer. The same thing is a termed as a socket in the
context of the TCP. So, a socket as 6 tuples, 6 parameters to uniquely identify a socket,
the source IP, the source port, the source sequence number, source initial sequence
number, the destination IP, destination port, and destination initial sequence number; the
same thing that was designed to uniquely identify a pipe in a, logical pipe in a transport
layer.

Now once this host A and host B has set up a socket among them, then say host A want
send some data to host B, sorry, differs host B want to send some data to host A. So, host
B can use this write system call to write the data in this socket. So, host B will write the
data in the socket, then this data will be delivered to this different layer of the protocol
stack. Received at the transport layer of host A, then host A can execute the read call to
read the data from the transport layer buffer.

And this delivery the reliable delivery that will be taken care of the by the transport layer
and the delivery of the packet to host A based on it is IP address that will be taken care of
by the network layer. And that way with all this layers of the protocol stack.

So this logical pipe or logical socket that defines the service model of a TCP protocol.
So, all the services of this TCP protocol is implemented to support reliable data through
this pipe which is termed as the socket.

394
(Refer Slide Time: 08:17)

So, in a Unix model, Unix-based socket implementation, we normally run a single


daemon process, which is called as a internet daemon or inetd, this inetd it runs all the
times at different well known ports. So, it is not like that the all the time you have to
open you have to keep one socket open.

So, this inetd takes care of that, the inetd keeps on running on different well known ports,
and wait for the first incoming connection. So, when the first incoming connection
comes, this inetd it forks; that means, it creates a child process with a new process id and
starts the corresponding daemon. So, for example, if you want to do a http file transfer.

So, http file transfer for that you have to run http daemon which at the http server which
runs at port 80. So, initially this inetd keeps on listening on port 80 and whenever you try
to initiate a connection and port 80, then httpd pops up, because http httpd daemon
process, which will use hypertext transfer protocol at port 80, that will have looked into
the discussion of application layer protocol. So, it will start that daemon process and
create the socket at port 80 at the client, port 80 at the server and some random port at
that the client and start receiving the http packet.

Similarly, for ftpd type of the protocol the ftpd will start at port 21.

395
(Refer Slide Time: 09:44)

So, few details about TCP; so, first of all TCP connection is a byte stream not a message
stream, so, every byte is identified by a unique sequence number, that we discussed
during the generic service discussion of a transport layer protocol.

And this message boundary - they are not provided preserved end to end; that means, all
the messages are in TCP terms we call it as a segment that we have looked into, the
segments may not be of the same size. The difference segments may vary. So, here from
host B to host A, it may happen that the first segment is starting from sequence number
100, and has a length 100 so, it goes from 100 to 200. The second sequence it goes from
this should be 201 it goes from 201 to 250, the third segment it goes from 251 to 400. So,
that way this segment contains some 100 bytes of data, this segment contains so, this is
say from 101 to 200. This context contain contains 100 bytes of data. This contains 50
bytes of data and this contains 200 bytes of data. So, they have different segments may
have different size and the size of the segment will be determined by the flow control
algorithm that we’ll see later on. Now in a hypothetical example, if it happens that well
this segment 1 is received correctly by host A and say segment 2 and segment 3 are
dropped a lost. So, host B will try to retransmit bytes 201 to bytes 400. So, this should be
201. So, it will try to retransmit from bytes 201 to bytes 400.

So, in this TCP philosophy it is not trying to retransmit 2 segments, rather it will
understand that byte 201 to byte 400 has lost. And it need to retransmit bytes 201 to

396
bytes 400, not the 2 segment. So, this segments may not preserve, because in TCP
everything is in the form of a byte stream, and everything is identified by how many
bytes I have sent or how many bytes I have received or how many bytes are in transition
in the network. So, whenever it is doing the retransmission, may be because of that rate
control algorithm which we will discuss in details.

(Refer Slide Time: 12:16)

It may happen that this entire thing is divided into 2 different bytes 2 different segments.
So, the first segment contains bytes 201 to 300. And the second segment contains bytes
301 to 400. So now, you can see that the earlier earlier division that were that we had
from bytes to segment that was not being preserved here. So, earlier I have a small
segment of 50 bytes and another large segment of 150 bytes. But now whenever I am
doing the retransmission, I found out or better to say that TCP at host B finds out that
well, now I do not need to send a small segment of 50 byte, rather I can retransmit this
entire byte with 2 segments of 100 bytes each. So, that is why we use this term that the
message boundaries are not preserved end to end in the context of a TCP protocol. So,
everything is byte stream.

397
(Refer Slide Time: 13:24)

One example that the sending process it does four 512 byte writes to a TCP stream using
the write call to the TCP socket. So, the application is sending four 512 bytes of blocks to
the transport layer, and if you remember that the transport layer architecture, you have
this application whenever the application is making a write call, that data is going to a
buffer.

So, the data is going to a buffer, and the transport layer entity, it is reading the data from
this buffer and creating the segments. Now when it is creating the segments, if the
sending process writes four 512 bytes block to this buffer, now this data may be
delivered as four 512 bytes chunks that mean four 512 bytes segment, two 1024 bytes
segments or one 2048 byte segments or in some other way it is not necessary that all the
segments need to be a of same size.

So, there is no way for the receiver when the receiver will receive that data, to detect the
units in which the data were written by the sending process. So, at the sending process as
written data in 512 byte chunks, but whenever the receiver process will receive the data,
that is the opposite team, you get the data put it in a buffer receiver buffer, then the
receiver application will make a read call to read the data from the buffer. And when the
receiver application will made the read call to read the data from the buffer it will again
read certain number of bytes. And during that time it may happened that the read, read,
read this application is making a read call at 1024 bytes chunks.

398
So, the sender has written it at 512 bytes chunks and the receiver is receiving in that
1024 bytes chunks. So, that may widely differ and even the receiver does not know that
at which or a what was the chunk size when the sender has written that to the transmit
process to the transmission control protocol to the TCP process.

(Refer Slide Time: 15:46)

OK? So, this is the header structure of the TCP protocol. So, the well known fields are
already there, that you have looked into the source port and the destination port, to
uniquely identify the application through which you are making a communication.

You have this sequence number to uniquely identify each packet you have an
acknowledgement number to acknowledging the bytes that you have received. I made a
mistake while taking, I have told that sequence number for packet rather than that
sequence number for the byte because you are using byte sequence number. So, you
should use the correct term here.

Then the header length, the length of header certain flags so, these are the flag bits. So,
we will look into the flag bits in detail. Just for the few flag bits like this FIN flag FIN bit
like this FIN bit is used to close connection to finish a connection. So, if this FIN bit is
set; that means, it is a connection closure message if this SYN bit is set, SYN bit is for
connection initialization. So, if this SYN bit is set; that means, it is a SYN message for
connection initiation. If this ACK bit is set; that means, it is an acknowledgement

399
message which is sending this acknowledgement number about the up to which bytes
have been acknowledged by the receiver.

Then you have this window size. This window size is the receiver advertised window
size for sliding window protocol for dynamic buffer management. So, with this window
size, the receiver is announcing that what is the available buffer space in the receiver
side; this is 16-bit window size.

So, we have 32-bit sequence number 32-bit acknowledgement number, 16 bit window
size. Certain checksum to check that the correctness of the received data, urgent pointer
we will discuss about this urgent pointer later on; in brief like if you want to send some
message urgently by bypassing the queue, because if you look into the transmit queue,
trans or that transport layer queue.

That transport layer queue is FIFO thing First In First Out queue. So, whatever byte has
been came first, it will send that byte first. So, if you set the urgent pointer, the urgent
pointer says that well if you are sending some data from the application by setting the
urgent pointer; that means, whatever data you are sending from the application layer by
setting the urgent pointer, you can do that with the help of socket programming, we will
look into that. If you do that then it will first create that segment and segment then send it
out with the urgent bit set to one. It indicates that this particular data is urgent that should
be should not wait inside the queue for this first come first serve or first in first out
behavior.

Then you have some optional fields. And finally, the data which is coming from the
upper layer; that means, the pay load for this packet.

400
(Refer Slide Time: 18:37)

Well we have looked into that. The TCP sequence number and acknowledgement number
it uses 32 bits sequence number and 32 bit acknowledgement number.

So, every byte on a TCP connection has it is own 32 bit sequence number. So, because it
is a byte stream oriented protocol that you have seen. So, TCP it uses sliding window
based flow control. So, the acknowledgement number, it contains the next expected byte
in order which acknowledges the cumulative bytes that been received by the receiver.

So, the example is like that. If you receive an acknowledgement number 3 1 2 4 5; that
means, that the receiver has correctly received all the bytes up to 3, 1, 2, 4, 4 and it is
expecting the byte 3, 1, 2, 4, 5. So, that way it is the cumulative acknowledgement
number. So, once you are getting an acknowledgement number, it means that all the
bytes before that number immediately before that number, that has been received
correctly by the receiver and it is expecting that particular bytes.

So, it is expecting byte 3, 1, 2, 4, 5 and it has received everything correctly up to byte 3,


1, 2, 4, 4.

401
(Refer Slide Time: 19:42)

So, we looked into this earlier. That in TCP this message boundary we call it has a
segment. So, the sending and the receiving TCP entities they exchange the data in the
form of segment. In general, a segment consists of a fixed 20-byte header plus an
optional part. So, the header format that we have looked earlier the TCP is segment
header followed by 0 or more data bits. So, if it is a connection message or connection
closure message like the SYN message or the FIN message, you do not have any data,
but if it is a data message you may have additional data which is along with that
segment.

(Refer Slide Time: 20:22)

402
Now, how let us see how this TCP segments are being formed and as you have seen
earlier, that it is not necessary that all the segments will be of equal size. Here it will be
little clear to you that why all the segments are not of equal size in TCP. So, TCP it can
accumulate data from several write calls into one segment. Or split data from one write
call into multiple segments.

So, this write call with this write system call you’re sending a chunk of data from the
application to the transport layer. Now whenever the TCP is running, TCP say even if
you have send some just think of you have sent 1024 byte data you are sending 1024
byte data as a single chunk from application layer to the transport layer with the help of
this write system call.

It may happened that, the TCP may break that 1024 chunk into two 512 byte chunk, and
send 2 segments based on the need - the need, I will discuss a couple of minute later. Or
it can combine thousand two 1024 byte chunk together, and create a single segment of
2048 byte and send it to one go.

Now, how this segments are been created? That the segment size it is restricted by 2
parameters. The first parameter is the IP payload; the amount of data that you can put
inside the IP fragment, whenever it is going to the network layer. That is restricted to
65515 bytes. So, your segment size cannot be more than that. The second parameter is
the maximum transmission unit of the link.

So, what is maximum transmission unit? That means, whenever you are considering and
net multiple network link from say source to destination, this links have a maximum
transmission unit. So, that comes from the concept of data link layer, how this maximum
transmission unit from data link layer comes into practice. We will discuss that in details
when we discuss about the data link layer.

But for the time being, just take it as an example, or take it as an given postulate that for
different technology the maximum transmission unit is different. So, for example, if this
link is the Wi-Fi link, you have one MTU, if this is an Ethernet link or a WAN link you
will have another MTU. If this is an optical fiber link, you will have another MTU
Maximum Transmission Unit. So, the maximum transmission unit is basically that at a
single go, what is the amount of data or what is bit should be the amount of the data that
you can put inside the packet.

403
(Refer Slide Time: 23:10)

So, what TCP does? TCP get uses this write calls from the application to write the data in
the TCP sender buffer. So, here in this example that the application makes a write call to
write data in the transport buffer, and the sender it maintains a dynamic window based on
the flow control and the congestion control algorithm.

So, ideally your sending rate was minimum of network rate and receiver advertised rate.
So, whenever we convert this in the window form, your sender window size will be
minimum of one window size which will be given by the congestion control protocol.
So, earlier we are talking about that in case of congestion control, you increase the
network rate from a low rate to very high rate using this additive increase principle.

So, to increase that rate, it is just like your increasing the window, window size. So, size
if you are increasing the window size; that means, at the same instance of time you will
be able send more data. So, you will be able to increase the rate. So, this congestion
window keeps a indication that well if your window size is 1 so, you can send 1 byte of
data if your window size is 2, you can send 2 bytes of data simultaneously, if your
window size is 4, you can send 4 bytes of data simultaneously.

So, you have this congestion window and the receiver advertised window size minimum
of that. So, you have this sender window size. So, this sender window is dynamically
triggered, dynamically updated based on the receiver advertise window size and the
congestion window size, that you are gradually increasing in the additive increase space,

404
and whenever a congestion is deducted you are dropping it again to small value or a
minimum value.

So, this flow and congestion control algorithm, it will use this window size and based on
that, your segment will be created.

(Refer Slide Time: 25:07)

So, this is the algorithm for creating a segment. So, today’s implementation of TCP, it
uses this path MTU discovery a protocol which is there in the internet control message
protocol path, as a path of the internet control message protocol which is implemented at
the network layer.

So, what it does? Is it tries to estimates that what is the MTU of all the links in the path.
So, by getting the information about all the MTUs of the path, of the link in the path so,
as an example if it happens that well, so, these are the links. So, this is your source and
this is your destination. So, this link support 512 byte this supports 1KB, this supports
1KB and this supports say 256 byte. So, if that is the case; that means, ideally you should
not send data more than 256 byte in this entire end to end path.

So, that is the task which is done by this path MTU discovery mechanism inside the
ICMP protocol Internet Control Messaging Protocol. And it sets up its maximum
segment size during the connection establishment. So, during the connection

405
establishment, by exchanging this message at the network layer by getting this feedback
from the network layer it is sets up the maximum segment size.

This maximum segment size sometime depends on other parameters, like the buffer
implementation of what is the amount of the data that your buffer can hold at one go.
Now the sender it checks the window after receiving an ACK, because whenever you are
receiving an ACK, with that you have this currently receiver advertised window size,
which will tell you that what how much of the data the receiver can hold.

So, if the window size is less than MSS; that means, the receiver can whatever receiver
can hold it is less than your maximum segment size. So, you construct a single segment,
otherwise if that is the case if your receiver window size is more than your MSS, say
your receiver window size is 2048 byte and that is your receiver window size and your
MSS is 1024 byte; that means, you can if you have 2048 byte of data in your inside your
sender buffer, then you can create 2 different segments with 1024 bytes.

So, that way you create it two 1024 bytes segment and transfer it over the network. So,
that way dynamically this segment size are get adapted based on this particular
mechanism by looking into that what is the receiver advertised window, what is your
maximum sender size, as well as what is the amount of data which is there in the sender
buffer. It may happened that the sender buffer have only 10 byte of data, if the sender
buffer has 10 byte of data, then if you just keep on waiting for whenever you will get
1024 byte, because it is equal to your maximum segment size and you will transmit that,
you may unnecessary delay certain message.

So, that is why we will look the mechanism in details later on, but broadly even if you
have a small amount of data in the sender buffer, you do not wait for the data for the
maximum segment size, whatever data is there in the segment size you transfer that data.

So, that is why many of the times it may happen that if the application is not generating
sufficient data, then you can push the data in the network which is less than the where the
segment size is less than your maximum segment size.

406
(Refer Slide Time: 28:56)

So, the challenges which is there in the TCP design, and from here we will look into the
design details design in details. First of all this segments are constructed dynamically.
So, retransmission that do not guarantee that the retransmission of the same segment.

So, that we have seen earlier, that the earlier you had one segment of 50 bytes another
segment of 150 bytes and whenever you are making a retransmission you are making
two retransmission of 100 bytes each. So, retransmission may content additional data or
less data or rearrangement of the segments. And sometime these segments may be out of
order. Because TCP it does not determine the path, the network layer is determining the
path. And the network layer it may happen that for one segment, one packet which is
coming from the application the network layer packet, it decides one path for another
packet it decides another path. Because of this load balancing or many other mechanism
in the routing protocol. And because of that this segments, you may receive the segments
out of order a TCP. So, this TCP receiver it should handle the out of order the segment in
a proper way so, that data wastage is minimized.

So, if you are applying this go back N ARQ and if you just think of that well, if I am
receiving something out of order I will not put it in the buffer because anyway the sender
will retransmit the entire thing all together; that is not a wise idea. Why? Because small
example, because it may happen that at the this is a receiver this is a sender, the receiver

407
side say you have received this much of data and then you have received this much of
data.

Ok, so, you have received from say 100 to 120, then 121 to 150, you have not received
then from 151 to some 500 byte you have received. Now at this stage whenever the
sender gets a time out, the sender will try to retransmit this byte along with all the other
bytes which are there in the sender buffer. So, this is the sender buffer we will send that,
retransmit that data.

Whenever it is retransmitting that data, assume that in the first segment it has
retransmitted from 121 to 160 in a single segment. So, the moment you are getting this
the receiver will get this, receiver will can put receiver will just chop out this byte from
120 to 149 and put the data here in between; so, this entire data now from 120 to 500 that
has been received.

So, the receiver can send an acknowledgement, and that is the cumulative
acknowledgement saying that it has received up to byte 500. And the moment sender gets
it, the sender stops, may stop sending this retransmission of the additional bytes. And it
can update it is window parameter accordingly and start sending the data from 501 bytes
to the remaining.

So, that way you can do the optimization to have better utilization of the network
resources.

408
(Refer Slide Time: 32:10)

Now, we have this window size field in the TCP segment header. So, this window size
field is used for flow control algorithm in TCP. It uses a variable size sliding window
protocol, the dynamic buffering that we have looked into earlier. So, this window size
field it tells that how many bytes the receiver can receive, based on the current free size
at it is buffer space. And as we have seen earlier that a window size 0 means, the receiver
does not have a sufficient buffer space.

So, the sender should stall transmitting further data until it gets a good amount or
sufficient or sufficient amount of window size advertisement. Now TCP
acknowledgement; so, the final TCP acknowledgement it is a combination of the
acknowledgement number and the advertised window size, based on that the sender will
tune its parameter. So, that is the basic things about the TCP protocol.

So, in the next class, we will go to the details of this sliding window based flow control
algorithm which is adopted as the part of the TCP.

Thank you all for attending this class.

409
Computer Networks and Internet Protocol
Prof. Sandip Chakraborthy
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 20
Transmission Control Protocol - II (Connections)

Welcome back to the course on Computer Network and Internet Protocols. So, we are
looking into the details of Transmission Control Protocol or TCP.

(Refer Slide Time: 00:22)

So, in this lecture we will look into the details of TCP connection establishment and how
TCP chooses the initial sequence number, based on the concept that we discussed earlier
and then in the subsequent lecture. So, we will go to the flow control mechanism in TCP
in details.

410
(Refer Slide Time: 00:43)

So, TCP connection establishment, it is a three way handshaking based mechanism it is


utilizes a special connection request message called SYN a short form for
synchronization we call it as TCP SYN message. So, the connection establishment using
3 way handshaking mechanism that is something like this, like Host A and Host B wants
to communicate with each other. So, Host A and Host B wants to communicate with each
other, Host A initiates the connection establishment.

So Host A sends a SYN message with certain initial sequence numbers. So, in a moment
we will discuss that how TCP chooses this initial sequence number. So, it sends a SYN
message with the initial sequence number as x, then Host B sends an acknowledgment
message along with also a SYN message, so this SYN message from Host B to Host A, it
is used to ensure the bidirectional connection in TCP. So, if you remember in the last
class we have talked about that TCP connection is bidirectional. So Host A can
communicate with Host B at the same time Host B can also communicate with Host A
and because of this reason, Host B also sends a same packet with an initial sequence
number. So, here in this example Host B sends this SYN message while sending back the
ACK.

So, we are basically piggy backing SYN and ACK together piggy backing means we are
combining 2 message together in terms of TCP header, you need to set bit 1 for both the
SYN flag and for the ACK flag. So, this SYN plus ACK message it is sending a new

411
initial sequence number, so this sequence number y it will be used for B to A data
transfer and earlier proposed sequence number from A to B that is x will be used for A to
B data transfer and in acknowledge with this x, so it sends a acknowledgement number
of x plus 1.

Now, if you remember the connection establishment procedure 3 way handshaking


mechanism that we have discussed earlier in the case of general transport layer service
model. Host A can see this message host a can find out that the acknowledgment number
it corresponds to the SYN message that it has transmitted and if it corresponds to the
SYN message that is transmitted it takes this SYN plus ACK as a feasible one or a valid
one. And then it sends a acknowledgement message finally to B and in that
acknowledgement message it sends a sequence number of x plus 1 incrementing the
previous sequence that it has initiated and acknowledges this acknowledgement number
y plus 1.

So, with this 3 way handshaking mechanism, Host A and Host B initiate the connection.
Now the question is that how will you choose the initial sequence number. So, choosing
the initial sequence number is an important aspect that we have looked into a generic
discussion of a transport layer service models. So, while choosing the initial sequence
number the objective is to avoid the delayed duplicate. So that you can identify a
message by looking into your sequence number whether that message is a delayed
duplicate or it is just like the application has crashed and the application has initiated
another connection at the same port with the different sequence number.

So, to do that what you need to ensure that well, the initial sequence number that you are
choosing that initial sequence number should not fall within the forbidden region of the
previous sequence number. Now how will you ensure that to ensure that earlier we have
seen that well, whenever you are choosing the initial sequence number you have 2 way
to choose the initial sequence number. So, just try to remember the concepts that we
discussed earlier, so just briefly explaining it again for your convenience.

412
(Refer Slide Time: 04:42)

So, whenever you are choosing this initial sequence number. So this is the time axis and
this is the sequence number axis. So, this was the earlier connection if this was the earlier
connection then this was say the forbidden region for this particular connection. So, this
is the connection 1 and this is the forbidden region for connection 1.

Now whenever you are initiating a new connection say at this point, connection 1 got
crashed here, so once connection 1 got crashed you want to initiate a new connection.
And whenever you are initiating a new connection you need to ensure that you are not
starting the new connection say; this is your new connection, connection 2 you are not
starting this connection 2 at a point such that the forbidden region for connection 2
overlaps with connection 1 so this we do not want.

So, to prevent that what we do that to prevent that we want to initialize connection 2,
such that these 2 forbidden region does not overlap with each other. Now to do that you
have 2 options the first option is the first option is just, so the first option is you make a
shift at the time domain and the second option is that to make a shift at the connection
establishment domain. That means, at the sequence number domain. So, the first step is
that you start it after giving a gap so this is connection 2. So, you start it after giving a
gap, so that these gap will ensure that the sequence number space do not overlap.

So, you wait for certain amount of time to ensure that all the packets for connection 1
which was transmitted in the network they have died off and no traces of that those of

413
they are in the network and then only you try a new connection, otherwise the option is
that you choose the initial sequence number in such a way which will be high enough.
So, there would be difference here from the last sequence number which is used by
connection 1 and a new sequence number that you are using from connection 2. So, there
is a difference here such that you will be able to ensure that this sequence number space
which was been used by connection 1, you are not going to use that sequence number
space for the connection 2 for the data of connection 2.

Now TCP uses the second principle, so TCP ensures that whenever a connection, say
connection 1 crashes, so this was connection 1 whenever connection 1 crashes, whenever
you are starting connection 2 you choose the connection 2, the initial sequence number
of connection 2 in such a way that there is a gap in between so this is for connection 2;
there is a gap in between and there is no overlap between the sequence number which is
being used by connection 1 and which is being used by connection 2.

So, for that, TCP uses a clocking mechanism, so TCP generates the sequence number
based on a clock. So, that was the first implementation of TCP or the earlier version of
the TCP, it used the sequence it used to generate the sequence number based on a clock
mechanism. So, the methodology was something like this, so this original
implementation of TCP it used a clock based approach. So, the clock ticked every 4
microseconds, so whenever the clock is ticking you are generating a new sequence
number if you have a byte 2 set and the value of the clock it cycles from 0 to 232-1.

So, you remember that TCP uses a 32 sequence number, so your entire sequence number
space is 0 to 232-1; so that means, at every 4 microseconds you are generating a new
sequence number and whenever a connection crashes and get restarted then you will use
the sequence number which is being generated by the clock. So, that is used for
generating the initial sequence number, then the sequence number will incremented
based on the bytes that you are receiving and you are transmitting based on your flow
control and the congestion control algorithm. So, this value of the clock it gives the
initial sequence number which will be being used.

414
(Refer Slide Time: 09:29)

So, with this clock based mechanism what you are ensuring; that means, whenever a
previous connection say get crashed here, the connection get crashed here and you are
restarting the connection by the time the clock value will increase. And because the clock
value is increasing you will obviously get a initial sequence number here, which has
certain gap from the sequence number filled which was used by the previous connection.

So, you will start from here and you will be able to ensure that the forbidden region of
the sequence number which is been used by connection 2, so this is connection 2 that is
not overlap with the forbidden region of connection 1. Now, with this particular approach
we have a problem like this sequence number generation becomes little bit deterministic.

415
(Refer Slide Time: 10:17)

So, if you know that well the clock is ticking at every 4 microsecond and at every 4
microsecond you are generating a new sequence number; that means, an attacker will be
able to understand by looking into the previous sequence numbers that, what is the clock
tick rate, current clock tick rate. And when the previous connection got crashed how
much time has been passed in between, divided by the 4 microsecond that should be the
initial sequence number of the next connection. If that is the possible that is the case then
there is the possibility of SYN flood attack which can happen in case of TCP.

So, in case of TCP the SYN flood attack is that you are continuously sending this kind of
spurious SYN connection to a node and that particular node will accept those connection
at a genuine connection and they will get blocked here, because, they will think of that
that particular initial sequence number which is been generated, it is it is indeed a correct
initial sequence number based on my clock input, so it will accept those SYN
connection. And if you are sending multiple such SYN connections from multiple
computers, that translates to a denial of service attacks. So, the computer and a server
will only become busy to response to the SYN packets, it will not be able to send any
data packets any further.

So, that is a possibility of a SYN flooding attack to launch a denial of service over TCP.
So, that’s why the later function of the TCP or indeed the current version of the TCP
what it does, that it uses the cryptographic function to generate the initial sequence

416
numbers. So, it is like that your clock value will give 1 one function 1 value. So, say the
clock value is saying that your initial sequence number should be x, if your initial
sequence number is x then you apply a cryptographic function to generate a initial
sequence number such that your initial sequence number y it is more than x and because
this is generated from a cryptographically secured function, so the attacker will not be
able to predict the value of y.

So, that way, you are ensuring that well in case of a previous connection, when the
connection got crashed here and you are trying to generate a new sequence number, your
clock value says that you should generate the new sequence number from this point. But,
then whenever you are restarting a connection you should generate it from this point, but
then the cryptographic hash function generates another value which is more than this
particular point say for at here. And you are starting your new connection from that
point.

So, that way it will ensure because you are going higher of that, it will ensure that there
is no overlap between the forbidden region of this new connection and the forbidden
region of this old connection, and at the same time because this value was
cryptographically generated the attacker will be not be able to guess that. So, that way
you will be able to safeguard the SYN flood attack in a TCP. OK?

(Refer Slide Time: 13:28)

417
Now, TCP connection release it again uses the 3 way handshaking mechanism. So, we
have 2 Host, Host A and Host B. Now Host A want to close the connection, when Host A
wants to close the connection at it initiates this connection closure we call it as an active
close. So, in case of active close Host A will send a FIN message FIN is the full form of
finish.

So, you want to close the connection send a FIN message with a current sequence
number and a current acknowledgement number, then Host B once it receives the FIN
message it again go to the close connection closure with this passive close. So, in the
passive close, it sends a FIN message, it sends an acknowledgement message to this fin,
so that Host A can close the connection in that acknowledgement it acknowledges this
FIN message with n plus 1. And at the same time it Host B wants to close the connection
itself, so this FIN message from Host A to Host B it is closing the connection from A to
B.

Now, if B wants to close the connection as well, so we have a bidirectional connection B


also B to A now if B wants to close this connection B sends this FIN message. If B does
not want to close it immediately then what B can do that B can only sends the
acknowledgement message and later on when it wants to close the connection, it can
sends the its own FIN message that is also possible. Now, once Host A receive these
acknowledgement message it starts a timeout, this timeout is to prevent these data loss
due to the symmetric nature of the closure. So, if you remember we have looked into
earlier that asymmetric closure insight and unreliable network is not possible so we want
to implement a symmetric closure with a timeout value.

So, this timeout value ensures that well if you are still receiving some packets from B,
then you can continue receiving that packet once this timeout occurs, you completely
close that connection you will not accept any packet after that. Even if you may get any
certain packets after that, but those packets will get lost. You cannot do anything with
those packets and a similarly Host A sending the acknowledgement message against a
FIN message or FIN plus acknowledgement message send by Host B and it updates the
acknowledgement number accordingly against these sequence number, and sends back
the acknowledgment to Host B, so Host B again closes the connection and do not send
any data.

418
So, you can see that the timeout is here in case of the active close, but for passive close
we do not require any timeout because, that is the last entity which is going to close. We
require this timeout for active close because it may happen that when Host A is initiated
this closure, Host A after getting the acknowledgement Host A can still receive some data
from Host B because, Host B has not sent any FIN message with it or even if it has sent a
FIN message it may happen that because of these reordering of the packet you may
receive certain packets after that.

So, we apply this timeout mechanism at the active close side, but at the passive close
side we do not require the timeout because, in the passive close side whenever you are
getting an acknowledgement from Host A, you know that Host A has already closed it is
connection, Host A has send a FIN message itself. So, it is just like that your friend has
closed the door and your friend has not do not want you to enter his room. So, you do not
want to wait any more.

So, so that is the reason here that Host A has already initiated that finish message. So,
Host A will not send any more data Host B knows that, so for the passive close case you
do not need to wait for the timeout value, whereas for the active close case I am
forcefully trying to close the connection. So I am giving an opportunity for the other end
to send few more data to me if it wants, so that is why we have this timeout value here.
Now as you have looked earlier for that hypothetical transport layer protocol that these
entire transport layer protocol follows a state transition diagram. So we also have a state
transition diagram for TCP.

419
(Refer Slide Time: 17:48)

So, let us look into the state transition diagram of TCP in little details because, that is the
important concept for TCP. So, this entire state transition procedure start from this close
state; that means, the server and the client both of them are closed, so they are they have
not started any TCP socket yet.

So, this are the notation that you see that everything is written by 1 message slash
another message, so this is the event action pair. So, that first one is the event and second
one is the action. Then, this dashed line is for the server. So, this dashed line which is
being followed that is for the server and solid line is for the TCP client.

420
(Refer Slide Time: 18:43)

So, the client as you know that in a client server OSI model, the server remains in the
listen state for getting a connection, getting a connection request from a client. So, the
client initiates the connection request and once connects client receives sends a
connection request and a server receives it, it start processing with that connection.

So, let us see that how this entire team moves using this state transition diagram using
TCP state transition diagram. So, from this close state let us first look into the client side.
So, the client initiate the connect system call and sends the SYN message. So, that is the
first step of the 3 way handshaking procedure and then the client moves to the SYN sent
state.

So, at this state, the client has sent a SYN message and it is waiting for the
acknowledgement from the server. Now from this SYN state sent state client can decide
after sending the SYN that I do not want to send any more data want to immediately
close the connection, so it may use a close message to close the connection immediately
and move to the close state.

So, whenever it is in the close state even if the server receives the SYN message and
send back with an acknowledgement, it will not accept that acknowledgement, it will
simply drop the acknowledgement. And, it will not send any more data because it is in
the close state and the server will wait for some amount of time, get a time out and again
move to the close state. So, that is for SYN sent state.

421
(Refer Slide Time: 20:29)

Now, after you have send a SYN then you can in that 3 way handshaking mechanism
from the client to server first you have to send the SYN message, then you will receive
an ACK from the server along with the SYN from the server as well and finally you will
send the ACK message.

So, here in the second stage you have received a SYN plus ACK message from the
server. So, once you have received these SYN plus acknowledgment message from the
server, then you send an acknowledgement message and move to the established state.
Similarly the server from the close state, it first makes this listen system call and moves
to the listen state. So, at the listen state it is ready to receive any connection
establishment message. So, once it receives a SYN message it sends back with a SYN
plus acknowledgment message.

So, this is the second step of the 3 way handshaking mechanism. So, the server has
received the SYN message and then sending a SYN plus acknowledgement message and
this is the third step of the 3 way handshaking where the client is receiving the SYN plus
ACK from server and sending back with the final acknowledgement and once the client
has done that, client is moving to the established state and it is ready for data transfer.

Now, from this listen state again the server can execute a close and close the connection
immediately, when the server has received a send SYN message and send back a SYN

422
plus acknowledgement message, server moves to the SYN receive state. So, from the
SYN receive state it can make a reset call and reset the connection to the listen state.

So, this reset call is that server somehow decides that it do not want to continue the
connection any more, that is sometime required to prevent the attack whenever you are
receiving multiple SYN messages from the same client like a SYN flooding thing to
prevent that you can have a reset call or maybe for some application requirement or
based on the application programming or certain exception in the application side you
want to reset the existing connection.

So, from the SYN receive you can call a reset call and again move to the listen state and
ignore these SYN you have already received. Now, there is there can be 1 case where
both the server and the client are initiating the connection together, so in that case that is
we call as a simultaneous open.

(Refer Slide Time: 23:07)

So, it is just like that from the server and client, the client has send a SYN and at the
same time the server has also sent a SYN. So, if that is the case like you are getting a
SYN message from the server, the client is getting a SYN message from the server
because ideally the client should sent a SYN and after that get the client should get a
SYN plus acknowledgement. But if it is just getting the SYN message from the server, it
sends a SYN plus acknowledgement message and the client can also move to the SYN
receive state.

423
So, it is just like that you have sent a SYN message to the server, but rather than getting a
SYN plus acknowledgement, the acknowledgement to the SYN that you have sent you
are getting a SYN message and not the acknowledgement message, so you are the client
is moving to the SYN receive state. At this stage, whenever you are getting an
acknowledgement message, you are moving towards the established state. So, the server
is moving server is getting this acknowledgment final acknowledgement message for the
3 way handshaking and it is moving to the establish state.

So, that way through this procedure everyone is moving towards the established state and
from this establishment state data transfer can get initiated. So, this is for the connection
establishment of TCP that it moves to this multiple states, and finally reaches to the
established state when you can initiate data transfer. Now the data transfer can goes on
based on the principle that we have shown you earlier that if established then send then
send data or if established and receive data. And after this connection established state,
then after this data transfer is over say you want to move to the connection closure state
you want to close that connection.

(Refer Slide Time: 24:54)

Now, whenever you are wanting to close that connection, the client can initiate the
connection that particular connection we call it as an active close, because the connection
closure is initiated by the client and for the server who is receiving that finish message
FIN message we call that as a passive close. So, we have seen that earlier.

424
Now, in case of the active close, the client send an client execute the close primitive and
send a FIN message. So, whenever it has sent a FIN message it moves to this FIN wait 1
state, then after sending this FIN message, you think of the connection release phase
from the client to the server; you have sent a FIN message, after sending a FIN message,
there are 2 possibilities, 1 possibility is that you get a FIN plus ACK. And the second
possibility is that the client and the server, the client has sent a FIN message and it is not
getting an ACK it is it is not getting a FIN it is just getting the ACK. So, if it is this case
that you are not getting the finish from the server. That means the server is believing that
it has more data to send you just receive an acknowledgement message and you move to
the FIN wait 2 state from FIN wait 1 state, because you have not received a FIN plus
ACK.

Now, if you are receiving the FIN plus ACK message, after receiving this FIN plus ACK
message you go to this time wait state. So, you remember that for the active connection,
active closure we have this time out value, where after receiving this FIN plus ACK you
wait for a timeout value once the time out happens then you clear the connection, so it
moves to this time wait state.

Similarly this FIN wait state it has received the acknowledgement, but it was waiting for
getting the FIN from the server, once it get this FIN from the server it sends that ACK
and moves to the time wait state. Now there can be another case like it has sent a FIN
message to the server, but without getting an ACK, it has received another FIN message
from the server itself.

425
(Refer Slide Time: 27:22)

So, it is a case of so this case is simultaneous closure case, where the client has sent a
FIN message to the server and server has sent another FIN message to the client, without
sending the ACK. So that means, the server is believing that it has more data to receive,
so in that case the client moves to the closing state by sending an ACK. So, you get the
finish message because you are anyway ready to finish, so you send that
acknowledgement message and move to this closing state. In this closing state you are
basically waiting for the acknowledgement from the server for this finish message that
you have sent.

Now, after that if the server sends this acknowledgement message to you, then you move
to the time wait state and after the time out occurs, you move to the close state. In case of
passive close, things are pretty simple that you are in the close wait state because you
have received the FIN message and you have send back with an acknowledgement
message and in the passive wait state you finally make a close call, so the server here is
making a close call here you sent your own FIN message, server is sending its own FIN
message and waiting for the last acknowledgement message.

So, once it server gets the last acknowledgement message, it close the connection and
again it goes back to the initial state that is the starting of the connection. So, this is the
entire state transition diagram of TCP. The important aspect here is this time wait state
that means, after getting the final acknowledgement, in case of the active close the node

426
which is initiating the closure it will wait for certain timeout duration and once the
timeout occurs then only it will close the connection and another interesting state is this
closing state where you have sent a FIN message to the server, but rather than getting an
acknowledgement, you have received the FIN message from the server.

So, it is just like that you want to close the connection, the server also wants to close the
connection, but server is not immediately acknowledging because, it has a belief that it
may receive some more data or it is waiting for some other processing. So, these are the
2 interesting steps here in case of connection closure and this connection closure is
interesting because, here our objective is to prevent the data loss as much as possible.
Because of a result of this impossibility principle that we talked earlier with the example
of these 2 army problem that, if you have a unreliable channel then over that unreliable
channel you will be never be succeed to have a protocol of simultaneously closing the
connection or getting a consensus over this unreliable channel if the system is
asynchronous.

So, we need to go for this synchronous closure and in case of synchronous closure to
prevent the data loss as much as possible, TCP has taken this steps and in this particular
steps, the interesting part is this timeout for active closure that once all the things is over
the node which is initiating for the closure it waits for certain amount of time. Once the
timeout occurs they close it, but for the passive close you do not require the timeout
because, for the passive close the other end has already closed the connection, so you
know that it is not going to send anymore data to you.

So, this is the entire connection modeling part of TCP protocol and in the next class,
we’ll look into the flow control algorithm. So, this connection establishment it has
helped you to set the initial sequence number. So once this initial sequence number has
been established then you can use that initial sequence number. So, you are at the
established state and with that established state and the initial sequence number that has
been agreed upon during the connection establishment phase; you can use that for further
data transfer using your flow control algorithm.

So, in the next class we will look into that flow control algorithm in details.

Thank you all for attending this class.

427
Computer Networks and Internet Protocol
Prof. Sandip Chakraborthy
Department of Computer Science and Engineering.
Indian Institute of Technology, Kharagpur

Lecture -21
Transmission Control Protocol - III (Flow Control)

Welcome back to the course on Computer Network and Internet Protocol. So, in the last
class, we have looked into the details of TCP connection establishment.

(Refer Slide Time: 00:25)

Now in this particular class, we look into the further details of TCP, the flow control
algorithm, which is used by TCP to manage the rates of sender rates at sender side. And
the different timers associated with this flow control algorithm and how you set a proper
value for those timers.

428
(Refer Slide Time: 00:48)

Well, starting with the flow control algorithm. So, TCP uses a sliding window flow
control algorithm with this go back N principle go back N ARQ principle. Where, if
there is a time out, then you retransmit all the data which is there, inside your sender
window.

So, the idea is something like this, in a very simplified notion, that you say start to its
subsequent number 0. So, remember that 0 is not the initial sequence number rather here
just for explanation we are utilizing this sequence number as 0. But ideally it will start
from the initial sequence number that has been established during the hand shaking phase
of the connection establishment.

So, here the sequence number is like, if it is sequence number so, the initial sequence
which is being established for last the sequence number that we are talking about here.
So, just for simplicity of explanation we are starting with sequence number 0. So, let us
start with sequence number 0 and at this stage the application does a 2 kB write at the
transport layer buffer.

When the application does a 2 kB write at the transport layer buffer, so, you send 2 kB of
data and you are sending a 2 kB of data with sequence number 0. So, initially this is the
receiver buffer. So, the receiver buffer can hold up to 4 kB of data. So, once you are
getting that so, the receiver buffer it says you that well, it has to received 2 kB of data.
So, it has only 2 kB of data which it can accept. So, it sends back with an

429
acknowledgement number of 2048, 2kB is equivalent to 2048 bytes so, because we are
using byte sequence number. So, it sends an acknowledgement to it, 2048 and the
window size has 2048 so, it can hold 2 kB of more data.

So, at this stage, that then again application does a 2 kB of write. So, when the
application does a 2 kB of write, you are sending 2 kB of data, further data along with
the sequence number starting from 2048. So, it is received by the receiver. So once it is
received by the receiver. So, here because you have already sent 2 kB of data and the
earlier advertised window size was 2048, so the sender is blocked from this point,
because the sender has already utilized the entire buffer space that the receiver can hold,
the sender cannot send any more data. So, the sender is blocked at this stage. So the
receiver buffer becomes full after receiving this 2 kB of data. So, the receiver sends an
acknowledgement saying that it has received up to 4096 bytes and the window size is 0.
So, it is not able to receive any more data. So the sender is blocked at this point.

Now, at this stage, the application reads 2 kB of data from the buffer. Once the
application reads 2 kB of data from the buffer, so, it has this it has read this first 2 kB.
So, again this first 2 kB becomes full. So, when the first 2 kB becomes full, the receiver
sends an again an acknowledgement that well the acknowledgement number was 4096
the one which was there earlier, but the window size now changes from 0 to 2048. So, it
can get 2 kB of more data.

So, once it the sender receivers back sender comes out of the blocking stage and once the
sender is coming out of the blocking stage, so the sender may send up to 2 kB of more
data. So, at this stage say the sender is sending 1 kB of data with sequence number 4096.
So, that 1 kB is received by the receiver it put it in the buffer and it has 1 kB of free. So,
if the receiver wants to send an acknowledgement, in that acknowledgement number it
will use the acknowledgement number as 4096 plus 1024 that it has received.

And the sequence and a this window size as window size has 1 kB so, window size at
1024 So, that acknowledgement it will send back to the sender.

So, that way the entire procedure goes on and whenever sender is sending some data, that
at this stage the sender this has send some data of 2 kB of data. Then in the sender buffer
that 2 kB of data is still there until it receives that acknowledgement. If this

430
acknowledgement is lost, then based on that go back N principle it will retransmit this
entire 2 kB of data which was there in the sender buffer ok.

(Refer Slide Time: 05:17)

So, the algorithm is pretty simple considering this sliding window protocol with go back
N principle. But there are certain tricks in it. Let us look into those tricks. First of all
consider an application called telnet, I am not sure how many of you have used telnet.
So, telnet is an application to make a remote connection to a server. So, with this telnet
application you can make a remote server remote connection to a server and then execute
the commands on top of that.

So, whenever you are making this remote connection to a server and executing the
commands on that, say you have just written “ls”, the Linux command ls to listing all the
directives which are there in the current folder. So, that ls command need to be send to
the server side over the network because, that is remote connection using telnet that you
have done.

So, this telnet connection it reacts on every such keystroke, in the worst case that it may
happen that whenever a character arrives at the sending TCP entity, TCP it creates a 21
byte of TCP segment, where 20 byte is there in the header and 1 byte of data. TCP
segment header is 20 byte of long, but telnet is sending the data to the server byte by
byte. So, telnet application at the client side it has just received 1 byte of data and that 1
byte of data it is trying to send with the help of a TCP segment.

431
So, in that TCP segment what will happen, that the TCP segment side will contain 20
byte of the header and only 1 byte of data. So, you can just think of that what is the
amount of overhead you have. So, with that 21 byte of packet, packet or rather 1 byte of
segment, you are sending only 1 byte of data. And for this segment, another ACK and
window update is sent when the application reads that 1 byte.

So, the application reads that 1 byte and application sends back an acknowledgement.
So, this results in a huge wastage of bandwidth, just you are not sending any important
data to the server side, rather you are sending very small amount of data and the huge
amount of resources utilized because of the headers.

(Refer Slide Time: 07:28)

So, to solve this problem, we use the concept called delayed acknowledgement. So, in
case of delayed acknowledgement, you delay the acknowledgement and window updates
for up to some duration 500 millisecond in the hope of receiving few more data packets
within that interval. So, it says that well whenever you are getting a character from the
telnet application, you do not send it immediately. Rather you wait for certain amount of
duration that is the 500 millisecond by default in TCP. And your hope is that by that time
you may get some more data and you will be able to send a packet where with 20
kilobyte of sorry 20 byte of header you will have more than 1 byte of data.

However, in this case, the sender can still send multiple short data segments because, if
the sender wants. So, it is just like that whenever whenever you are sending the

432
acknowledgement acknowledgement to the sender, you are you are sending delaying the
acknowledgement. You are delaying the acknowledgement, that means, you are not
sending any immediate acknowledgement. And a sender to remember that, a sender
unless it gets an acknowledgement with the available buffer space, the sender will not
send anymore of data. So, the receiver just keep on waiting that, whenever it will get
sufficient data from the sender it will have sufficient space at the receiver, that then only
it will send back that acknowledgement to the to the sender. So, the receiver will not
send immediate acknowledgement to the sender to prevent the sender to send further data
to the receiver.

(Refer Slide Time: 09:01)

Well now, we have another algorithm. So, in the earlier case what we have seen that well
with the delayed acknowledgement, you are expecting that unless you are sending an
acknowledgement to the sender, the sender will not send any further data. But sender is
not restricted to that sender is that whenever it will get data from the telnet application it
will immediately send the data.

Now, to prevent sender for sending this kind of small packets or small segments, we use
the concept of Nagle’s algorithm. What is this? The Nagle’s algorithm tells that, when
the data come into the sender in small pieces, just send the first piece and buffer all the
rest until the first piece of acknowledgement. So, it is just like that, you have received a

433
small data segment or single bytes you have received byte A, you send that byte A from
the sender say this is the sender and this is your receiver.

And you keep on buffering all the subsequent characters A B C D until you get the
acknowledgement from the sender. So, the hope here is that whenever you are sending
some short packet in the internet, you are not sending multiple short packets one after
another. That means, you are not sending a packet A, packet B, B, packet C like segment
A, segment B, segment C over the network rather only one short packet will be
outstanding in the network at any given instance of time.

So, that way by the time you will get the acknowledgement for this packet A your
expectation is that, you will get multiple other characters in the sender buffer. Whenever
you are getting multiple other buffer characters in the sender buffer, you can combine
them together, construct a single segment and send it over the network.

(Refer Slide Time: 10:57)

The question comes here that we want to use Nagle’s algorithm all the time? Because
Nagle’s Nagle’s algorithm intentionally increasing the delay in transfer. So, if you are
just using telnets application and applying Nagle’s algorithm, your response time for the
application will be slow. Because although you are typing something, that TCP is
preventing that single byte to reach at the server side unless it is getting an
acknowledgement for the previous short packet.

434
And that is why do not want to use Nagle’s algorithm for delay sensitive application.
And there is another interesting observation here that, if you implement Nagle’s
algorithm and delayed acknowledgement altogether, what may happen? That the in the
Nagle’s algorithm the sender is waiting for the acknowledgement. The sender has sent
one small packet or a small segment and the sender is waiting for the acknowledgement,
but the receiver is delaying that acknowledgement. Now if the receiver is delaying the
acknowledgement and the sender is waiting for that acknowledgement. So, the sender
may go to starvation and you may have a significant amount or considerable amount of
delay in getting the response from the application. So, that’s why if you are
implementing Nagle’s algorithm and delayed acknowledgement altogether, it may result
in a scenario, where you may experience slow response time from the application
because of the starvation.

So, in broad sense, the delayed acknowledgement what you are doing? You are
preventing the receiver to sending small window updates. And you are delaying this
acknowledgement at the receiver side with the expectation that the sender will
accumulate some more data at the sender buffer. And it will be able to send the large
segment rather than a small segment.

Whereas, in case of Nagle’s algorithm you are just waiting for the acknowledgement of a
small segment with the expectation that by that time the application will write few more
data to the sender buffer and these two together can cost a starvation. So, that’s why we
do not want to implement delayed acknowledgement and Nagle’s algorithm altogether.

435
(Refer Slide Time: 13:14)

So, one possible solution comes from, another problem in this window update message,
which we will call as the silly window syndrome. So, let us see that what is silly window
syndrome? So, it is like that data are passed to the sending TCP entity in large block, but
an interactive application under receiver side reads data only one byte at a time. So, it is
just like that, if you look into the receiver side, the receiver this is the receiver buffer say,
this is the receiver buffer.

So, the sending application is sending data at a rate of 10 mbps say, the sender has lots of
data to send, but you are running some kind of interactive application at the receiver side.
So, it is receiving data at a very slow rate like at a rate of 1 kB at a time or 1 byte at a
time the example that is given here at 1 byte at a time.

Now, if it happens, so, this is the kind of problem. Initially, say the receiver buffer is full
when the receiver buffer is full, you are sending an acknowledgement to the sender
saying that the acknowledgement the corresponding acknowledgement number followed
by the window value as 0. So, the sender is blocked here, now the application reads 1
byte of data. The moment application reads 1 byte of data; you have a free space here in
the buffer. Now say, the receiver is sending another acknowledgement to the sender
saying that the window size is 1.

So, if it sends this window size small window size advertisement to the sender, what the
sender will do? Sender will send only 1 byte of data. And once it sends 1 byte of data

436
with that 1 byte of data again the receiver buffer becomes full. So, this becomes in a loop
and because of this window update message of 1 byte, the sender is tempted to send 1
byte of segment with every window update message. So, this again create the same
problem that we were discussing earlier that you are sending multiple small segments
one after another.

And we do not want to send those multiple small segments, because it has such
significant overhead from the network perspective. It conceives a huge amount of
bandwidth without transferring any meaningful data to the receiver intake.

(Refer Slide Time: 15:43)

So, to solve this problem, we have a solution which is proposed by Clark, we call it as a
Clark solution. So, the Clark solution says that do not send window update for 1 byte,
you wait for sufficient space is available at the receiver buffer. Once some sufficient
space is available at the receiver buffer then only you send the window update message.

Now, the question comes that what is the definition of the sufficient space. That depends
on the TCP implementation that if you are using some buffer space, then you use certain
percentage of the buffer space. If that is become available then only you send the
window update message to the sender.

437
(Refer Slide Time: 16:23)

Well, here the interesting fact is that to hand glass handle the short segments at the
sender and receiver altogether, that this Nagle’s algorithm and the Clark’s solution to
silly window syndrome - they are complementary, just like the earlier case like the
Nagle’s algorithm and the delayed acknowledgement can create a starvation that will not
happen here.

So, the Nagle’s algorithm it solves the problem caused by the sending application
delivering data to TCP 1 byte at a time. So, the sending it prevents the sending
application to send small segments. Whereas, the Clark solution, here it prevents the
receiving application for sending window update of 1 byte at a time. So, the receiver,
receiving application fetching the data from the TCP layer 1 byte at a time for that you
will not send immediate window update message.

There are certain exception to that because; whenever you are applying this Nagle’s
algorithm and the Clark solution. Again it will have some amount of delay on the
application perspective. The application response time will be still little slow, because
you are waiting for sufficient data to get accumulated and then only create a segment.

Similarly, on the receiver side you are waiting for sufficient data to read by the
application and then only you will send the window update message, this may still have
some higher response time from the application perspective, may not be as high as like a
starvation which was there for Nagle’s algorithm and delayed acknowledgement. But, for

438
certain applications say for some real time application, you want that the data is
transferred immediately bypassing the Nagle’s algorithm and the Clark solution; in that
case in the TCP header you can set the PSH flag.

So, this PSH flag it will help you to send the data immediately, it will help make inform
the sender to create a segment immediately, without waiting for more data from the
application side. So, you can reduce the response time by utilizing the PSH flag.

(Refer Slide Time: 18:43)

Well now, the second thing is that handling out of order segments in TCP. So, what TCP
does? The TCP buffer space out of order segments and forward duplicate
acknowledgement. So, this is an interesting part of the TCP this concept of duplicate
acknowledgement. So, what TCP does that whenever you are receiving certain out of
order segment say for example, I am just trying to draw a yeah, so, I am trying to say this
is the receiver buffer. In the receiver buffer, we have received up to say this segment and
the receiver is say this is say 1024. It has received up to 1023 and it is expecting from
1024 and you have received the segment from say 2048 to something else.

Now, at this case, whenever it has received this previous segment, it has sent an
acknowledgement with sequence number as 1024; that means, the receiver is expecting
and segment starting from byte 1024, but it has received this out of order segment. So, it
will put the out of order segment in the buffer, but it will again send an

439
acknowledgement with this same sequence number, that it is still expecting sequence
number 1024.

So, this acknowledgement we call it as a duplicate acknowledgement. So, this called a


duplicate acknowledgement or in short form DUPACK. So, this DUPACK, we will
inform the sender application that well ah; it has this particular receiver has not received
the byte starting from 1024, but it has received certain other bytes after that.

So, this has an important consequence in the design of TCP congestion control algorithm.
So, we look into the details of this consequence, when we discuss about the TCP
congestion control algorithm in the next class.

(Refer Slide Time: 21:14)

So, here is an example, say the receiver has received the bytes 0 1 2 and it has not
received the bytes 3 and then it has received bytes 4 5 6 7. So, TCP sends a cumulative
acknowledgement with acknowledgement number 2 which acknowledges everything up
to byte 2.

So, once this four is received a duplicate ACK with acknowledgement number 3 that is
the next expected byte it is forwarded. This triggers a congestion control algorithm which
we look into the details in the next class, after time out the sender retransmits byte 3. So,
whenever the sender is retransmitting byte 3 so, you have received byte 3 here.

440
So, the moment you have received byte 3 here, you have basically received all the bytes
up to byte 7. So, you can send another cumulative acknowledgement with
acknowledgement number 8; that means you have received everything up to 7 and now
you are expecting byte 8 to receive ok.

(Refer Slide Time: 22:15)

TCP has multiple timers implementation. So, let us look into those timers in detail. So,
one important timer it is TCP retransmission timeout or TCP, we call it in short form TCP
RTO. So, this retransmission timeout helps in the flow control algorithm. So, whenever a
segment is sent, this retransmission timer is started if the segment is acknowledged so, if
the segment is acknowledged before the timer expires the timer is stopped and if the
timer expires before the acknowledgement comes, the segment is retransmitted. So, once
you have transmitted a segment from the sender side you start the timer, say within this
timeout if you receive the acknowledgement, then you restart the timer otherwise once
timeout occurs, then you retransmit this segment.

So, timeout occurs means, something bad has happened in the network and
simultaneously it also triggers the congestion control algorithm that we will discuss
during the discussion of the congestion control algorithm, but it also retransmit the lost
segment. So, if it does not receive the acknowledgement within the timeout, it assumes
that the segment has lost.

(Refer Slide Time: 23:36)

441
Now, the question comes that what can be an ideal value for this retransmit timeout. So,
how will you say this retransmit timeout? So, one possible solution is that to estimate the
round trip time because, you have sent a segment and you are waiting for the
corresponding acknowledgement. So, ideally if everything is good in the network, then
this segment transmission and the acknowledgement transmission it will take one round
trip time.

So, it is one round trip time it is expected to get everything, but because of the network
delay and something, you can think of that well I will setup the retransmission timeout to
some positive multiples of RTT. Some n x RTT where n can be 2, 3; something like that
based on your design choice. But then the question comes that how you make an
estimation of RTT? Because your network is really dynamic and this RTT estimation is a
difficult for transport layer. So, let us see that why it is difficult for transport layer.

442
(Refer Slide Time: 24:32)

So, if we make a plot something like this so we are we are trying to plot the RTT, the
round trip time and the data link layer and the transport layer. So, the difference is that in
case of data link layer, you have two different nodes, which are directly connected via
link. So, if these two different nodes are directly connected via link. So, how much time
it will take to send the message and get back the reply.

But in case of your network layer, in between the two nodes you have this entire internet
and then and another node and then you are trying to estimate that, if you are sending a
message to this end host and receiving back a reply what is the average round trip time it
is taking.

Now, if we just plot this round trip time, the distribution of this round trip time, we will
see that the variation is not very high whenever you are at the data link here because, it is
just the single link and in that single link this dynamicity is very less because, the
dynamicity is very less for a single link you can make a good estimation, if you take the
average with that average we will give you a good estimation of that round trip time.

443
(Refer Slide Time: 25:37)

But that is not true for the transport layer, in case of transport layer because there are lots
of variability in between this intermediate network between the sender and the receiver.
So, your round trip time varies significantly so the variance in round trip time it is very
high.

So, if you just take an average, the average will never give you a right estimation it may
happen that well, the actual value falls somewhere here and there is a significant
deviation from the average. And if you set retransmission timeout by considering that
RTT estimation you will get some spurious RTO’s. So, the solution here is that you use a
dynamic algorithm that constantly adopts the timeout interval, based on some continuous
measurement of network performance.

(Refer Slide Time: 26:27)

444
So, how will you do that? So, to do that we have something called the Jacobson
algorithm proposed in 1988 which is used in TCP. So, the Jacobson algorithm says that
for each connection, TCP maintains are variable called SRTT the full form is Smoothed
Round Trip Time which is the best current estimate of the round trip time to the
destination.

Now, whenever your segment whenever you are sending a segment you start a timer. So,
this timer have two different purpose like it can you it can be used to trigger the timeout
and at the same time it can be used to find out that how much time it take to receive the
acknowledgement.

(Refer Slide Time: 27:09)

445
So, whenever you have say sent a sent a message say this is the sender, this is the
receiver you have send the segment and you have start the timer. So, the timer the clock
will keep on ticking. So, if you receive the acknowledgement here so at this stage you
can think of that well this the timer stops here and this difference will give you an
estimation of round trip time. But if you do not receive this acknowledgement, then after
some timeout this timer expire say, here and once the timer expires, you retransmit the
segment.

So, it can be used for two different purposes this the same timer. So, ah, so, you measure
the time if you receive back an acknowledgement and you update the SRTT as follows.
So, SRTT would be some alpha times the previous estimation of SRTT plus 1 minus
alpha of this measured value R. So, this algorithm this mechanism we call as
exponentially weighted moving average or EWMA. Now alpha is a smoothing factor that
determines that how quickly the old values are forgotten like what weight you are going
to give in the old values typically in case of TCP Jacobson set this alpha to a value of 7
by 8.

(Refer Slide Time: 28:39)

Now, this EWMA algorithm has a problem like; even you give a good value of SRTT,
choosing a suitable RTO is nontrivial. Because the initial implementation of TCP it used
RTO equal to two times of SRTT, but it has found out that still there is a significant
amount of variance say ah, from the practical experience people have seen that a constant

446
value, this constant value of RTO it is very inflexible because, it fail to response when
the variance went up.

So, if your RTT has a measured RTT has too much deviation from the estimated RTT,
then you will get the spurious RTO. So, in case your RTT fluctuation is high you may
lead to a problem. So, it happens normally at high load so when your network load is
very high your RTT fluctuation will become high.

So, in that case, the solution is that apart from the average one, you consider the variance
of RTT during the RTO estimation. Now how we consider the variance of RTT?

(Refer Slide Time: 29:41)

Now, to consider the variance of RTT so, you update the RTT variance variation which is
termed as RTTVAR as follows. So, RTTVAR will be equal to beta time previous
estimation of RTTVAR plus 1 minus beta of current estimation of the variance, that is the
difference between current estimation of the RTT and the measured RTT that will give
you the current variance and we set beta equal to 3 by 4.

Now, you estimate the RTO as follows so, you will take the SRTT value so; that means,
the estimation of the round trip time into plus 4 times of RTT variance. So, you are here
considering the variance as well so, if your network load becomes high. So, the system
will get adapted to this variation. Now a question may come to in your mind that why 4?
So, god knows so, why 4 so, it was somehow arbitrary. So, Jacobson’s paper if you look

447
into the Jacobson paper that had deal with this RTO estimation, in that case it is full of
many such clever tricks. So, they have used integer addition subtraction and shift to
make all this computation lightweight.

So, he has used this value 4 so that, 4 is 2 square. So, you can apply the binary shift
operation to make this computation. So, that is just a reason possibly Jacobson has
utilized all this values and set this values set this particular.

(Refer Slide Time: 31:14)

Now, another question comes which is like how will you get the RTT estimation when a
segment is lost and retransmitted again. If a segment has lost and retransmitted again,
then you will not get the proper estimation of RTT because this segment you have
transmitted the segment. So, the segment has lost you have started the timer here. So,
there is a timeout you again after the timeout we transmitted the segment and you got the
acknowledgement.

Now, if that is the case, then this will; obviously, not give you an estimation of the RTT
because in between the segment got lost and you have made a duplicate transmission of
the same segment.

(Refer Slide Time: 31:56)

448
Now, to prevent this Karn provides an algorithm and the Karns algorithm says that do
not update the estimates on any segments that has been retransmitted. So, you do not
update your RTT estimation whenever you are retransmitting a segment. And a timeout it
is doubled on each successive transmission until the segment gets through the first time.
So, it is just like that once you have set a set a timer so, once you have set a timer say
you got a timeout.

(Refer Slide Time: 32:17)

You retransmit the segment then you set say this was the value of RTO, for the next time
you set is as 2 times RTO. So, you wait for more time to get back the response, if you get

449
back the response by that time it is good, if you are not getting that then you make it 4
times the RTO.

So, that way you increment the RTO until you get back the acknowledgement whenever
you are getting the acknowledgement again you reset it to the original implementation of
retransmission timeout.

(Refer Slide Time: 32:56)

So, there are other TCP timers like this persistent TCP timer, which avoid deadlock when
receiver buffer is announced as 0. So, after the timer goes off the sender forwards a probe
packet to the receiver to get the updated window size, there is something called
Keepalive timer. So, this Keepalive timer it closes the connection when a connection has
been idle for a long duration. So, you have set up a connection at not sending any data.
So, after this Keepalive timer it will go off and then the time wait state which we have
seen in case of connection closure. So, you wait before closing a connection which is in
general twice the packet lifetime.

So, this is all about the flow control algorithm and different set up of your TCP timer
values. In the next class we have we’ll see how we apply this loss or duplicate
acknowledgement that we have seen here for the management of TCP congestion
control.

Thank you all for attending this class.

450
Computer Networks and Internet Protocol
Prof. Sandip Chakraborthy
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 22
Transmission Control Protocol – IV (Congestion Control)

Welcome back to the course on Computer Network and Internet Protocols. So, we are
looking into the Transmission Control Protocols in detail. So, in the last class, we have
looked into the flow control algorithms in TCP.

(Refer Slide Time: 00:28)

So, in this lecture, we look into the congestion control algorithms in TCP. In the context
of generic transport layer protocols, you have looked into that this congestion control
algorithms in a transport layer, they use a nice principle to ensure both efficiency as well
as fairness.

So, here we will look into that how TCP utilizes the concept of capacity and fairness
together in the congestion control algorithm, which it incorporated.

451
(Refer Slide Time: 01:03)

So, here is the basic congestion control algorithm for TCP. So, the basic congestion
control algorithm for TCP is based on the implementation of additive increase
multiplicative decrease, using a window based control mechanism, and TCP considers
packet loss as a notion of congestion. So, earlier we have looked into these principles of
additive increase multiplicative decrease, where we have seen that well AIMD provides a
notion of maximizing the capacity as well as fairness in the network.

So, what we have looked into that whenever there are multiple flows, which are getting
congested at the network bottleneck or that the bottleneck link, both the flows are trying
to maximize their capacity. And when both the flows tries to maximize their capacity
during that time, we need to ensure that every flow gets the required capacity that
maximizes its fairness as well. So, considering the global network perspective, where
multiple flows are contending with each other to get the information to get the data,
during that time this notion of congestion and the notion of fairness since congestion is
an important aspect.

And what we have seen earlier, that in case of a distributed network ensuring hard
fairness is very difficult. And at the same time, hard fairness can affect your capacity, the
available capacity or it can under utilize the available network capacity. So, to remove
the under utilization of the network capacity that in network; generally, we use the max
min fairness principle and the max min fairness principle says that well, your objective

452
would be to maximize the end to end capacity that you can get for a particular flow. In
that notion, we have seen that AIMD provides this max min fairness along with
maximizing the utilization of the link bandwidth that you have at the network bottleneck
in contrast to additive increase additive decrease principle of rate control, and
multiplicative increase multiplicative decrease notion of rate control.

So, TCP incorporates the same principle of additive increase multiplicative decrease,
where it increases the rate additively, whenever there is sufficient amount of bandwidth
available in the end to end path. And whenever TCP detects a congestion with the help of
a packet loss, where packet loss gives a signal to congestion, then it drops the rate in a
multiplicative way or following a multiplicative notion. So, this AIMD principle that we
discussed earlier is incorporated in TCP.

So, to incorporate this notion of AIMD for congestion control, while maintaining
fairness; TCP maintains a window, which is called a congestion window. So, this
congestion window is the number of bytes that the sender may have in the network at
any instance of time. Now, if that is the case, then your sending rate will be equal to the
congestion window divided by RTT. So, RTT is the round trip time, the time to propagate
a message from one node to another node and then getting back the reply, this total round
trip time.

So, if you divide the congestion window size that means, the number of bit or the
number of bytes that the system can push to the network divided by the total RTT, that
gives you an approximation of the sending rate, when the sender is sending data at a rate
of congestion. But, as you have seen earlier, we have another notion here, which is the
receiver window size at a rate of the receiver, which comes from the flow control
algorithm.

So, ideally what we have to do, we have to incorporate or we have to merge the flow
control principle along with the congestion control principle. And what we have seen
earlier that well, the flow control it maintain its own window size, which is based on the
feedback of receiver advertised window. So, the receiver advertised window, receiver
announces that that is the available place at the available buffer at the receiver. So the
sender can send that much amount of data, so that buffer overflow does not occur from

453
the receiver side. And with that, from this receiver feedback window size, the sender also
control its rate.

So, ideally your sending rate should be the minimum of the receiver rate, the rate at
which the receiver can receive the packet. And the rate at which the network can deliver
the packet to the other end. So that is why your sending rate should be minimum of the
receiver rate and the network supported rate. Now, this concept of network supported
rate, it is coming from the congestion control algorithm; and the receiver rate that is
coming from the flow control algorithm.

Now, the receiver advertised window size that gives you the possible rate at which the
receiver can receive the data. And the congestion window size that is giving the rate at
which the network can support transmission of data over the end to end links. So that
way your sender window size should be the minimum of congestion window, and the
receiver window. So, this congestion window is providing you the rate that network
supports, and receiver window is giving you the rate that receiver supports. So, that way
and thus we are getting the sender window that is giving you the sending rate or the
sender rate.

So, this is the notion of combining congestion control and flow control together in TCP.
And with this principle, TCP controls the sender window size. So, initially your
congestion window size is kept at a very minimal rate. Then, we increase the congestion
window size gradually to find out that what is the bottleneck or what is the capacity of
the link. And if a congestion is detected, then we apply the AIMD principle to decrease
the rate. So that is the broad idea of congestion control in TCP.

454
(Refer Slide Time: 07:50)

Now, let us see that how this entire congestion control in TCP was invented, and this
congestion control in TCP is a nice example of a networking or a better to say
decentralized or distributed networking protocol. So, this entire concept of congestion
came in 1986 from a event called a congestion collapse. So, in 1986, this growing
popularity of internet it led to the first occurrence of congestion in the network, so we
call it as the congestion collapse. So, this congestion collapse was a prolonged period
during which the goodput of the system that they dropped significantly more than a
factor of 100.

So, based on this notion of congestion collapse that observation of congestion collapse;
Van Jacobson was the key person who actually investigated this phenomenon of
congestion in the internet. And this early TCP congestion control algorithm that was
developed by Van Jacobson. And the initial proposal came around 1988, which was
successor of the event of congestion collapse that happened in 1986.

But, the challenge for Jacobson was to implement the congestion control algorithm
without making much changes in the protocol, it was necessary to make the protocol
instantly deployable in the network, because during that time, many of the systems were
using TCP for transmission of data. And the notion of internet was already there, people
were accessing data over the internet. So, during that time if you design a completely

455
different protocol, what you have to do, you have to make the change to all the machines
in the system.

And during that time, the size of the network was may not be as large as it is today or
maybe some thousand factors lesser than today, but still it was significant. And design of
a complete new protocol may lead to a problem of backward compatibility. So that was
the major challenge for Jacobson to design a new protocol, which would be compatible
with the existing implementation of TCP, and you do not require much changes in the
TCP protocol.

So, to solve this, Jacobson had a nice observation, and the observation was that he found
that well packet loss is a suitable notion for congestion. Now, here there is a glitch,
remember that during that time, when Jacobson invented this congestion control
algorithm in TCP, the notion of wireless network was not that much popular or it was just
in a very nascent stage, so most of the internet was connected by the wired network. And
in a wired network, in general you do not get a loss from the channel, because the
communication media is guided, it is where so your link layer protocol will take care of
the interference in the channel, and that is why you will not experience a loss from the
channel. So, your channels are kind of lossless in case of a wired network.

So, if there is a loss of packet, that loss is certainly from the network buffers from the
intermediate network devices. And because of that if there is a packet loss from the
network buffer, you can certainly infer that the buffer has overflown, and because the
buffer has overflown, you are having a congestion in the network so because of the
congestion, the buffer can only overflow. So, that way Jacobson found out that the packet
loss is a suitable signal for congestion, so you can use the timeout to detect a packet loss.
And then tune the congestion window based on the observation from packet loss.

So, you increase the congestion window value, the moment you observe a packet loss
that gives you an indication that well, there is a notion of congestion in the network or
there is some occurrences of congestion in the network, because of which the packet has
lost, which you have detected from a timeout. And whenever you are detecting a packet
loss from a timeout, then you apply AIMD principle to reduce your rate based on the
multiplicative decrease principle.

456
(Refer Slide Time: 12:09)

Well. So, here is the another interesting observation that how will you adjust the
congestion window based on the AIMD principle. So, one of the most interesting ideas in
TCP congestion control is use of acknowledgement for clocking. So, here this picture
depicts the interesting fact that well. Whenever you are sending the packet, so assume
that this is the network scenario, you have the sender, and an intermediate router, and
then the receiver, they are connected via two links, so it is a two hop path. So, this link is
a fast link. So, this is a fast link, and the second link is a slow link. So, this second link is
basically your bottleneck link. So, the congestion will happen, when lots of data will be
pushed to this lower link or the bottleneck link.

Now, whenever you are sending the packet, so you are sending the packet from the
sender in the form of a burst, that traverse the faster link, then in the slower link, because
this link is slower, your packet will take more time to propagate to the receiver. Now,
when if you look into the acknowledgement the rate of the acknowledgement will
actually be the rate of sending the packet at this slower link; so whatever be the rate of
acknowledgement at this slower link, the same rate of acknowledgement will perceive in
this fast link as well. So, that way whenever the sender will get the acknowledgements,
that acknowledgement actually indicates the rate of the slower link, which is there in
your end to end path or better to say if you have multiple hop path, then the rate of the
slowest link in that the rate, the acknowledgement will arrive at the sender.

457
Now, if sender monitors the rate of acknowledgement that gives an idea that well,
possibly at that rate, the packets are being transmitted to the receiver. So, the
acknowledgement returns to the center at about the rate, that the packets can be sent over
the slowest link in the path. So, you trigger the congestion into adjustment based on the
rate at which acknowledgement are received. So, here these acknowledgements are used
as a clocks to trigger the congestion control in the network. So that was another
interesting observation by Jacobson, while designing the congestion control algorithm,
so well, so that was the basic principle.

(Refer Slide Time: 14:41)

Now, whenever you are getting an acknowledgement, you will you will trigger or you
will adjust your congestion window size, but the question comes that at what rate you
will apply additive increase in the network. So, initially what you can do that you can set
the congestion window to one packet, and then gradually increase the size of the
congestion window, when you will receive an acknowledgement.

Now, let us see what happens, if you apply a additive increase principle. So, if you in
apply a additive increase principle, what additive increase says, that initially you send
one packet, whenever you are making an acknowledgement, then you increase the
congestion window by one, so now your congestion window is two, so you send two
packets. So, once you are successfully receiving that two packets, the acknowledgement
for those two packets, then again you increase your congestion window by one, so now

458
your congestion window is three, so you can successfully transfer three packets. You
wait for the acknowledgement for those three packets, whenever you are receiving the
acknowledgement for those three packets, again you increase the congestion window to
four from three, and send four packets.

Now, if you are applying this additive increase of congestion window over the network.
So this AIMD rule, it will take a very long time to reach a good operating point on fast
networks, because this congestion window started from the small size. So, let us see an
example. So, assume that you have a 10 mbps link you have a 10 mbps link with 100
milliseconds of round trip time, and in that case, your appropriate congestion window
size should be equal to BDP the Bandwidth Delay Product, that we have seen earlier. So,
with 10 mbps link and 100 millisecond RTT, your bandwidth delay product comes to be
1 megabit.

Now, assume that you have a 1250 byte packets, you have a 1250 byte packets means,
you have 1250 into 8, so that means, 10000 bits packet. And if you have a 10000 bit
10000 bit packet so if you have a 10000 bit packet that means, with 1 megabit BDP, you
can transfer you need to transfer at least 100 packets to reach to the bandwidth delay
product. Now, if you assume that the congestion window starts at 1 packet, and the value
of the congestion window is increased 1 packet at every RTT, because this RTT is based
on the rate at which you are receiving the acknowledgement. So, at every RTT, you
increase 1 congestion window.

So, you require 100 RTTs and 100 RTTs means with 100 millisecond per RTT, it is
approximately 10 second before the connection reaches to a moderate rate or it reaches
toward its maximum capacity. Now, if you think about the web transfer the HTTP
protocol, so none of the HTTP connection takes 10 second to reach at that operating
point. So, by the time, you will reach at the maximum capacity, we will probably close
the TCP connection, and start again a new connection, which will again increase from
one packet per second. Now, to increase this rate, we apply a principle in TCP, which is
called slow start.

459
(Refer Slide Time: 18:08)

So, what is the slow start, so the slow start is something like this that initially you make a
exponential increase of the rate to avoid the slow convergence. Now, this is the irony in
the name that slow start does not mean that your rate is not - your rate is slow, it is just
like that, you are starting from a slower rate rate and making a faster convergence to the
high rate.

So, what we do at slow start, we increase the congestion window by two that means, the
congestion window is doubled up at every RTT. So, rather than have an additive
increase, initially we do a multiplicative increase by doubling up the congestion window
at every round trip time.

460
(Refer Slide Time: 18:47)

So, that is the notion of TCP slow start. That every acknowledgement segment allows
two more segments to be sent. So, for each segment that is acknowledged before the
retransmission timer goes off, the sender adds one segment worth of bytes to the
congestion window.

So, what happens here with this example, so initially your congestion window was 1.
Once you are receiving the acknowledgement, your congestion window becomes two
that means 2 into 1. Once you are receiving the second acknowledgements, your
congestion window becomes 4. Then once you are receiving all these four
acknowledgements, your congestion window becomes 8, so that way at every RTT and
all of this transmission takes around one RTT.

In the 1st RTT, you are acknowledging 1 packet. In the 2nd RTT, you are acknowledging
2 packets. In the 3rd RTT, you are acknowledging 4 packets. In the 4th RTT, your
acknowledgement you are acknowledging 4 packets. And if the pipe is full, then that is
the level at which you are getting converged, so that way in TCP low start at every round
trip time, we double up the congestion window size ok.

461
(Refer Slide Time: 19:58)

Now, if you just make a multiplicative increase of congestion window, then again it
violates the principle of max min fairness that we have seen earlier. So, MIMD
multiplicative increase multiplicative decrease does not lead you to a to a optimal
operating point, where both the capacity and fairness constants are satisfied. So that is
why what we have to do, we have to make a additive increase at some point of time. So,
what we do here? So the slow start it causes the exponential growth, so eventually it will
send too many of packets into the network too quickly.

Now, to keep the slow start under control, the sender keeps a threshold for the
connection, we call this threshold as the slow start threshold or ssthresh. Now, initially
the slow start threshold is set to BDP or some value, which is arbitrarily high, the
maximum that a flow can push to the network. And whenever a packet loss is detected by
a retransmission timeout, the slow start threshold is said to be half of the current
congestion window. So that is the idea.

462
(Refer Slide Time: 21:10)

(Refer Slide Time: 21:18)

So, whenever your, so let me try to explain it with a diagram, so initially these things
happen. So, at this axis, I have the time; and at this axis, I am plotting say the congestion
window. So, you start with one packet, and initially you have a exponential growth. And
say at this point, you get a loss or retransmission timeout, and whenever you are having a
retransmission time out, so you set. So, this was the initial value. So, you set half of that
as the slow start threshold.

463
So, you drop the rate, and now your slow start threshold is here. So, again you start with
one congestion window, so you go exponentially up to the slow start threshold. After you
have reached slow start threshold, you increase through AIMD. So, here your AIMD
starts. Now, again after AIMD at this point, if you have an RTO, then you make half of
that at the updated slow start threshold, drop the rate, again make an exponential increase
up to slow start threshold, and start AIMD after that. So, your slow start is up to the slow
start threshold and after that, you are going with AIMD.

So, after slow start threshold, we move to the additive increase, so in this additive
increase, which we call as the congestion avoidance. So, whenever the slow start
threshold is crossed, TCP switches from slow start to additive increase. So, it is usually
implemented with a partial increase for every segment that is being acknowledged, rather
than an increase of one segment part RTT. So, this one segment part RTT is your slow
start phase.

So, to do that, we make a common approximation is to increase the congestion window


for additive increase based on this formula. So, the congestion window is increased as
the current value of the congestion window plus the maximum segment size into
maximum segment size divided by the congestion window. This gives an approximation
of the additive increase that how much data or how much new byte need to be added to
the congestion window to follow the or to increase the congestion window value based
on additive increase at every round trip time. So, at every round trip time, we
approximate the increase of congestion window based on this formula. So, this formula
is applied at every round trip time to have the congestion window follow additive
increase principle.

464
(Refer Slide Time: 24:16)

So, it looks like this. In additive increase, if you do the packet wise approximation, so in
additive increase, initially they say the congestion window was 1. Once you are getting
an acknowledgement, you make the congestion window to 2. Then you are getting these
two acknowledgement, you are you are making congestion window to 3. Then in the next
RTT, you are getting the acknowledgement for those three packets, so you are making
congestion window to 4. So, this additive increase, we approximate based on the formula
that we have given earlier, so that is the broad idea, so of increasing the congestion
window by using the additive increase principle ok.

(Refer Slide Time: 24:56)

465
So, to trigger a congestion, as we have mentioned that we normally trigger a congestion
with the help of a retransmission time out, that indicates a packet loss, but there is
another way to trigger the congestion. So, in general, TCP follows two different ways to
trigger a congestion; one is the retransmission timeout, and the second one is by using a
duplicate acknowledgement. So, duplicate acknowledgement means, you are
continuously receiving the acknowledgement of the same packet.

Now, why we use basically the duplicate acknowledgement to trigger a congestion


control, because if you use retransmission timeout, you have to wait for that timeout
duration to detect a congestion. Whereas, duplicate acknowledgement gives you a early
notion of congestion, and you can trigger the congestion control behavior much earlier
compared to waiting for a complete timeout period.

Now, interestingly this retransmission timeout RTO is a sure indication of congestion,


but it is time consuming. Whereas, this duplicate acknowledgement, here as we know
that the receiver sends a duplicate acknowledgement, when it receives out of order
segment, which is a loose way of indicating a congestion. So, TCP assumes that if you
are receiving three duplicate acknowledgements, then it implies that the packet has been
lost, and it triggers the congestion control mechanism. Now, this assumption of three
duplicate acknowledgement is something arbitrary, there is as such no logic behind that,
so Jacobson assumed that well, you can take three triple duplicate acknowledgement to
indicate a congestion.

Now, another important or interesting observation from this duplicate acknowledgement


is that (Refer Time: 26:47) because TCP uses cumulative acknowledgement, by looking
into the duplicate acknowledgement, you can identify the lost packet, that which packet
has been lost. So the very next packet in the sequence that have been lost, so that is why,
you are getting this duplicate acknowledgement. So, what may happen, say you have
received 1, 2, 3, then you have lost packet 4, and you are receiving 5, 6, 7. Whenever you
are receiving 5, 6, 7, you will receive an acknowledgement up to 3. So, every time you
will receive a duplicate ACK for ACK 3.

Now, in this case, you can infer that the packet 3 is actually the packet that has been lost.
So, you retransmit the lost packet, and then trigger the congestion control algorithm.

466
(Refer Slide Time: 27:35)

So, this concept is known as fast retransmission, which is incorporated in one variant of
TCP congestion control, which is called a TCP Tohoe. So, in TCP Tohoe, we use three
duplicate acknowledgement as the sign of congestion. So, once you receive three
duplicate acknowledgement, you retransmit the lost packet that is the fast retransmission,
because you can infer the identity of that lost packet, it takes one round trip time. Then
you set the slow start threshold as half of the current congestion window. And set the
congestion window to 1MSS, so that is the idea of TCP Tohoe.

So, initially you have the slow start phase, so you reach the slow start threshold. Once
you are reaching the slow start threshold, you are applying additive increase. At this
point, you have detected a congestion by say packet loss. Whenever you are detecting a
congestion, you drop the packet, again increase and meet the threshold to half of the
current slow start threshold. So, earlier your current congestion window, so your current
congestion window is 40; so you make the threshold as 20, and have slow start up to that
threshold.

467
(Refer Slide Time: 28:51)

Now, in TCP Reno, there is another interesting observation from the implementation of
TCP Reno. So, once you are detecting a congestion through 3 duplicate
acknowledgement, do TCP really need to set congestion window to 1 MSS? Now here,
this duplicate acknowledgement; it means that some segments are still flowing in the
network, it is not like that you are not able to send any packet. So, if you are having a
retransmission timeout. That means, you are not receiving any acknowledgement, but
whenever you are receiving some acknowledgement that means, possibly that packets
say in the earlier example that I was showing, possibly packet 3 has been say packet 4
has been lost, but the receiver is receiving packet 5, 6, and 7.

So, when the receiver is receiving packet 5, 6, and 7, it is sending back a duplicate
acknowledgement, so that means, you have lost possibly lost packet 3, but it is not like
that this the link is entirely getting choked, some packets are still flowing in the network,
so that is why the congestion is not that much severe. So, you do not need to reduce the
congestion window again at 1 MSS, and start the slow start again. So, what we do here,
you immediately transmit the lost segment, that we call as the fast retransmit, and then
transmit additional segment based on the duplicate acknowledgement that has been
received. We call this concept as the fast recovery.

468
(Refer Slide Time: 30:24)

So, what happens in fast recovery, that you set the slow start threshold to one-half of the
current congestion window, retransmit the missing segment that is the first retransmit.
Then you set the slow start threshold to the current, then you set the congestion window
to the current slow start threshold plus 3. Why 3, because you have received three
duplicate acknowledgement that means, the receiver has already received three more
packets. So that means, you can increase the congestion window, and send three more
packets to the network, because that has been received by the receiver, although out of
order.

So, each time you receive another duplicate acknowledgement, you set the congestion
window to congestion window plus 1, you increase the congestion window value. Then,
send a new data segment, if allowed by the current value of the congestion window. So,
that way, whenever you are receiving the duplicate acknowledgements, you are gradually
increasing the congestion window value and sending more packet to the network, so that
we call as the fast recovery. And the fast recovery ensures that, because some packets are
flowing in the network, you do not need to again wait for sending the data at a very low
rate.

So, once you receive a new acknowledgement, so you are receiving a new
acknowledgement, because you have retransmitted the lost segment in fast retransmit, so
that lost segment if it reached at the receiver. So, in that earlier example say 4 has been

469
lost, the receiver has received 5, 6; say 7, 8, 9. And here you have received three
duplicate acknowledgement corresponds to 5, 6, 7. And at that time, the sender has
retransmitted segment 4, and it was receiving this 8 and 9 duplicate acknowledgement
corresponds to that. And with every duplicate acknowledgement, you keep on sending
the further packets.

And whenever the receiver received is missing 4 during that time, the receiver sends
accumulative acknowledgement say ACK 11. And once you are receiving this new
acknowledgement, not a duplicate acknowledgement that means, all the packets that was
there, that have been acknowledged. So, at this stage, you exit from the fast recovery. So,
this causes setting the congestion window to the slow start threshold, as we have done
earlier. And continue with the linear increasing due to the congestion avoidance
algorithm.

(Refer Slide Time: 32:49)

So, this is the idea of fast recovery that has been incorporated in TCP Reno, the next
version of TCP Tohoe. So, in fast recovery what we do, initially you apply slow start, up
to slow start threshold, then you go for additive increase. At this stage, you have detected
a packet loss through triple duplicate acknowledgement. Whenever you are detecting a
packet loss through three duplicate acknowledgement, you reduce the congestion
window value to the updated slow start threshold that is half of the current slow start, and
apply fast recovery at that point. So, after applying fast recovery, whenever you are

470
receiving a new acknowledgement, again you go (Refer Time: 33:30) with the additive
increase.

So, here if you compare with the TCP Reno variant, we are not making the congestion
window. So, TCP Reno, it makes the congestion window again to 1 MSS, and then apply
slow start threshold up to slow start, up to the slow start threshold, and then applies the
additive increase. So, here we are applying additive increase much faster, that will help
you to reach to the operating point that much faster compared to TCP Reno due to the
implication of this fast recovery algorithm and avoiding the slow start phase, again
whenever you are detecting a congestion through the triple duplicate acknowledgement.

But, if you are detecting a congestion by a retransmission timeout, then you always set
the congestion window to one 1 MSS, and start with the slow start threshold, because a
start with the slow start phase, because a retransmission timeout will give you an
indication that a severe congestion has been happened. And whenever there is a severe
congestion in the network, it is always better to start with a very low rate that means,
setting the congestion window value to 1 MSS, so that is the broad difference.

So, if you are detecting the congestion by a retransmission timeout, you set the
congestion window value to 1 MSS. Apply the slow start, whenever you will reach the
current slow start value, which is the half of the congestion window that was detected
during the congestion detection, and then apply additive increase. And if you are
detecting a congestion through triple duplicate acknowledgement, you do not need to
again perform the slow start phase, because some packet are still flowing in the network,
you directly apply fast recovery, and then move with the additive increase. So, this is the
variant of the TCP Reno.

After that, many other variants of TCP came into existence like TCP new Reno, then
TCP selective acknowledgement or SACK, so originally there are normal TCP protocol,
it uses the principle of go back N flow control principles or go back N ARQ principle.
Whereas, the TCP SACK the selective acknowledgement variant of TCP, it works with
the principle of this selective repeat ARQ, where explicitly we send the SACK packet to
indicate that which packet has been lost. And the sender retransmit that packets without
sending the whole packet of the current window.

471
So, there are lots of such variants of TCP. And after that, many of the variants also came
into practice. So, I am not going to the details of all those variants. If you are interested,
you can go with that. The basic notion of TCP congestion control is this three phases, the
slow start followed by the congestion avoidance, then the fast recovery, and the fast
retransmit. And after that, people have incorporated few other optimizations. So, if you
are interested, you can look into the RFCs to (Refer Time: 36:26) know them in better.

So, this gives us an broad overview of the congestion control algorithms, which are there
in TCP. And we have given you a fairly detailed description of the transport layer
protocol along with a focus on this TCP. So, as I have mentioned that a huge amount or
even more than 90 percent of the internet traffic, it actually use a TCP protocol. And TCP
is possibly the most widely deployed protocol in internet the transport layer protocol in
internet, but well there are certain applications in the internet that use UDP, which does
not support reliability, flow control, congestion control, as like TCP.

So, in the next class, we will look into the details of the UDP protocol.

So, thank you all for attending this class. See you again.

472
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 23
User Datagram Protocol

Welcome back to the course on Computer Network and Internet Protocols. So, in the last
class, we have discussed about the transmission control protocol at a TCP and the several
features which are there in TCP.

(Refer Slide Time: 00:29)

So, in this class we will discuss about another transport layer protocol which is not that
much widely used as TCP, but still many of the applications use a start we call it as user
datagram protocol or UDP. Apart from UDP we will discuss another protocol which is
recently developed by Google and gradually getting popularity over the internet which
we call as the QUIC and that QUIC it uses this UDP as the underlying transport layer
protocol.

So, the basic difference between the TCP and UDP is that: UDP actually is a very simple
protocol and it does not support the functionalities which are provided by TCP. So, as we
have seen that the TCP protocol it supports the connection establishment, reliable data
delivery, flow control congestion control or the packet delivery all these different
features, but to implement this kind of features in TCP certainly the protocol has a

473
significant amount of overhead or the signaling overhead what we call it in the
networking term.

So, this signaling over head is something like this to make the protocol correct or to
make the operation of the protocol correct. You are sending some additional data to the
internet. So, for example, for the connection establishment and the connection release,
you need to send or you need to have this three way handshaking mechanism which is
time consuming.

So, for every individual data packet if you think about multiple sort flows which are
flowing in the network just like whenever you are doing web browsing during that time
if you are sending such multiple short flows that means, HTTP request response
messages. And if every request response message is embedded in a TCP connection then
that is a problematic. Because for this request response message, you require three
messages for connection establishment and three messages for connection closure, so
that is one of the over head.

The second over head which comes from the flow control and the congestion control
algorithm. So, if the protocol detects that there is a packet loss you need to retransmit it.
And retransmit always block the flow of the existing data packet or the new data packets.
On the other hand, if you look into the congestion control algorithm, the congestion
control algorithm to make the congestion control algorithm distributed and to support
max min fairness. We make the protocol in such a way that you have to start from the
slow start phase. That means, you need to start from a very low value of the congestion
window and gradually increase that value to reach the capacity because you do not know
that capacity.

Now, if you think about a high speed link in that high speed link itself you are starting
from a very low value of the congestion window and then applying the slow start to
reach at the operating point. But with this, if you just think about your flows are very
short like just like a HTTP request response message, by the time the TCP flow will
reach to the operating point the connection will get closed because you have transferred
your request and response message for HTTP. And you will again start a new TCP with
this new set of congestion control algorithm or the new set of slow start mechanism.

474
So, because of this protocol the TCP, it has this significant amount of overhead which
makes the protocol very slow for practical deployment although it supports a good
amount of reliability and works perfectly or works correctly over a real network. But for
many of the application, we do not tolerate or we are not able to tolerate or some time we
do not require this kind of additional services. What is more required is to send a data
somehow at the other end, and then just parse the data.

So, one application is just like your DNS protocol or the domain name system protocol.
So the DNS protocol for sending a DNS request and the DNS response, you do not
require a TCP connection establishment, because that is going to be a significant over
head rather you just send a DNS simply the DNS message. And if the DNS message is
not responds, you will certainly have a timeout at the sender side you can again request
for the domain name with the next message.

So, for that we support this user datagram protocol or UDP protocol in the internet. So,
this UDP just provide you the end-to-end packet delivery or in UDP we term it as the
datagram; so end-to-end in datagram delivery. So, it doesn’t provide any of the services
like this connection establishment, reliable data delivery, flow control and congestion
control, ordered packet delivery all these things in the network.

(Refer Slide Time: 05:26)

So, these are the broad features and the uses of TCP. So, the feature is that first of all it is
a very simple protocol. It is or sometime we say that it is not at all a transport layer

475
protocol. It is just like a wrapper on top of the IP layer. So, whatever services is being
provided by the IP layer, the same set of service is just forwarded to the application by
bypassing the basic transport layer functionality. So, UDP works like a wrapper on top of
the IP layer, the protocol is very fast, because you do not need to wait for the slow start
phase. You do not need to wait for the connection establishment and the connection
closure, and you do not have any flow control and the congestion control algorithm. The
protocol itself is very fast and it worked nicely when the network has a low loss
probability.

So, the use cases of UDP is to provide performance, you do not have any buffer like TCP.
So, you can give or support a protocol with faster delivery whenever your link is good,
or you do not bother about the packet loss. And it is the kind of short and sweet protocol.
So, it does not have any overhead. And it is suitable for short message transfer just like
the domain name system.

(Refer Slide Time: 06:49)

So, as I have mentioned that UDP is connectionless and unreliable. So, you just send data
packets or datagrams one after another. If a datagram is being lost the server does not
take care of that or the packet get lost. So, you do not care about that. So, if the
application cares about packet loss, the application will apply its own acknowledgement
mechanism or its own procedure for handling or recovering from the loss. So, you just
create a datagram and send it one after another. So, you do not have any connection

476
establishment. You do not bother about whether the server is running or not. You simply
send a packet you do not have any reliability and no acknowledgement mechanism.

(Refer Slide Time: 07:33)

So, this is the structure of the UDP header. So, earlier we have looked into the structure
of the TCP header. So, compared to the TCP header this UDP header is fairly simple you
only have four different fields the source port, the destination port, the length and the
checksum that is all and then you have that data. So, the source port and the destination
port at the server port, and the client port, the length of the packet which is required to
find out that how much data is there in your UDP datagram and a checksum field to
check the correctness of the packet.

So, although reliability is not implemented, but at the server side or the destination side,
you want to find out whether the packet or the datagram that you have received whether
that is a correct datagram or something got some some happened or something got
flipped. So, you want to find out that, so that is when we put the checksum field.

Now, checksum calculation in TCP and UDP, so I have not mentioned that during the
discussion of TCP just kept it for the discussion here. So, this checksum calculation in
TCP and UDP is a nice feature. So, how checksum is calculated or what is checksum, the
details of checksum. We will discuss later on while we will look into various error
correction codes in the context of data link layer, but just to give you a brief idea that

477
checksum is nothing but a function. So, you can think of checksum as a function if. So,
inside that function you are providing the message and then you are getting certain value.

So, whatever value you are getting, so this C this is the checksum that C you are putting
here. Now, because the checksum is of fixed length, you can think of this function as a
hash function. So, any hash function can be used as a checksum, but ideally these IP
checksum or internet checksum which we apply for network data transfer. It is not a
complicated hash function like our traditional cryptographic hash function, because we
do not require that one way property that much rather we are just concerned about to get
a fixed size message digest out of the message. So that is why this internet checksum
computation is fairly simple.

And if you are again apply a cryptographic hash or a complicated hash function here, it
will take a significant amount of time to compute that corresponding checksum, so that
we do not what. So, we simply use a simple method for doing the checksum. So, a
simple method as the name suggests in internet the checksum is just like you divide the
entire message into fixed size block, and then make ones complement addition to
compute the checksum, so that is the basic idea of internet checksum that we apply here.

Now, in internet checksum, so the detailed procedure of internet checksum and example
we’ll discuss later while we discuss about the error correcting code as I mentioned just
before. But ultimately this checksum is giving you a fixed size code that is the C. Now,
whenever you are receiving this message at the receiver end what you do whatever you
are receiving with this received data, again you apply the same function to compute the
checksum. And find out that what is the checksum that has been transferred with the
message and the checksum that has been computed at the receiver side whether they are
getting matched or not. If they are getting matched, that means, whatever value has been
transferred from the sender side, you have received that for a particular value.

Now, again remember that checksum is not to ensure packet integrity from the security
attacks or the external attacks. It is just to ensure packet integrity from the network fault
or the system faults. So, whenever you are transferring the data because many of the time
you are doing a digital to analog conversion or analog to digital conversion, then
encoding decoding a packet, you are applying the modulation technique at the physical
layer. So, it may happen because of the sampling error or the quantization error some bit

478
ideally or it was one but that got flipped to 0 during this analog digital conversion or the
modulation and coding states or some zero bits got flipped to 1.

So, just to detect those kinds of things we apply the checksum. It is not to not to ensure
that the packet is free or the packet has saved from some security attack based on the
cryptography or network security point of view. So, because of that so whatever
checksum you are getting at the receiver side you compute the checksum value that has
been transferred with the packet if they matches, that means, the packet integrity got fizz
up, there was no such error that has been introduced during signal processing. And you
have received the correct datagram that was sent by the sender. Now, while compute the
checksum in TCP and UDP; TCP and UDP takes certain things into consideration during
checksum computation.

(Refer Slide Time: 13:02)

So, as we have said that checksum is nothing but a function in where you are taking a
message in as input and you are computing the checksum value. Now, in this message, so
TCP or UDP, they put TCP or UDP header plus the data that you are sending plus a
pseudo header. So, this pseudo header is actually not transmitted with the packet, it is
just used for the computation of checksum. And once the checksum is computed that
pseudo header is getting dropped or that is that gets dropped.

So, what is the content of the pseudo header, the content of the pseudo header is the
source IP, the destination IP, then the protocol field from the IP header. So, it actually

479
takes certain fields from the IP header. So, all these frame fields are coming from the IP
header. And the fourth is the reserved bits. So, there are 8 reserved bits in IP. So, those
reserved bits from the IP header. So, all these fields comes from the IP header so that
way we consider the pseudo header in the computation of checksum. But remember that
this pseudo header is not transmitted with the packet rather once you have computed the
checksum; then do just put the checksum and discard the pseudo header. At the receiver
end, receiver will again construct the pseudo header and compute the checksum make a
match with the received checksum and drop that pseudo header.

Now, the thing is that; what is the purpose of including the pseudo header in the
checksum computation; so this pseudo header is included in the checksum computation
just to do a double validation of the source IP, destination IP and a protocol field, and a
reserved value field. So, these fields are very important from the perspective of
transmission of a packet because these fields actually help you to identify the correct
source at the correct destination. So, although IP header includes its own checksum field,
but this IP header changes the checksum at every individual layer, because if you look
into the network diagram you have this source followed by multiple hops routers and
then finally, is your destination.

Now, every router they apply the routing mechanism, they look into the IP header, they
may make they may change the IP header and then they again compute the checksum,
the IP header checksum and put it at the part of the IP header. So that is why the
checksum which is there in the IP header they may get changed whenever you are going
from one layer three hop to another layer three hop. So, all these are the layer three
devices. So, whenever you are going from one layer three hop to another layer three hop
then the things may get changed. But at the same time we do a end-to-end validation
with this end-to-end protocols.

So, this transport layer protocols are basically the end-to-end protocols. So, the UDP
header or the TCP header never gets changed at the lower layer of the protocol stack at
the internet layer of the protocol stack so that UDP header or the TCP header will never
get changed at the individual routers. So that is why we make a double check in the TCP
header or the UDP header by putting this pseudo header at the source IP, destination IP.
All these fields that this intermediate router somehow there this fields has not got
changed.

480
Because, in the router if you later on will discuss the entire processing of the routers you
will see that whenever it receives an IP packet, it takes the IP header out, applies the
routing mechanism then again adopt the IP header and send it to the outgoing link,
because that IP layer processing is done at the router level. So, if there is certain
inconsistency or certain faults inside the router that may introduce an error to the source
IP or the destination IP field. So, we want to make sure through this integrity change at
the UDP header that no such error has been occurred during the transmission of the
transport layer segment or in TCP or the transport layer datagram at UDP. So, that is why
you put the pseudo header as a part of the checksum computation.

But as I have mentioned earlier again repeatedly I am mentioning that this pseudo header
is just used only for the computation of the checksum. And this pseudo header is not
transmitted during the transfer of the data, and that is just to check this end-to-end
integrity of the data transmission ok.

(Refer Slide Time: 18:39)

Now, there are multiple application that uses UDP as you have looked earlier, the DNS
protocol the domain name system protocol. It is simple request response message. So, we
require it faster than TCP. So, we apply UDP there. Then this BOOTP or DHCP, they are
the network configuration protocol. Again they are short messaging protocol which helps
faster configuration of the device devices. TFTP, TBL, file transfer protocol it is a simple
lightweight file transfer protocol to transfer small files. SNMP, the network management

481
protocol or the simple network management protocol it is again a simple UDP protocol
which is easily cut through congestion than TCP.

So, in TCP, if there is a congestion, then TCP reduce the rate, but in case of UDP as it
does not take care of the congestion, if the packet comes to the buffer. And if it is not
dropped from that intermediate buffer, eventually it will get transmitted so that is why we
use this UDP in case of SNMP.

Then the interesting protocol comes which is QUIC, QUIC, UDP internet connection that
was developed by Google a couple of years back which is a advance of the transport
protocol. So, idea behind QUIC is to overcome many of the shortcomings which were
there in TCP, because of the slow start phase, the connection establishment for every
individual flow. And in QUIC UDP provide a direct access to IP.

So, with the help of UDP, what QUIC does, that it directly send a packet via IP, but
whatever additional facilities like flow control, congestion control, reliability, all these
things are there, they are implemented as a part of application with a secure binding.

(Refer Slide Time: 20:31)

So, let us look briefly about how QUIC works. So, the full form of QUIC is QUICK
UDP Internet Connection. So, the first paper of QUIC or the detailed paper of research
paper of QUIC that came from Google in 2017 SIGCOMM. So, I suggest all of you to go

482
through that paper to know more details about QUIC, also you can see the internet draft
of QUIC to look into the specific protocol.

So, if you look into the difference between the application over TCP and application over
QUIC, so in bottom we have the IP layer whenever you are applying HTTP or say
HTTPS, the secure version of the HTTP. So, under HTTP you apply a encryption layer
through transport layer security or secure or secure socket layer and then you use TCP to
transfer the data at IP.

Now, what QUIC does, it makes a direct interaction with HTTP. So, HTTP runs on top of
this QUIC; and QUIC runs on top of the UDP, and it then access IP. Now, this security
feature, the encryption part it is embedded inside that QUIC protocol. So, you do not
require any other secure layer. So, every QUIC packet is end-to-end encrypted and it
provides end-to-end security. So, you do not require another security layer that we
require in case of TCP with the help of SSL or secure socket layer or transport layer
security protocols.

So, this SSL and TLS; this kind of encryption protocols are not required in case of QUIC
because QUIC inherently applies the security features ok.

(Refer Slide Time: 22:11)

So, one of the important aspect of QUIC is to combine multiple short flows together. So,
if you remember the problem which is there in TCP the problem that I was explaining

483
earlier that if you want to transfer 1 HTTP packet in HTTP 1.1, you had one TCP
connection for every request response message. And even with HTTP 2 HTTP 1.1 what
you had that you can combine multiple request response together, but based on the web
browsing nature normally we browse a web then we wait for certain time, and then we
move to another page. And during that time although it it is combining multiple such
requests response together, but that mostly will mostly related or mostly limited to a
single session. Whenever you are moving to a different page, you need to create a
different TCP connection.

Now, for every TCP connection you require three way handshaking. So, just to send a
few HTTP request response message, you require three connection at three way
handshaking at the sender side and a three way handshaking during the connection
termination as well. Now, QUIC actually solves this problem in this way. So, in case of
QUIC, during the initial handshaking, whenever you are connecting to the server for the
first time during that time you have to do a detailed handshaking. But after that, you do
not need to do that detailed handshaking rather you can directly use the previous
handshaking part the connection that has already been established to send further data.

So, this works in this way. So, as I have mentioned that QUIC is an end-to-end
encryption protocol because of that you require certain credential from the server. Now,
initially that client does not have those kinds of credentials. So, the client sets a sends a
inchoate CHLO, client CHLO. When the client says this inchoate client CHLO which is
received by the server, and the server finds it out that the client CHLO does not has the
required security certificate, it sends a reject message. And with this reject message the
server sends the security credential to the client.

Now, the client has the security credential. With this security credential, it sends a
complete client CHLO. Now, here the interesting thing is that because the client has
already received this reject message from the server, the client actually knows that the
server is running, and the server is ready to accept packet. So, the client can start sending
encrypted request. Now, if the server wants to send the message from the server side to
the client side, that means the responses, the server sends a server CHLO initially. After
the server CHLO is sent, because the server has already received the client credential
from this client CHLO, it starts sending the encrypted responses from the server side. So,
you actually require 1-RTT here.

484
Now, once this connection has been established, then for the next ongoing connections
between the same set of client server, you do not require this 1-RTT handshake rather
you require a 0-RTT handshake. That means, you already have received the server
credentials, because you already have received the server credentials. You can start with
this complete client CHLO. And you know that the server is running because it has
already received certain packets. So, you can start sending the encrypted request. And if
the server wants to send data to the client, server start with a server CHLO and then the
encrypted responses. This is not only one encrypted response, it can send multiple
responses or (Refer Time: 26:06) multiple requests simultaneously.

Now, sometime it may happen that well during this time, it may happen that the server
credential has been changed.

(Refer Slide Time: 26:15)

If the server credential has been changed, when the server received this complete client
CHLO, the server sends reject message with the updated server credential. Now, with
this updated server credential, the client can reinitiate the connection and start sending
the request. So, whenever the server credential gets changed, you require a 1-RTT
handshake. And at the initial time you require a 1-RTT handshake; after in between you
can always use the 0-RTT handshake to transfer the packets ok.

485
(Refer Slide Time: 26:49)

Another interesting feature of QUIC is to support multi streaming. And it supports


something called head of line blocking free protocol. I will come to that point of what is
mean by head of line blocking in a couple of minutes. So, what happens in HTTP 1.1 that
you can have multiple TCP streams one after another and to with this multiple TCP
streams you can send multiple with every TCP stream you can send multiple request
response messages in between the client and the server.

But, because you are having these multiple TCP streams in parallel for every individual
stream, you should have this connection establishment and every TCP stream will go
through the slow start phase. So that is the overhead for HTTP 1.1, so that is why in
HTTP 2 or sometime that was a earlier proposal from Google, they call that particular
protocol as SPDY. So, in that particular protocol, you can multiplex multiple streams
together.

So, here you are combining all these streams together and have a single TCP connection
between the server and a client. So, here all these streams are getting multiplexed to a
single stream. And this multiple stream is sent to the client. So, in this case you have a
problem called head of line blocking. What is that? Say the nature of the TCP is that if it
receives a single out of order packet, then it put that out of order packet in the buffer and
start sending duplicate acknowledgements. But if it does not receives in order packet,
then it will not send the packet to the application.

486
Now, here whenever you are combining multiple streams together what happens, even if
a single packet get lost, because of that single packet lost this entire TCP connection will
get blocked and which will in turn block all the streams even if certain packets from
certain streams are receiving at the buffer.

(Refer Slide Time: 29:01)

So, because you have a single connection, say assume red packet got lost. And this is the
stream corresponds to the red packet. These are the streams corresponds to the blue
packets and the black packets. Even if you are receiving blue packets and the black
packets, because you have a single TCP connection, the TCP connection will not send
those packets to the corresponding stream.

So, those streams will also get blocked. So, this is called the head of line blocking. Now,
QUIC solves this head of line blocking problem by using UDP connection. So, UDP
connection does not have this problem of blocking due to reordering. So, UDP simply
passes the packet to the streams. And then the streams take cares of the QUIC protocol
itself takes care of sending the packet to the individual streams. And it maintains the
stream wise flow control and a congestion control algorithm.

So, I am not going to the flow control and the congestion control algorithm of QUIC in
detail. If you are interested you can look into the specific draft or the SIGCOMM (Refer
Time: 29:53) 2017 paper. Another interesting feature in QUIC is that TCP uses this
duplicate acknowledgment, but QUIC does not use the duplicate acknowledgement.

487
Even for a retransmission, it assigns a new sequence number to the packet. So, because
the packets are basically transmitted over UDP, QUIC is not a stream oriented protocol;
it does not use the byte sequence number rather it uses the packet sequence number for
simplicity. And for every packet, that means the original packet as well as the
retransmitted packet, it puts a new sequence number, so that is why you do not have this
problem of duplicate sequence number and blocking due to this duplicate
acknowledgements.

So, these are few of the features of QUIC and this protocol QUIC is gradually getting
popularity in the internet, many of the services like YouTube or Google Drive which is
coming from Google. Google has already started a deployment of QUIC, and the current
version of chromium based browsers, they have the implementation of QUIC. So, many
of the recent protocols have started using QUIC, recent applications are mostly all the
applications from Google they have started using QUIC. So, possibly QUIC is the future
protocol which is going to replace the standard TCP based data delivery. And during that
time UDP is actually going to be more important compared to TCP. So that is possibly
the future of internet, so that is all about the transport layer protocol a different kind of
transport layer protocol.

In the next couple of classes, we will do a practical thing. We look into this concept of
socket programming and network programming. We will see that with the help of the
socket programming, how you can access a specific transport layer protocol and you can
start transmission of data. And you can write your own application by utilizing this
different type of transport layer protocol. We will see certain demo of that. And then we
will move to the next layer of the protocol stack that is the internet layer or the network
layer of the protocol stack.

Thank you all for attending this class. See you again.

488
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 24
SOCKET PROGRAMMING – I

Welcome back to the course on computer network and internet protocol. So, today we
will see some demo of network programming. So, we will look into the socket
programming in details. And see that with the help of socket programming, how you can
access the transport layer of the protocol stack, and you can run your own application on
top of the network protocol stack to transfer some data to or from a computer.

(Refer Slide Time: 00:47)

So, let us start our journey in the socket programming. So, to start with as we have seen
earlier or we have also discussed earlier that this entire network protocol stack is
implemented inside the kernel of the operating system. So, in general we have five layers
in the TCP/IP protocol stack that we have talked about. And in that five layers of the
TCP/IP protocol stack this physical layer, and the part of the data link layer are stored
inside the hardware.

Whereas the upper part of the data link layer mainly a part of the MAC and the logical
link control, the network layer and the transport layer they are implemented inside the
kernel space of operating system. And then from the user space you can write multiple

489
application to access this protocol stack. So, the application have to interact with the
transport layer to send or receive data. And as we have learned already that in the
transport layer, we have two different protocols, the transmission control protocol or the
TCP and the user datagram protocol or UDP.

So, today we will look into that this entire kernel space which is there inside that we
have this different layers of the protocol stack, the transport layer, network layer and the
part of the data link layer which is already implemented inside the operating system
kernel. And we will see that how you can make a interaction between this user space and
the protocol stack which is implemented inside the kernel space with the help of the
socket programming. Now, interestingly what we will see that whenever you will write a
application, network application at the user space, you have to transfer or you have to use
certain kind of functionalities which are available at the kernel.

So, you require a interfacing between the user space and the kernel space. And remember
that here we are talking about a UNIX based operating system. And, in a UNIX based
operating system from the user space to kernel space that interaction will be done with
the set of APIs which we call as the system call. So, the system call transfers some user
requirement to the kernel corresponding kernel operations and performed operations at
the Linux or UNIX kernel. So, this entire protocol stack that is implemented inside the
kernel we will make an interaction with that network protocol stack with the help of the
operating system system calls.

So, interestingly just a pointer for you to explore further that you can look into this entire
protocol stack implementation inside a UNIX kernel. If you download the UNIX kernel
source inside the UNIX kernel source, you can check the net module under user source
Linux net. And you can see this entire implementation of the kernel protocol stack there.

490
(Refer Slide Time: 03:51)

So, these things you have already learnt about that this TCP/IP protocol stack at the
transport layer it does application layer multiplexing. You can run multiple application in
different devices. Now, different application can run different type of protocols. So, if
you are having a browsing or HTTP application that will run TCP. If you have a file
transfer or FTP kind of application that may again run TCP. If you have some application
like VoIP, that may use UDP.

Now, all these different transport layer instances of the protocol stack that interact with
the IP layer. Now, whenever you are talking among two devices the IP layer gets changed
and whenever you are having multiple applications which are running on top of your IP
layer or the network layer of the protocol stack, they are multiplexed with the help of
different type of protocol. So, to differentiate between two devices at the IP layer, we use
this IP address. In the subsequent lecture, whenever we discuss about IP layer, we will
discuss about how you can configure these IP addresses. So, for the time being just
understand that different devices, they are separated by the IP addresses. And then at the
application side, we have these port numbers that actually help you to do the application
layer multiplexing.

So that means, whenever we talk about that device A is communicating with device B
during that time, it is actually if you are doing some kind of browsing application which
is using HTTP protocol during that time the device A, the application which is using the

491
TCP protocol at a port 8081 on the machine with IP address 202.141.81.2, it is
interacting with the device B at IP address 203.12.23.43 over a port 8080, where your
HTTP server is running.

Similarly, for the other application that way this application running at device A and
application running a device B they can be segregated with the help of that port number.
And remember that whenever we talk about this kind of application in a UNIX based
system, we basically represent it in the form of a process. So, there are multiple
processes which are running in different machines. And those processes want to
communicate with each other and during that time we make or we ensure this process to
process communication with the help of that transport layer of the protocol stack.

So, this process to process communication is achieved with the help of this IP address,
which is there at the IP layer to uniquely identify a machine in the network. And then in a
machine there are multiple processes running, they can use different protocols. Some of
the processes may use the TCP protocol, some of the process may use UDP protocol, so
that are segregated with the help of the port numbers.

Now, let us see what is a socket. So, socket is basically a logical connection from one
process to another process. So, here you can see that these two browsing applications at
the two devices they are communicating with each other. So, we have the socket one
socket - this red socket which is making a logical pipe between the application which is
running at port 8081 on the machine 202.141.81.2 to a machine where the corresponding
end of that pipe is running at a port 8080 at a machine with IP address 203.12.23.43. So
that way, we can have multiple such logical pipes at the transport layer which we call as
the socket.

Now, sending the data over the internet means sending the data over these logical pipes.
So, these logical pipes which we call as the socket they basically creates this end to end
connection in case of TCP or end to end data transmission semantics in case of UDP to
transfer the data from one machine or better to say one process running at one machine
to another process running at another machine.

492
(Refer Slide Time: 08:29)

So, here let us see that how we can implement such a socket in a UNIX based system.
So, for that we use this concept of socket programming. So, in a socket programming
framework, we have a set of system calls that we can execute from the C program. And
this system calls will help us to get the service from the TCP/IP protocol stack which is
implemented inside the net module of the OS kernel.

So, let us see that how this entire thing works. So, at the transport layer, we are talking
about a client server this programming. So, we have a server where the idea is that the
server has opened a port, announced the port that this particular port I am listening and
the client need to make a connection to that particular port.

Now, in that case how the server actually works. So, in the server side, you have to first
make a socket system call. So, the socket system call, it will create the server side
opening of the logical pipe and it will bind the socket with your TCP/IP protocol stack.
So, to bind the socket with the TCP/IP protocol stack, you have to call this bind function.
So, this bind function, what it will do that with the port number that you are specifying it
will bind that port number with the socket, so that way it will create a logical end of the
connection at the server side.

So, just think of the server in this way that the server is always running, and the server
actually need to announce that hey, I am actually listening in this particular port, say port
8080. So, if anyone wants to talk to me, you can send data at the port 8080. So, this

493
announcement you have to done through this bind and a listen system call that we have
here. So, the bind system call actually bind the port with the corresponding socket end,
and the listen system call will help you just to make the server to go in the listening state.
So, the server is now say bind that port 8080, and it is listening for the incoming
connection.

Now, let us move at the client side. At the client side you have the socket system call. So,
this socket system call again create a client side end of the logical pipe. And after that at
a client site you do not require this bind and listen, because just understand the nature of
the communication between the server and the client. So, the server is actually
announcing or making an announcement that hey, I am listening at this port 8080. So,
anyone wants to connect to me, you can directly connect to me at port 8080 that the
client do not need to know because the client is actually initiating the connection to the
server.

Because the client is initiating the connection to the server, the client do not need to
make such kind of announcement. So, the client can just initiate the connection to the
port which is being announced by the server and that is why you do not require the bind
and the listen call at the client side. So, at the server side, you require the bind and the
listen call so that the server can bind itself to a port to a fixed port and it can announce
that fixed port to the outside that anyone can connect to that particular port by creating a
socket.

Now, after these things are done, after you have created the end of the socket at the client
side, from the client side you make this connect call to initiate a connection to the port
number which is announced by the server. Now, that is actually a kind of well known
things, like say you know that if you are running a HTTP server, then you are either
running at port 80 or you are running at port 8080 or some other ports which is being
announced by the server. So, the client already knows that what is the IP address where
the server is running, and what is the port number where the server is running. So, the
client initiate a connect call there and this connect makes a connection towards the
server. So, once the server gets this connection, it makes a accept call.

Now, in case of a TCP kind of protocol within that connect and accept, you have the TCP
three way handshaking procedure that we have discussed. So, the client initiates the

494
connection by sending a SYN packet, the server accept the connection by returning back
an ACK; and also initiating the connection to the client side by sending another SYN. So,
we are having a SYN plus ACK from the server to the client, and then finally, the client
sends an acknowledgement, so that way through this three way handshaking of TCP
which happens whenever you are making this connect system call at the client side and
accept call at the server side to make the connection in case of a TCP.

Now, once this connection is established, then you can make this send and receive call to
send the data and receive the data. So, whenever you are making a send call, it is sending
the data; at the other end you can receive that data by making a receive system call or
you can make a send to the from the server side to send some data from the server to the
client. And the client accept that data from this receive system call. So, once this data
communication is done, then you make this close call, finally the close call to close the
corresponding connection, so that way this entire flow of socket programming works.
Now, let us look into that how you will actually write this system call in the format of a
C syntax.

(Refer Slide Time: 14:07)

So, we will start with different type of sockets as we have discussed long back that the
internet is a tradeoff between performance and reliability and that is why we have two
different protocols at the transport layer, the transmission control protocol or TCP or the
user datagram protocol and the UDP. Now, some application they require fine grained

495
performance like the multimedia applications and some others requires reliability like a
file transfer. And accordingly we have two services like a reliable transmission protocol
or TCP kind of protocol and the unreliable transmission protocol like a which is UDP
protocol.

Now, accordingly we have these two different types of sockets; one socket we call as the
stream socket which is initiated by sock stream. So, this sock stream is, create a socket
which is reliable and connection oriented. So, it is necessarily a TCP kind of socket. On
the other hand, we have this UDP based socket which is unreliable and connectionless
that we call as a datagram socket, which is termed as SOCK_DGRAM, so that way we
have two broad kind of socket, stream socket and the datagram socket.

Apart from that we have a third kind of socket that is called raw socket. Using the raw
socket, you can actually bypass the transport layer and you can directly in turn interact
with the IP layer. So, we will not going to discuss this raw socket here in details. We are
going to give you an overview about this stream socket and the datagram socket.

(Refer Slide Time: 15:35)

Now, whenever you are declaring a socket, so what you can do you can declare a very
two variable called integer s integer type of variable which hold the socket id that you
are going to define. So, this socket system call it takes these parameters, three parameters
- the domain, type and the protocol. Now, it creates a socket with this socket system call.
Now, this domain parameter it is the communication domain. Normally, we use IPv4

496
protocol or IPv4 address. So, we set this domain value as AF_INET which is a standard
for the time being most of the time you will use AF_INET. You can always explore what
are the other possibilities in this domain field.

Then the type of the field it is type of the socket either SOCK stream or SOCK datagram
based on whether you are going to create a TCP socket or a UDP socket. And finally, the
protocol specifies the protocol family that we are going to use. Usually it is set to 0. So, I
will suggest you to explore this that why we set the protocol field at 0 in most of the
cases.

Now, once the socket system call is done, you have created the socket. At the server site
you have to create the next calls to bind, to bind the port to the particular socket. So, this
bind system call works in this way it returns the status whether the bind is successful or
not. So, you can have the status as integer variable. And the bind takes three parameters
the socket id. The socket id that is returned by this socket system call and yeah the socket
id that is returned by this socket system call, so this s value is the socket id which has
been returned that you can put here.

Now, that particular socket is bind to a address port kind of variable which is a structure.
So, this structure contains struct sockaddr in. So, this structure contains the IP address
and the port of the machine. So, usually set to inaddr any to choose a local address. So, if
you are run it as inaddr any, it will choose the IP address which is used by your machine
and then the size. So, the size is the address size of thus this sockaddr structure.

497
(Refer Slide Time: 18:03)

So, the sockaddr structure looks something like this, which actually stores the IP address
and the corresponding port number. It has these three fields, one is the sin family. So, this
is the address family. So, the address family we keep it as AF INET for IPv4 protocol
which we are going to use. So, this concept of IPv4 we are going to discuss in the
subsequent lecture. So, when we talk about the IP addressing scheme, so normally in
general in today’s network we mostly used IPv4 address. So, the address families
normally set to AF INET. .

Then we have this socket in address dot s addr it is the source address. So, the source
address we keep it as inaddr any as I have mentioned to choose the local address of the
machine where I am running the code. And then I have the port number in the variables
sin port the port number. So, now one interesting fact is here that we need to use this
function called h to ns to convert the port number from host byte order to network byte
order. Now, let us look at quickly that what is the source byte order and the network byte
order.

498
(Refer Slide Time: 19:25)

So, in a computer system, the computer can be of two type either it can be a little endian
system or it can be a big endian system. Now, the difference between a little endian
system or a big endian system is something like this. Yeah, it is like how you are storing
the data in the memory. Now, in case of a little endian system, you will store the data
from left to right sorry from right to left. So, this 0D will be stored fast then it will store
0C, then it will store 0B, and finally, it will store 0A.

Whereas, in a big endian system, it is just opposite. So, it is left to right associativity kind
of things. So, in a register if your data is something like this, in the memory it will first
store 0A, then it will store 0B, then it will store 0C and finally, it will store 0D. So, that
way depending on whether your machine is following a little endian platform or a big
endian platform, the representation of the data inside memory may get changed.

So, assume a communication from a little endian to a big endian system. Now, if you are
transferring data from a little endian system, you will transfer the data in the form of a
byte stream in the sequence of bytes. So, you will first say and possibly 0D, then 0C,
then 0B, then 0A. And whenever it big endian system will get 0D, it will put the 0D first,
then the 0C second and that way whenever it will interpret it will interpret the number
just in the opposite direction. So, that way there may be a kind of inconsistency
whenever you are transferring the system, so that is why we use this concept of post byte
order to the network byte order, the idea is that the host can be little endian or big endian.

499
(Refer Slide Time: 20:57)

They have a kind of byte order. Now, network is a has a fixed byte order. So, whenever
you are transferring the data over the network, you convert it from the host byte order to
the network byte order, transfer it over the network. At the other end, you fetch the data
convert it again to the host byte order based on whether the your system is little endian or
big endian and store it there. So that way this kind of inconsistency which may come due
to the representation difference of two machines that can be solved. So that is the idea of
converting the port number from the host byte order to the network byte order.

So, here is an example how you can initiate the address variable. So, you setup the port
at 3028 which is you are taking it as an integer variable then you have this sin family AF
INET that I have discussed, sin address dot addresses inaddr any to take the local
address. If you want you can also put some IP address there but that IP address need to
be matched with the IP address used by your network interface. And then in the sin port
you make this call to h to ns over the port number to convert it to the network byte order.

500
(Refer Slide Time: 22:15)

Well, now to accept a socket connection, so you in the client side you create a client
address. Now, the server it is listening on this particular socket. So, this listen function
has a parameter called 5 here. So, this particular parameter indicates that how many
maximum connection can be backlogged when multiple clients are trying to connect to
the server. And then you take this size of this address variable that you have declared and
make a accept call. So, this accept call will take the sock fd where the socket is listening
the client address that will be provided. So, when the client will get connected the
address of the client will get stored in this variable, and the length of that client address.

Now, this accept call whenever you are initiating a connection as I have mentioned that
the server need to always in the mode where it is waiting for any incoming connection
and the clients need to initiate the connection. So, accordingly we have two kind of
connection called active open and the passive open. Now, as I have mentioned that the
server needs to announce it address remain in the open state and waits for any incoming
connection, so that is the kind of passive open. And the client it only opens a connection
where there is a need for data transfer that is the kind of active open. And the connection
it is initialized by the client.

501
(Refer Slide Time: 23:41)

Now, these are the data transfer format. So, we have two different type of socket; the
stream socket and the datagram socket. In case of a stream socket, you can use the
function called read and write by providing the socket identifier. So, here is an
interesting fact that whenever you are accepting a connection, you are getting a new
socket id. So, why you are getting a new socket id, because the server is listening on one
socket; now when the client is initiating there can be multiple clients which are
connecting simultaneously. Now, when multiple clients are connecting simultaneously,
you need to create separate logical pipe to separate client, so that are actually indicated
by the socket address which is written by this accept system call.

So, the accept system call will return an address and that particular address will be
assigned to the new sock fd and while you are sending the data you use that new socket
id because that has created end to end stream or end to end pipe to a specific client and
you will send a message. So, for the stream kind of socket, you can use the read and the
write function to read data from a buffer or to write data to a buffer. For the datagram
socket you can use the function called the receive from and send to; receive from
function to receive data from the socket or sent to function to send data to that particular
socket.

502
(Refer Slide Time: 25:09)

Now, here are some, so I will show you some demo of the entire thing. So, here are some
link that you can follow to learn socket programming in more details. So, what I will
suggest you to go to these particular links and start writing your own network
programming using the socket. So, let us quickly go to some demo of this entire idea of
socket programming.

(Refer Slide Time: 25:37)

So, we will first look into UDP server and a corresponding UDP client. So, let us open
look into the UDP server first.

503
(Refer Slide Time: 26:05)

So, here is your code for the UDP server. So, in the UDP server code, you can see that
we have included some header, these are the kind of standard headers that we have to
include. And then inside the main function, we are declaring the entire thing. So, in the
main function, we have this we are first defining a socket, which is the struct sockaddr in
and the corresponding server address. Then we are defining a socket identifier. And we
are defining a port number.

Now, here this we are first making a socket system call. In the socket system call, you
have this AF INET the parameter that we have mentioned we need to specify the data
gram socket. We are specifying because we are trying to create a UDP socket and final
parameter is equal to 0. The 0 parameter that we send for the protocol field that we have
mentioned. Then once the socket is created, if there is an error, we print some error
message.

504
(Refer Slide Time: 27:17)

Otherwise we declare the server address as we have discussed earlier. So, we declare it as
the protocol family as AF INET the address as inaddr any with a address of this machine
and then the port number. Then we make the bind system call. The bind system call is to
bind the socket with the corresponding port number that we are specifying as a command
line argument. And finally, we make a call to a function called setsockopt, this setsockopt
is to set some option to the socket, here we have set the option is so_reuse addr. This
so_reuse addr will help us to use the same port for multiple connections together and that
is not a safe idea, but sometime you can use that.

Then after that we are declaring the buffer where we will store the data. We are declaring
the receive buffer and the length of the data. We are again declaring a address for the
client that we have shown; the address where the client variable will get stored. And after
that we are making this receive from function. Now, you see for the UDP case, we do not
create any connection. So, we do not require this connect and accept calls. So, the
connect and accept call are specific to the TCP server; for the UDP server you do not
require the connect and accept call, because we do not have a connection establishment
in case of UDP.

505
(Refer Slide Time: 29:10)

So, what you can do once you have created the socket at the server side, you can directly
make the call to the receive from function to receive the data. And this receive from
function will contain the client details. So, this is the client address which is clear in the
receive form function. And once you are receiving data we are printing some data and
making a send to call. So, this send to call is sending the data to the corresponding client,
so that is the port at the server side.

(Refer Slide Time: 29:28)

506
(Refer Slide Time: 29:37)

Now, let us open the client side code for the UDP. So, this is the client side code for the
UDP. At the client side, we do in the same way we declared the address the server
address where we want to connect.

(Refer Slide Time: 30:00)

So, then from the comment line, we take the hostname and a port, the host name of the
name of the server and the port address where the server is getting binded. Then we
create a socket with AF INET and as a datagram socket at the client side as well. Then
we get the server IP.

507
(Refer Slide Time: 30:25)

After that we are creating the server address by using that setting the sin family the host
address and the server port. So, the value which are being provided by the by the client at
the through the command line. So, after that once you have got the server address, again
you do not need to initiate a connection, you can directly make the send to call to send
some data. So, from here we are making a send to call. So, this send to call is sending the
data to the particular socket with this server address which we are specifying here.

(Refer Slide Time: 30:53)

And after that you are sending the data, we are receiving certain data.

508
(Refer Slide Time: 31:07)

So, we are sending the data from the client as this message hello dear and from the client
side we are receiving the data. So, we are receiving the data in the form of what is
returned back by the sender, we have declared a temporary character buffer here a stream
here stream buffer here. And we have made this receive from call to receive the data
from the client side from a server side. So, here the server address is being provided, so
that is and then we are printing the data here, so that is the client side code. Now, let us
run the server and the client side code. Here in the same machine we are running the
server side code and a client side code.

(Refer Slide Time: 31:51)

509
So, first let us compile the server code and the client code.

(Refer Slide Time: 32:00)

So, now let us first run the server. So, according to our syntax we that is we have to run
the server and specify a port address where the server will connect itself the bind through
the bind system call. So, let us give the port number as 2333. So, the server is now
running. Now, from the client side we can run the client. And we are running the server
in the same machine, so the host name of the server you can give it as local host. And to
you are running the server at the port 2333; at port 2333, so we can provide the server
port as 2333. So, it has send a message to the server you can see that the server has
received the message from the client and it is returning back that message. So, the client
has received the message and printed it.

So, you can again run the client. And you can see that it has received a message. Now,
note the note one thing here you are printing the server IP the client IP and the client
port, the client IP is the local IP of this machine. And a client port whenever we are
running multiple client, the client code gets changed. Now, at the client side as the client
do not bind itself to our well known port during the runtime, the client randomly chooses
one port address and initiate the client transfer from that particular port address, so that is
why a different run the port address gets changed.

So, if I run it again multiple time at different time, the port address gets changed. So, at
different instances it takes different port. So, this is a demo about the UDP server and a

510
UDP client which is the possibly the simplest form of the socket programming. We will
share the code with you, we will request you to browse through the code run into your
own machine and see what is happening and understand it more details. So, in the next
class, we will show you the demo about the TCP server, TCP client and some variants of
TCP server and the TCP client.

Thank you all for attending the class.

511
Computer Networks and Internet Protocol
Prof. SandIP Chakraborthy
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 25
Socket Programming – II

So, welcome back to the course on Computer Network and Internet Protocols and in the
last class, we are discussing about socket programming in today’s lecture, we will again
continue with the socket programming in details. So, in the last class we have looked into
the UDP socket, we have looked into the basic of socket programming along with the
UDP server and the UDP client in details that how you can use this concept of soc
datagram under datagram socket to transfer data receive data using UDP protocol. So,
today we look into how you can do the same thing using TCP protocol and we look into
different variants of TCP server.

(Refer Slide Time: 00:57)

(Refer Slide Time: 01:11)

512
So, first let us look into the demo of demo about the TCP server and a TCP client. So,
first we look into this TCP server the source of the TCP server in details, well so do not
get confused to it end arrow. So, these are C program do not get with this end arrow and
this dot just a formatting we have used for our clarity of writing the code. So, this is your
C code well.

(Refer Slide Time: 01:35)

So, we have this network related header, which are being included followed by the main
function so, in the main function similar to the UDP1, UDP server that we have
discussed, we are declaring a the server address first, server address variable of type
struck sockaddr in and file descriptor to store the socket id that will be created and this is

513
the syntax that how you should use the code, we are taking the code number from the
command line argument and then we are taking the port number from command line
argument and we are creating the socket by this socket system call.

So, this socket system call similar to the earlier case it will take a finite as the protocol
family, but the socket type is now SOCK STREAM in state of SOCK DGRAM. So, and
finally, it is a protocol field is 0 and as I have asked you earlier that try to explore that
why we mostly use protocol family protocol type as 0.

(Refer Slide Time: 02:41)

Now if the socket is not created successfully some error message that is getting printed
and after that we are initializing the server address field the server address family
protocol family we are setting it as AF INET, because we are going to use the IPv4
address followed by the server address or server address we are taking it as
INADDR_ANY. So, this INADDR ANY will help us to take the address of the local host
then, we are providing the port number which are have taken from the concept.

So, we have initialized the sever address. So, once you have initialized the server
address, you have to bind it with the socket. So, we are making a bind system call. So,
the bind system call may fail sometime because, if you are going to use the same port
number which is being used by another application, there are other reasons where a bind
call may fail. So if the bind fails, we are having a error message that it is fail to bind that
otherwise, the bind was successful. And the bind is taking the format as we have

514
discussed earlier the socket file descriptor the address of the server and the size of the
server address variable.

(Refer Slide Time: 03:49)

Now we are making a listen call, the listen call here we are providing the socket and
socket file descriptor and we have specified 5 as the maximum number of connection
that can be backlogged in the listen call. So this concept of backlog connection is that,
the server can handle one client at a time. So, whenever it is taking the connection one
client, during that time multiple client can again try simultaneously, just think of the
scenario of a web server, where thousands of request are coming to the web server per
second.

So, during that time when the server is busy in executing this say the listen call for one
connection during that time the other connection will get backlog. So, this parameter 5
which specifies how much such connection can get backlogged.

So, after that we similar to the earlier we are making a call to this setsockopt function to
provide this facility of REUSEADDR. So, that we can use the port number for multiple
codes together and after that, we are declaring a received buffer to store the incoming
data in a stream format the buffer length and received length that would indicate how
much data we have received.

515
And we are declaring this client addr variable that sock sockaddr type of variable to store
the client address and this client length this variable store the address of the client.

(Refer Slide Time: 05:23)

Now, in side the loop, what we are doing, we are making the accept called at the server
side, now TCP is a connection oriented service that is, why you have to make the connect
call from the client side and accept call from the server side to initiate the connection,
which will utilize the three way handshaking of the TCP protocol. So, after we are
making the accept call the accept call, we are passing the parameter as the socket file
descriptor, the address of the client and a length of the client address if there is an error.
So, all this function if there is an error, they return some negative number. So, that is why
you can check the return value if it is less than 0; that means certain error has occurred.

Ok. So, after that once it is accepted the connection, we are printing that we have
received a new connection from the client address, we are specifying the client address
and the client port. So, from that particular client address and the client port a new
connection has been received and after that we are having a loop, where we are receiving
the data from the new socket that has been created.

Now, here also while you are making the accept call, in the accept call, it returns new file
descriptor and this new file descriptor will initiate this end to end connection, between
server and the client. So, it returns a new socket descriptor that we will used in the in

516
sending or the receiving data, which is specific to a pipe or specific to a socket between a
sever and the corresponding client.

So, we make this receive call to receive the data, we will provide this new socket file
descriptor that, you have received after making the accept call and then the received
buffer to store the data the buffer len and this entire call will return the amount of bytes
that have been received. So, that will returned by the received call and it will store inside
the receiveLen function.

(Refer Slide Time: 07:42)

Now, if receiveLen is equal to equal to 0; that means, you are not receiving any data
from the client. So, you can close this particular connection. Otherwise you get the data
and put in that data that you are receiving at the server side and after that we are actually
whatever data we have received, we are requiring same data to the client by using this
same function ok. So, you have received the data, which is stored in the received buffer
same data is decode back to the to the client side.

517
(Refer Slide Time: 08:15)

So, this is my code for the sever side now, let us look into the code at the client side.

(Refer Slide Time: 08:22)

(Refer Slide Time: 08:32)

518
(Refer Slide Time: 08:35)

Ok, at the client side, things are pretty similar on we are declaring the socket we are
creating a new socket and after creating the new socket, we are getting the here in the
client side, we are getting the server IP or the server host name and the port from the
command line argument. So, we are using that command line argument to create the
server address.

519
(Refer Slide Time: 09:03)

So, we have declared the server address as a variable as a struct sockaddr in variable. So,
inside that we are putting the server address. So, we are getting the server IP. So, get host
by name this particular function returned a host IP from the host name. So, we are getting
that and then we are putting that server address in this serverAddr variable. So, we are
initializing the serverAddr variable with all zero’s that is to initialization that the sever
address family that is AF INET to use the IPv 4 address then this h addr and this
particular field we are using to provide the corresponding server address and the port
number.

Now, you are making a connect call to initiate the connection at the client side. So, the
connect call it sends this socket file descriptor along with the sever address that we have
seen earlier.

520
(Refer Slide Time: 10:14)

So, it initializes the connection to the server using the TCP three way handshaking
procedure. Now, after that after the connect system call has made, you have initiated the
connection to the server then, you make the call to the send function, the send function to
send the data. So, we are creating a message called hello there this particular message,
we are sending to the server and as you have seen in the server code that the server will
actually go back that particular thing to the client.

So, after you are sending that you are receiving the message. So, we are declaring a
buffer as a character array, we will get the data in the form of a character array or a
string. So, we are declaring that buffer for that and after that we are making a receive
call, this receive call over that socket file descriptor that will get the data from the client
side.

So from the server side so as you have seen in the server code, the server will actually go
back the data that you are sending so, here you are sending this hello there function,
same hello there function will be got back. So, you will receive that data and after
receiving that data you print that particular data at the concept. So, that is the code for the
client side.

Now, let us compile and run this two things. So, first let us compile TCP server and
compile TCP client. So, first we will run the server. So, we need to specify the port
address. So, we are giving port address as 2444, those server will now the server is

521
running there. So, once the server is running there from the client side, we can give so
the server is running in my machine.

So, I am giving the server host name as local host and the corresponding server port that,
we have used here 2444. So, it has received the message and at the server side you can
see that, it has received a new connection from the local machine the IP is 127.0.0.1 and
a port of 47676. So, it has received this hello there message, it has got it back and the
client has received that message.

So, if you again run the client, again it has received the hello message and you can see
that it has received another connection at a different port 47678.

So, if you run it again, you see that it is again using a different port 47680. So, the same
thing as we have seen for the UDP server case that, the server is announcing itself to a
well known port, but the client need not to do it. So, the client is actually using some
random port to initiate the connection from the client side, that particular code value we
can see here.

Now, this is a kind of TCP server and a TCP client implementation, where in the TCP
server implementation, we call it a kind of iterative server why we call it a iterative
sever? Because if you look into the code, let me open the code again.

(Refer Slide Time: 14:06)

522
So, here you will see that this connections. So, here we are making a while loop and
inside this while loop, we are accepting the connection.

So, how this entire thing will work if multiple client equation are coming simultaneously
then, one client will be taken that that connection will be taken that will get executed.
Then the next client will be taken, that will get executed, then the third client will be
taken, that will get executed and that way this entire thing will go on. So, that is why we
call this kind of server implementation as an iterative server implementation, where the
client requests are executed one by one.

So, now we will see that we. So, one thing is that this kind of iterative server
implementation is not very useful, when you are trying to design a server like a web
server while you can get thousands of request per second. Now if that is the case, then
you have to handle the client request in parallel, otherwise the sever will not scale up. So,
we will now see that how you can actually implement a parallel server using this help of
socket programming as well as some concept of your operating system level
programming and your operating system concept of multiple processes.

(Refer Slide Time: 15:27)

So, if you do not have a understanding of this operating system concept of processes,

523
(Refer Slide Time: 15:44)

I will suggest you to look into this process concept in operating system and look into it in
details. So, we will use this concept of process in the operating system to look into this
implementation of concurrent servers at the parallel servers. So, as we have looked
earlier that you are creating multiple such connections.

(Refer Slide Time: 15:50)

(Refer Slide Time: 15:56)

524
(Refer Slide Time: 15:59)

We have already looked this socket programming framework or the APIs. Now, the
concept of concurrent sever is something like this where multiple clients are trying to
connect to the server simultaneously.

(Refer Slide Time: 16:14)

525
Now, if multiple clients are trying to connect to the server simultaneously, then how will
you handle that thing. So, one ways to handle it is using the iterative server, but as we
have seen that the iterative server may not be very useful. So, we implement the parallel
server using this concept of multiple processes in operating system.

So the idea is something like this you have a server process, which is having the parent
socket then, you can make a fork system call. So, in operative system, this fork system
call creates a child process. So what you can do that once you are accepting a connection
then you can make this fork system call to create a child process, which will actually
handle the data transmission and data reception from that particular child connection.

If you are not doing that, if you are doing it in the earlier way that we are doing inside
the while loop in the form of iterative server, then the time until a particular server is
keep on sending and receiving data, it is not closing the connection up to that point the
connection will remain blocked. So, the server will not be able to handle the second
connection until the first connection is complete.

So, that is why the idea is that, whenever a new connection is coming, you make a fork
system call and after making a fork system call have a child process, that child process
that is the part of the server process, but that will create a child socket it will. So, we
have seen that after you are making an accept call at the server site, it returns a new
socket identifier, which is used to send or receive data to the client.

526
So, you pass that particular new socket file descriptor to the child socket, which will
handle data transmission and reception in parallel. So, the broad idea here is that you get
all the connections one after another, but do not wait for the send and a receive
functionality of our individual connections and keep other connections in the waiting
queue. So, you create a child process and that child process will or we call it as a child
socket, that will handle the send and a receive data functionalities of individual client
request that you are getting.

(Refer Slide Time: 18:32)

So, that was our implementation of the iterative server that we have done, we have a
while loop, inside the while loop you are making a accept call then, you have the send
and receive and it is inefficient because until you are complete that send and a receive
functionalities, you will not be able to come out of that and get or make the accept call
again to accept the new incoming connection.

527
(Refer Slide Time: 18:56)

So, if you look into that how iterative server works that the listen call it sets a flag that,
the socket is in the listening state and set the maximum number of backlog connections
that you have seen earlier then, the accept call it blocks a receiving socket, until a new
connection comes in the connection queue and it is accepted. So, this accept call is a
blocking call. So, the system will keep on waiting here until, you are making a connect
call from the client side. So it is a blocking call.

Now, once this new connection is accepted, then the new socket file descriptor say, the
connection fd it is written, which is used to read and write data or to send and receive
data to the connective socket. Now all other connection, which comes in this duration are
backlogged in the connection queue, because the process is busy inside this while loop to
send and receive data. So, once the handling of this current connection socket is done
current connected socket is done, then the next accept call they accept the next incoming
connections from the connection queue if there is any or blocks the receiving socket until
the next connection comes.

So, once the execution of this while loop complete, then only you are connect coming in
here and accepting the next connection. So, everything is actually blocked on the send
and a received call that you have there you have there at the at the this particular while
block.

528
(Refer Slide Time: 20:30)

Now, we extend this iterative sever to a concurrent server. So, our idea is that the parallel
processing of each incoming socket, so that the accept call is executed more frequently.

So, what we do here? Here you see that after we are making this accept call, which is
returning the new socket file descriptor then, we have successfully accepted a client
connection then we making a fork system call. So, this fork system call at the parent
process, it returns the idea of the child process and at the child process it returns 0.

So, whenever you are making this fork system call and if the fork system call is returning
0; that means, you are inside the child process. Now this child process, what it does? It
closes the original socket the server socket and it will use this new socket fd that you got
to send and receive data. So, you close the old socket since all communication will be
through the new socket and then you initialize the buffer, copy the message to it, send or
do the receipt whatever you want to do.

Now, what will happen here that whatever is there inside the fork system call, inside this
fork block in this if block that will executed get executed in parallel. So, in the parent
process the parent process will not so for the parent process, this will receive return false,
because parent the parent process fork returns the ID of the child process and in the child
process fork returns 0.

529
So, in the parent process you will return back and the parent process will again come
here and make the next accept call. So, the parent process now do not need to wait for
this send and receive functionalities, which will be handled by a child process.

(Refer Slide Time: 22:38)

Now, let us look into the demo of this one. So, here we do not make any change in the
client implementation. The client implementation remains as it was earlier, we will only
make change at the server implementation. So, at the server implementation, so the
change that, we have made the entire code is similar if you look into that we are
declaring this server address, followed by a socket call then initializing the addresses at
the server address field, making a bind call, making a listen call to broadcast the or not to
actually broadcast this may not be a correct term to announce the port where the sever is
actually listening and after that making that set sock opt call as earlier and then inside
this while loop, where you are accepting accepting the connection we are accepting
accepting a new connection and it is going to this child fd we are creating a new file
descriptor.

After that you see we are making a fork call. So, you look into this statement in for
return equal to fork. So, we are making a fork call which will create a child process, now
I will suggest you to look into this operating system concept in details, we do not have
scope to discuss that, the idea here is that whenever you are making a fork call this entire
code will be copied to the child process as well. So, the child process what it will do? In

530
the child process, the fork call will return a 0 and in the parent process the fork call will
return the ID of the child process.

So, if you make a if loop with this return value if the return value is 0; that means, you
are inside the child process.

(Refer Slide Time: 24:32)

So, inside the child process this part of the code will get executed. Now you see this the
second while loop that we had which actually deals with sending and receiving data, it is
inside only the child process. So, it is inside this if block here we are making this receive
call and a send call.

And we are having that handling in parallel at the sever side. So, in the server side this
particular if block will not get executed, because in the server in the parent side, parent
socket this will not get executed, because the parent socket will return the ID of the
child. So, it will be not equal to 0.

So, this part will only execute at the child process. So the child process is now dealing
with sending and receiving of the data, but the parent process can come out of that, the
parent process is not getting blocked in this second while loop, it can directly come out
and accept the next connection.

531
(Refer Slide Time: 25:48)

Now net let us run it. So let us first compile it minus o we name it as forkserver and
running the forkserver here, ok we have to give the port.

Now this time say give the port as 2555. So, the my server is running and the client is the
same TCP client that we used earlier. So, let us initiate the connection from here another
connection say from another tab.

(Refer Slide Time: 26:33)

So, you are not doing much tasks.

532
(Refer Slide Time: 26:51)

So, we will possibly not get a feel of this parallel execution, but what is happening there.
A new child process gets created and it handles this individual request that we are
sending here.

So, you see that we have made some client execution here in this tab and as well as in the
another tab and correspond to that, you are getting the connections at different port and
they are getting executed in parallel. Now this handling is done by a child process rather
than the original parent process.

(Refer Slide Time: 27:28)

533
Ok now, we have another interesting thing to discuss. So, ok.

(Refer Slide Time: 27:33)

(Refer Slide Time: 27:38)

(Refer Slide Time: 27:44)

534
So, what we have seen till now, that we can do a kind of server implementation.
Concurrent server implementation, now think of a application something like that a kind
of peer to peer chat application. So, multiple people they want to send or receive
messages to each other.

(Refer Slide Time: 27:59)

Now in this particular case, what may happen that we do not have any central server to
control the chat message delivery, every user runs it is own chat server; that means, it
runs the TCP server for incoming come incoming connections and messages, now in
UNIX, it maintains every connection as a file descriptor that we have already seen.

535
Now, at that time in a chat server you have a typical requirement that you need to also
read data from standard input. So, you need to type something. So, when you are
receiving a message during that time say, you are typing something. Now whenever you
are typing something that standard input it is again a file descriptor. So in UNIX,
everything is a file a socket is represented by a file descriptor and at the same time the
input from the keyboard that is also represented as an file descriptor by this STDIN file
descriptor.

Now in that case, the question come how will you handle it? Because your data is
coming from multiple places, you are getting data from the socket as well as you are
entering data from the keyboard, how you actually switch between this multiple thing,
where this message communication is asynchronous. So, you can receive a message
while you are doing the typing.

(Refer Slide Time: 29:16)

So ok for that we use this concept at the select system call, which is again an operating
system level system call.

So the select system call, it selects from multiple file descriptor, which is a concurrent
way to handle multiple file descriptor simultaneously even from a single process. So, you
can get the data from the socket, which is one of the file descriptor as well as the
keyboard file descriptor simultaneously.

536
Now, what we have seen that, what happens in an iterative server implementation that we
have done earlier that the accept call is blocked until you have completed the read and
the write calls. Now what if you do multiple read and write activities after accepting an
incoming connection, that the other connections are blocked and waiting for the
connection queue, they may get starved. Now select is the way to break this blocking.

So, one way to break the blocking is using this parallel implementation another way to
do that thing is to use the select system call. The advantage with this select system call is
that, you do not need to create multiple child processes, now no you do not need to worry
about the zombies. So, child processes has always a problem that if you are if sometime
the parent process get killed or the parent process stops, then the child process become
zombie. So, with the select system call you do not need to worry about this zombie. So,
you can possibly manage resources more efficiently.

So, this selects system call it is nothing but a multiplexer.

(Refer Slide Time: 30:45)

So, what happens that you have multiple file descriptors, you have certain signals and the
time out and out of this multiple file descriptor, it selects one of the file descriptor. So, it
finds out that among this file descriptor which one is currently active and it select that
particular file descriptor.

537
(Refer Slide Time: 31:02)

So, here is the format of the select system call, in the select system call you are providing
the number of file descriptor, it is the highest number of file descriptor in any of the three
sets plus 1, we have three different sets of file descriptor, the read file descriptor to read
something as an input, the write file descriptor to write something at the output and
except file descriptor to handle the exceptions.

So, this file descriptors are a kind of structure called fd set and we have a timeout value.
So, the timeout value is that if you are not getting anything from this file descriptor for
this timeout value. So, it will come out of the things.

So, it is actually providing you a synchronous I/O multiplexing over asynchronous input.
So, as we have mentioned earlier that your input can be asynchronous, you can get a
message over the socket while you are doing the typing, but it provides you a
multiplexing to select either the keyboard or the socket at one time distance.

538
(Refer Slide Time: 32:09)

So, you have three different file descriptor that each file descriptor will be watched to see
if characters become available for reading, the write file descriptor will be watched to see
if the spaces available for write and the exceptional file descriptor will be watched for
exceptional condition.

(Refer Slide Time: 32:23)

Now we have a timeout value, the interval that select should block waiting for a file
descriptor to become ready, now the select call remain block either the file descriptor
becomes ready or the call is interrupted by a signal handler or a timeout expires. So, in

539
any of the cases it comes out of the select. So, whenever one of the file descriptor
becomes ready it comes out of the select call, if that particular call is interrupted by some
other signals or the timeout happens. So, this is the procedure to set the timeout you
provide the value in the form of second and microseconds.

(Refer Slide Time: 32:59)

Now, how do you pass the file descriptor to select? So for that what we do, we first
initialize the file descriptor set fd set, which is a bitmap of fix size with this fd 0, then we
make the call to fd set. So, if this fd set selects a file descriptor say, my socket that I have
defined and the corresponding the file descriptor, which where the socket is getting
added. So, this particular bit corresponds to this socket file descriptor that will get set;
that means, some data is available there.

540
(Refer Slide Time: 33:42)

Ok then you make the select call so, how select works? So, it looks over all the file
descriptor for every file descriptor it calls the file descriptor poll method. So, this poll
method is to check that whether something is available to or some event is waiting on
that file descriptor. So, it will add the caller to that file descriptor wait queue and return,
which events currently apply to that file descriptor whether it is file descriptor is
readable.

If it is a read file descriptor whether it is writable, if it is a write file descriptor or some


exception has happened. Now if any of the file descriptor matches the condition that the
user was looking for read, write or exception, then the select will simply written
immediately, after updating the appropriate file descriptor set that the user passed and if
not the select will go to sleep for the timeout value once, the timeout occurs it will come
out of that select call.

(Refer Slide Time: 34:43)

541
And if some other events happen within that timeout event, it will made this FD set and
come out of that. And during that interval if an interesting event happens to any of the
file descriptor that select is waiting on that file descriptor will notify its wait queue. So,
this will cause that thread sleeping inside the select wakeup and it will repeat the above
loop and see which of the file descriptor are now ready to be returned to the user.

Now, the return value of the select we have three values if it is minus 1 means some error
has encountered. 0 means that the timeout has happened and greater than 0 means, that
that the number of sockets that has the event pending like read write or exception. So, for
how many sockets that event is pending, whether you are going to read or write or
having certain exception.

542
(Refer Slide Time: 35:23)

So, after select returns you can use the function called FD set to test, whether a file
descriptor is a part of that set. So, you can check whether a file descriptor has been set or
not if the file descriptor has sat set; that means, you have something to read, if it is a read
file descriptor or you have something to write if it is a write file descriptor.

(Refer Slide Time: 35:55)

So, let us look into a code which uses this select call. We will use the same TCP server
implementation with this select.

(Refer Slide Time: 36:18)

543
So, the base part of the code is same as earlier we are declaring the server address, the
bind call, the listen call at the server side the set sock opt call and after that we are
declaring the file descriptor. So, here we are declaring that we can have a maximum of
16 different file descriptor and this fd len returns, that how many are how many such file
descriptor are currently set or currently active.

So, we are declaring the set of file descriptor and the maximum file descriptor which is
equal to the current socket file descriptor. Now inside this while loop, we first initialize
the file descriptor, we are here only going to use the read file descriptor because we are
going to read data from the socket and we are setting through this fd set call, we are
setting the read file descriptor corresponds to the socket that we have defined or the
socket where the server is actually listening.

Now, we are looping over the available file descriptor. So, here the idea is that whenever
we are getting a new connection, we are adding it a inside the file descriptor inside that
file descriptor set.

544
(Refer Slide Time: 37:25)

After that we are making a select call. So, as we have seen earlier that there we are not
giving any timeout value, because we are not giving any timeout value. So, it will keep
on waiting for infinite duration, whenever some event will occur then only it will come
out. So, we are initializing with this read file descriptors.

So whenever a new connection will come, it will come to this read file descriptor
through this loop and then it will keep on waiting here, when some event will occur that
old function will get triggered and that old function will return, whether certain event is
there in the read file descriptors certain event means, whether that particular socket is
ready to read the data.

And after that if select returns; that means, some socket is ready for reading the data then
you check using fd set, whether that particular socket is ready to read the data if that
socket is ready to read the data then, you make a accept call, accept call to accept that
particular connection that means, some connection is waiting you accept that connection
and after doing that, the way we are closing the child file descriptor and then add that
particular thing to that file descriptor loop.

545
(Refer Slide Time: 38:52)

Then in this fd set you loop over all the file descriptor that you have been added.

(Refer Slide Time: 38:59)

So, here earlier what we are doing, that whenever some new connection is coming using
that select call we are checking that some new connection has arrived. So, if that is a new
connection, we add that new connection to the set of file descriptor that we have
otherwise some file descriptor from the existing file descriptor is ready to use.

546
So, what we do that we check we look over the available file descriptors that we have
and the file descriptor that is currently ready on top of that we make the receive call and
get the data and then return back the data there.

(Refer Slide Time: 39:36)

So, if that received len is equal to equal to 0; that means, you are not receiving any data.
So, you close that file descriptor and clear it from your file descriptor set.

(Refer Slide Time: 39:48)

So, that is this entire idea and after that you send the data in our normal procedure. So,
the idea is that whenever you are getting a new connection, we are adding that new

547
connection in the set of file descriptors and then we are looping over that file descriptor
to find out, which one have certain data and if someone has certain data, we are sending
back that data.

Now, let us run this code, first compile it, again we are going to use the same client
implementation that we have, the client implementation we are not making any change.
So, now, my server runs over select and giving a port 2666, it is running from the client
side.

(Refer Slide Time: 40:51)

Ok, you send the data, you send something it has received that, then once the task is done
it has closed that particular connection.

Again you can execute it, you see it is from a again a different port, the same thing we
are keep on observing it has received the data decode it back to the client and closing that
connection that particular connection. And well one thing that I wanted to show that if
you try to connect to a port, where the server is not running. So, the server is now
running at port 2666, now if you try to connect it, it will get a connection refuse message
from the connect call, because none of the server is currently running and the port 2555.

So, this is all about our discussion on TCP server, I was quite fast in describing the things
with the assumption that you have a basic knowledge of C programming and operating

548
system, we will share all the codes with you and I will suggest you to browse the code
and look into the tutorials that we have shared.

And if you have any doubt or anything feel free to post the questions in the forum. So,
with this particular socket programming, you can develop your own applications you can
even implement the chat server application that we are talking about. So, I will suggest
you to look into that and implement multiple such applications on your own with the
help of this different variance of socket programming.

So, thank you all for attending this class; from the next class onwards, we will go for
again the theoretical aspects of the TCP/IP protocol stack.

So thank you all for attending this class.

549
Computer Networks And Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science And engineering
Indian Institute of Technology, Kharagpur

Lecture – 26
Network Layer I – Introduction

Welcome back to the course on Computer Network and Internet Protocols. So, till now in
the course we have looked into 2 different layers of the TCP/IP protocol stack; the
application layer and the transport layer. So, from now onwards we will look into the
third layer of the protocol stack from top to bottom direction; that is the network layer or
sometime people call it as the internet layer of the protocol stack.

(Refer Slide Time: 00:44)

So, as I looked earlier that this network layer or the internet layer of the protocol stack, it
interconnects multiple devices in the network or we call that they are kind of the layer 3
devices; which actually take care of to forwarding the data packets from one end host to
another end host. So, the broad objective of this network layer or the internet layer of the
TCP/IP protocol stack is to ensure that wherever you want to forward the packet, the
packet is successfully delivered to that particular destination. Or the network will try its
best to deliver the packet to the destination.

Obviously this network layer or the internet layer it doesn’t able to guarantee the
successful delivery all the time in a packet switching network, because in a packet

550
switching network, there is always a possibility of having a packet drop. And that is why
we have looked that in the transport layer of the protocol stack we take care of the
reliability and other end to end aspect. But in the network layer we will primarily look
into that given a particular destination for a data packet, how will you ensure that the
particular packet is delivered to that destination which is mentioned by the application
developer.

(Refer Slide Time: 02:13)

So, we’ll now at the middle of the protocol stack and we will look into the details of this
network layer and the internet layer. So, coming to the network at the internet layer, so,
let us look into the different services which are being provided by this particular layer of
the protocol stack. So, we call it as the layer 3, because from bottom up it is at the third
layer it is in the middle of all the layers of the protocol stack.

So, this network layer as we discussed earlier that from data link layer it gets certain
services, or the data link layer it ensures that well how will you transfer a data packet or
a frame in the terms of data link layer; from one node to the next node which is directly
connected via wire or there in the communication range or wireless communication
range of each other.

So, the data link layer takes care of forwarding the packet directly to the next hop. Now,
whenever in your internet your destination is connected via multiple such hops and the
entire network looks like a graph. In that particular graph, the challenge comes that how

551
will you find out a good path to forward your data packet from the source node to the
destination node. So, that is taken care of by the network layer of the protocol stack that
we are going to discuss.

So, this network layer of the protocol stack ideally it supports this datagram delivery. So,
in network layer we call the unit of data as the datagram. So, this is a kind of unreliable
datagram delivery in the context of TCP/IP protocol stack and for the context of packet
switching network, because as we have learned earlier that in case of packet switching,
there is no guarantee that you have sufficient space, that will be there in the intermediate
buffer or the network buffer.

So, there is always a possibility that those particular packets, those will get dropped from
the network buffer and a loss of data packets. So, that is why we say that the network
layer, it tries it is best to deliver the packet to other end host. So, that is why we use the
term unreliable to introduce the delivery model which is being used at the network layer.

So, the network layer ensures unreliable datagram delivery which is a kind of what we
normally say as the best effort service to tries its best to transfer the data packet from the
source to the destination, via multiple such hops. And then on top of that in the transport
layer you have multiple services that we have already looked into, that in case of the
transport layer, if you are going to use a TCP kind of protocol. So, the TCP kind of
protocol will ensure the reliability by utilizing the retransmission of the data packets. So,
that we have already looked into.

So now in case of a network when the network is represented in the form of a graph, that
we have looked into the initial lectures, that in that network graph there can be multiple
hops or multiple paths between a source and the destination.

552
(Refer Slide Time: 05:27)

So, ideally a network if you look into it is graph structure, it will look something like
this. So you have multiple nodes there which are interconnected with each other.

So the nodes are interconnected with each other, these links can be wired links or this can
be wireless links as well. And then you have one source in the network and one
destination in the network. So, this is my source and this is my destination.

Now, the data link layer of the protocol stack that is the layer 2 of the protocol stack. So,
if you remember the different layers of the protocol stack at the bottom we have the
physical layer; which takes care of physical signal transmission, on top of the physical
layer we have the data link layer. So, this data link layer of the protocol stack, it ensures
that how will you deliver the data from one hop to the next hop, which are directly
connected with each other. So, that is the task of the data link layer or that is the services,
which is provided by the data link layer to the next layer that is the internet layer or the
network layer of the protocol stack.

So, then the data link layer provides a service to the network layer, to forward the packet
in one hop distance. So, where the 2 nodes are directly connected to each other. Now
whenever you are going to the network layer and you need to forward a packet from the
source to the destination and your entire network can be represented as a network graph,
where each of these circles or each of these nodes represent a network router or
sometime we call them as L3 switches or the layer 3 switch.

553
So, whenever they are connected via this layer 3 switch or the router, and these routers
they have up to layer 3 implementation; that means, up to network layer implementation.
And in that case you can see that if you want to forward the packet from this source to
this destination, there are multiple paths which are possible. So, one path is like you can
follow this particular path to forward the packet from the source to destination. Or you
can follow another path say this path to forward the packet from the source to the
destination.

Now, ideally this blue path is a smaller path. So, if your metric or if you decide to
forward the packet in the lowest hop path or the minimum hop path then you will prefer
this blue path. But minimum hop path may not be always give you the optimal
performance. Because it may happen that your minimum path has the a very low
capacity, low end to end capacity. If your minimum path has a very low end to end
capacity and if you push all the packets in that particular path, then there can be a
degradation in end to end packet forwarding performance. So, that is why in a typical
network we do not always prefer to use the minimum hop path. There are other various
metrics which are available, based on which we decide that how to forward a packet
from one node to another node.

Now, in this entire thing the good thing is that if you have this entire topology available
and the link characteristics available; so if you have this whole topology available along
with this link characteristics available, then possibly you can apply certain graph
algorithm like the shortest path algorithm that you have learnt in your algorithm course,
like that Dijkstra’s algorithm or Bellman-Ford algorithm to find out the shortest path.

And where this metric that you want to use to decide the best path, that will work as the
weight of a particular link. And that way if you can represent this entire network in the
form of a central graph structure then you can execute the Bellman-Ford algorithm or
Dijkstra’s algorithm to find out the shortest path and then forward the packet through that
shortest path.

But unfortunately in our network we do not have this facility available. Because all these
individual routers at the layer 3 devices, they work in a complete decentralized way. So,
every individual router or every individual layer 3 device, need to take care of or need to

554
decide that how to forward a particular path packet to the next hop, given destination
addresses available.

And you do not have any central coordinator or centralized system which will monitor
this entire network topology and give you a central graph in the in the form of your
network topology structure.

Because our network works in this kind of decentralized way, the network layer has a
huge job to find out that how will you decide that what is your next hop, which will give
you the optimal end to end path based on the path metric that you have chosen. So, this
particular methodology is termed as network routing.

So, the routing procedure decides that at every individual hop, every individual
intermediate router whenever you are receiving a packet with this particular destination,
what should be your next hop and that is done in a completely decentralized way.

So, this particular router R need to decide. So, once it receives a packet, say I am giving
or I am assuming that the address of this particular destination is D; later on we will see
that how we represent this particular addresses in network layer. So, if you receive a
packet at R with a destination address as with destination address as D, then you have to
decide that what should be the suitable next hop to forward that packet; whether you
want to forward that packet to this router or whether you want to forward this packet to
this router.

So, that is the task of the prime task of the network layer. So, the network layer need to
design a particular protocol which we call as the routing protocol to make this decision in
the internet. So, that is the broad objective of the network layer.

Now, in network layer this unreliable datagram delivery service, which is being provided
that has 2 primary basis. One is first you have to uniquely identify every individual host
in the network. And for that you need to have one addressing mechanism. So, first we
will look into that at a typical internet how we individually identify a particular node.

So, you can you can here you can think of this entire packet delivery in the network in
the form of our normal mail delivery or the postal mail delivery. In case of our postal
mail delivery you require a particular addressing format. In you in that address you have

555
your name followed by your, house number followed by your locality name of your
locality, then the name of your village or the city a particular pin code, then the name of
your state finally, if you are making a international postal mail transfer the name of your
country.

So, all these things this entire address actually hierarchically determine that where to
forward that particular postal email. Similarly, in the network whenever we talk about the
addressing scheme, we have to design this addressing scheme in a hierarchical way. So,
we will go to all these details sometime later, but the basic message that I want to give to
you is that, this entire packet delivery in the network it follows the similar principle of
what we apply in case of our postal email delivery.

So, we have a addressing concept, a particular addressing format that need to be used to
forward the data packet or that need to be used to uniquely identify every individual node
in the network. And then you need to have one routing mechanism, to decide that given a
destination address, how will you forward the packet over the network, over multiple
hops so that you can be able to successfully deliver the packet to the final destination.

(Refer Slide Time: 14:15)

So, if you try to compare it with the normal postal mail delivery system, so, in case of
your postal mail delivery system, say if my postal mail id is that say Sandip Chakraborty,
that means, my name followed by say my office number, then department of CSE IIT,
Kharagpur, West Bengal, India.

556
Now, this is my postal mail address and in this postal mail address there is a kind of
hierarchical notion. So, whenever someone is wanting to forward a postal mail to my
address, they have to fast forward it to the say head post office of India. Then from there
it will be forwarded to West Bengal, from there it will be forwarded to say Kharagpur.
From Kharagpur it will be forwarded to IIT, Kharagpur and then finally, it will be
forwarded to my office which is in my name.

So, that way in a hierarchical way this entire postal mail is being forwarded. And
whenever we apply this routing mechanism over the internet we also apply this kind of
hierarchical concept. So, in this entire discussion of network layer protocols, we will
look into that first of all how will you individually identify every host with certain
address which has this kind of hierarchical nature and number two, given a address in
this hierarchical format how will you decide where to forward a particular packet.

So, that are the broad services which are being provided by the network layer or the
internet layer.

(Refer Slide Time: 16:09)

Now let us briefly look into this entire internet architecture because that has the notion or
that has the concept which you will require to identify or to understand that how a packet
is being forwarded between 2 machines. Say, whenever you are accessing dub dub dub
dot google dot com your google machine is possibly residing somewhere in USA and
you are trying to connect it. Say if I am trying to connect to google machine right now, I

557
will be connecting that google machine which is residing at USA from a machine which
is there in Kharagpur.

Now, from Kharagpur to USA how will you forward the data packet that is our concern.
So, for that let us look into that how this entire internet is organized in a hierarchical
way, that will give you, give us an intuition about how will you actually address a
particular machine in the internet. So, I am I am just starting from a very small network
then gradually I will increase the network in size. So, let us start with a 2 different
laboratories in our computer science department at IIT, Kharagpur. So, we have 2
different software labs software lab 1 and software lab 2.

So, in software lab 1 we have certain set of desktop on software lab 2 we have another
set of desktops. Now, this software lab 1 they form a local area network, because they are
connected by layer 2 devices or the layer 2 switches, they are directly connected in one
hop distance. So, they form a, they form a local area network. Then the software lab 2
they form another local area network by connecting the machines through one layer to
switch.

Now, these two software lab 2 software lab 1 and software lab 2, they are connected with
each other via layer 3 device or a router. So, this router here is a layer 3 switch or a layer
3 device, right. Now, here by connecting to different local area network or lan 1 and lan 2
I have constructed one network which is the computer science and engineering network
at IIT, Kharagpur.

Now, from here if we further expand the network; so, we have multiple departments in
the institute in IIT, Kharagpur.

558
(Refer Slide Time: 18:23)

So, every individual department have their networks. So, that way we have constructed
the CSE network the computer science department network; which has the software lab 1
software lab 2 and they may have another network like the faculty network, the student
network, the research lab networks, all these form under this CSE network they are
connected by individual layer 3 routers. And then I have this network at the electrical
department EEE network, there you we have 2 different labs, EE lab 1 and EE lab 2 in
the similar fashion that the CSE network is connected.

Now, these 2 network, the CSE network and the EE network, they are again connected
via another router or another layer 3 devices. So, this is my layer 3 switch or the router
which is connecting the CSE network with the EEE network and this entire network -
that means, the individual departmental network. So, this is just a snapshot of the
example so that way I have multiple other networks like say, mechanical network, the
mechanical department network, then different home network or the administrative
network.

So, all this different network which are there inside IIT, Kharagpur, they are getting
interconnected with each other with this layer 3 switches or routers and they form the
entire IIT, Kharagpur network.

559
(Refer Slide Time: 19:51)

Now in India we have multiple such institutes. So, in IIT, Kharagpur we have this way
one network, then in IIT, Bhubaneshwar there is another network. Every network has this
way the hierarchical way in a top down approach.

Now, these 2 network the IIT, Kharagpur network IIT, Bhubaneshwar network as well as
say IIT, Mumbai network IIT, Kanpur network all those networks are connected with
each other through multiple such again layer 3 devices or the routers and they formed a
ERNET network. So, education and research network of India. So, this ERNET it is
basically government initiative to interconnect different such networks or different
educational institute altogether. So, we call it as educational and research network of
India so that way the name ERNET came from.

So, these ERNET network they interconnects all these different network together.

560
(Refer Slide Time: 20:52)

(Refer Slide Time: 20:55)

Now if we again go up to the hierarchy I have this ERNET network which interconnects
multiple such institutes and several other networks; say, the BSNL network. So, this
BSNL network has their public network and the corporate network you have the Airtel
network you have say Vodafone network; all these networks they are inside internet they
are again connected with each other. And they get the service from in India from Bharti
Airtel.

561
So, all of them are connected under this Bharti Airtel network. So, that way this entire
internet architecture they follows a hierarchical fashion or a hierarchical architecture. So,
that is the thing that is the entire architecture of the internet and inside this internet the
individual network that we are talking about; where the network is solely managed by
one administrator or one or multiple administrators we call them as autonomous system.

So, formally an autonomous system is a set of local area network for an administrative
domain, identified by a unique autonomous system number and the routing policies are
inside that autonomous system are controlled by a single administrator. Now in internet
one interesting idea is this routing policy, that so, as I have mentioned earlier that
whenever you are deciding about how to forward your packet from one machine to
another machine. And if you represent this entire internet in a graph structure, then the
interesting factor comes that how will you assign the link weight, that what will be your
metric for deciding the best routing.

Now, this metric for deciding the best routing that can be independently chosen by the
corresponding network administrators. So, that’s why in case of the definition of
autonomous system, we say that this routing policies they are controlled by a single
administrator. So, in general inside an autonomous system we follow a single routing
policy, but well there can be autonomous system where multiple routing policies are
followed altogether. And this entire ISP structure they form a nice hierarchical
architecture.

562
(Refer Slide Time: 23:12)

And if you look into this autonomous system graph for India it looks something like this.
So, this edge this dark edges they are actually individual number. So, you can go to this
site labs dot apnic dot net.

So, this apnic they actually maintain autonomous system inside India. So, these nodes
are the edge nodes edge nodes in the autonomous system and this is the nodes which are
there in the middle, this nodes they actually provide service to all other nodes. So, they
are the kind of central nodes, from where all the different other autonomous systems they
are getting their service.

So, for example, all the educational institutes like all the IITs the central universities,
they get the service from this ERNET India. So, that way this entire hierarchy is being
formed for the autonomous systems.

563
(Refer Slide Time: 24:12)

And this Tier architecture looks something like this. So, here we have the internet service
providers. The internet service providers are the autonomous system that provides
internet connectivity to another group of autonomous systems of the end users.

So, here we have the end users the end users in the internet. Now, this end users of the
internet they are connected to certain ISPs; Internet Service Providers, they are kind of
tier 3 network or tier 3 autonomous system. From there, so, here we have these 2 tier 3
autonomous systems in this diagram in this particular diagram. So, they are providing
services to these internet users.

Now, this tier 3 networks they are getting services from some 2 ISPs, now the tier 2 ISPs
they are getting services from the tier one ISPs. So, this tier 2 ISPs say if I just give you
an example so, the students inside IIT, Kharagpur they are getting the services from IIT,
Kharagpur autonomous system. Now this IIT, Kharagpur autonomous system they are
getting services from ERNET India the autonomous system.

Now, ERNET India autonomous system, they are getting services from say Bharti Airtel
autonomous system. Then this these are the kind of country level autonomous systems
and multiple country autonomous systems are interconnected with each other. And in a
tier 2 network we have certain small networks which we call as the point of presence or
pop this point of presence are kind of the edge network, which actually takes the service,
but do not provide the service to others.

564
So, these are kind of reserved network or some kind of special purpose network; say for
example, the military network. The military network is just used for their internal use and
they doesn’t provide services to any other. So, that is a kind of point of presence which is
directly connected to the central network of India. OK.

(Refer Slide Time: 26:18)

So, this ISPs so, if we just hierarchically try to arrange this individual ISPs. So, at the
bottom level we have this local ISPs like this Airtel, Vodafone, ERNET all these are the
kind of local ISPs. Then this local ISPs they get the services from the regional ISPs. So,
this regional ISPs they can have connectivity between themselves. So, sometime you
have seen that well Airtel announces that well if you use Vodafone and if you try to
transfer data from Vodafone to Airtel you will have a lower charge compared to if you try
to use some other network.

So, those kind of charge issues they come from this private peering relationship. So, if 2
service providers they are having private peering; that means, they can directly share the
data among themselves which actually reduces the charging policy which is being there
in different ISPs. So, those kind of peering we call it or we term it as a private peering.
Now this regional ISP, they are connected with the network service provider or the NSP.
So, this network service providers are the country level service providers. They are
connected to with internet exchange points.

565
So, all the different national level ISPs or the NSPs they connected with each other
globally with this network exchange points. So, this network exchange point actually
helps you to transfer a packet from say from India to USA. So, India has one country
level ISP or the NSP, USA have one or more country level ISP or NSP. They are
connected to this internet exchange point and this internet exchange point, helps you to
transfer the data.

So, one example is this the transatlantic lines. So, this transatlantic lines, they
interconnect the European continent with the US continent and the through high speed
internet or high speed optical fiber cable; which are going through the Atlantic Ocean.
So, they are one example of internet exchange point, which actually interconnects 2
different national level ISPs. OK.

(Refer Slide Time: 28:37)

Now, whenever you are forwarding the packet; so, the packet goes in this way so from
your machine the packet goes to the local ISP. Now from this local ISP it goes to the
regional ISP, from regional ISP it goes to the national ISP or the NSP, from there it goes
to the transit ISP. Now, via this transit ISP it reaches to the final destination transit ISP,
from there to the national ISP again to the regional ISP to the local ISP and finally, to
your destination machine.

So, that way in a hierarchical fashion the packet is being forwarded, the way we forward
the normal postal mail. Say, whenever you are forwarding a postal mail from India to

566
USA. So, you forward it to your local post office; the local post office forward it to the
regional post office, the regional post office forward it to the country level central post
office; the central post office then forward it to that say the USA post. The USA post,
again, in the state level then the regional level then your local level and then finally, the
things are getting delivered.

So, the similar concept is being used in the internet. Now all this individual ISPs are
nothing but a set of computers which are connected via lan. So, the initial diagram that I
have shown that the way this entire ISP architecture is build up, starting from this
software labs in the CSC department to the entire CSC department network and other
department then the IIT, Kharagpur network, then the ERNET network and that way the
entire thing grows up. So, all this individual ISPs are like that connections of networks.

(Refer Slide Time: 30:13)

Well, now the thing is that so, the first requirement that we have looked into that, how
will you address a particular machine in this kind of architecture. So, this addressed
scheme actually comes from this hierarchical concept.

So, whenever you want to forward a packet from say host 1 to host 2, you need to
forward the data packet from one network to another network via multiple other such
intermediate networks. So, here as I have mentioned that every autonomous system has a
unique autonomous system numbers. So, to say this numbers denote the autonomous
system numbers 10, 11, 12 and 13.

567
Now, one host is connected to autonomous system 10 your destination is connected to
autonomous system 12. And whenever you are forwarding a packet, you are forwarding
the packet from basically from this network the network of as 10 to the network of as 12,
via either the network of as 11 or network of as 13. So, whether you are going to use, as
11 as your intermediate network or as 13 as your intermediate network, that will be
decided by your routing protocol. So, that is one requirement.

(Refer Slide Time: 31:25)

The second requirement the interesting fact is that the address that you are going to
provide every individual host, that particular address should identify a network, as well
as a unique host inside the network. So, whenever you are forwarding a packet so,
whenever you are forwarding a packet say from IIT, Kharagpur to IIT, Bombay the
postmaster first need to understand IIT, Bombay.

So, once the mail is being delivered at IIT, Bombay local post office; from IIT,
Kharagpur post office then the Bombay post office will try to uniquely identify that
person inside IIT, Bombay and deliver the mail to that particular person. So, similar
concept is applied here.

So, first the network will try to find out that well this particular host is inside as 12. So, I
need to forward the packet to as 12. So, once the packet is being forwarded to as 12, then
you have to uniquely identify that which host inside as 12 need that packet or is the final
destination of that packet.

568
So, that is why, the network address that you are going to design, that should identify the
network as well as the host inside the network. So, you can have multiple host inside
autonomous system 12. So, you have to identify autonomous system and at the same
time this individual hosts inside the autonomous system.

So, in the next class, we will look into that how we can use a hierarchical addressing
mechanism in network layer based on that widely used network protocol that we call as
the IP protocol or IP to design such kind of address. So, see you again in the next class.

Thank you.

569
Computer Networks And Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science And engineering
Indian Institute of Technology, Kharagpur

Lecture – 27
IP Addressing (IPv4) I – Classful Addressing

(Refer Slide Time: 00:34)

Welcome back to the course on Computer Network and the Internet Protocols. So, in the
last class, we have looked into the basic internet architecture or in the terms of
autonomous system and internet service providers. And we are discussing about the
requirement for network addressing.

So, in this particular lecture, we will look into that how will you uniquely identify a
particular host inside the network using this concept of IP addresses. So, here we look
into the IP version 4 or IPv4 as we call it in short. So, this internet protocol or the IP
traditionally or the initial version of IP was IP version 4, and now it is also most of the
time we use IPv4.

And from IPv4, there was another version of IP which people have explored, which is
not generally used, but in many of the cases or in many of the countries that particular
version of IPs are also being used, so that is being called as IP version 6 or IPv6 in short.
So, we will first look into IPv4 in details, and then we will go to go to the details of IP
version 6 or IPv6.

570
(Refer Slide Time: 01:36)

So, in IPv4, so let us look into that how a particular address is being done. So, as you are
mentioning that the requirement for IP addressing is that the address should identify a
network as well as an unique host inside that particular network. So, it need to identify
the network as well as the host inside the network uniquely. So, you have a component
for the network address, and you should have a component to uniquely identify a host
inside the network, so the way we do the postal address.

And so, in case of a postal addressing, we use this name of the locations like this India
inside that West Bengal, inside that Kharagpur or in the district term say west
Midnapore, from there it is a Kharagpur, then from Kharagpur to IIT Kharagpur and then
finally, Sandip Chakraborty. So, that way this entire hierarchical way is helped to
uniquely identify a person in a postal mail. Similarly, this hierarchical way will help into
uniquely identify a host in a network. So, let us look into that how this basic hierarchic of
addressing is being done in IPv4.

571
(Refer Slide Time: 02:53)

So, the whole idea is to break, this entire address space into two groups, one group is for
the network address part, and the second group is for the host address part. So, in IPv4,
we used 32 bits for identifying a address of a host. So, this 32 bit address is divided into
the network address part and the host address part.

Now, the old idea was divide that how will you divide this entire 32 bit into the network
address and the host address. So, the old idea was to use something called a classful
addressing, where you have fixed number of bits for this network address component,
and the remaining bits was for the host address component. So, you have a fixed division
between the network and the host. And accordingly, the entire address space is divided
into multiple classes, so that particular concept we used to call as classful addressing.

So, although nowadays we do not use this classful addressing concept, but this idea of
classful addressing is useful for you to understand that what we are actually using
nowadays. So, this entire philosophy of IP address is come from this classful addressing
concepts. So, let us look into this classful addressing concept in little details.

572
(Refer Slide Time: 04:18)

So, in class full addressing, this is the broad concept that I have the 32 bit address, this
entire 32 bit address space, I will divide it into the network address and the host address.
And we have five different classes from class A, class B, class C, class D, and class E, so
this five different classes of addresses.

Now, the first question comes that whenever you are dividing this entire address space
into five different classes: class A, class B, class C, class D, and class E, then how will
you uniquely identify this individual classes. So, for that, what we do in classful
addressing, in classful addressing, we use the first few bits.

So, if your first bit is 0, then it is a class A address. If the first two bits are 1 and 0, then it
is class B address. If the first three bits are 1 1 0, it is a class C address. If they are 1 1 1
0, it is a class D address. And if it is 1 1 1 1, then it is a class E address. Now,
interestingly here you can see that none of these words or none of these identifier for a
class is a proper prefix of another. So, whenever you are trying to scan these 32 bits of
bit stream, if you find out that the first bit is 0 that means, it is a class A address.

If the first bit is 1, then you look into the second bit. If the second bit is 0, then it is class
B IP address. If the second bit is 1, then you look into the third bit. If the third bit is 0,
then it is class C IP address. If the third bit is 1, then you look into the fourth bit. If the
fourth bit is 0, then it is class D IP address. If the fourth bit is 1, then it is class E IP
address. So that way just by scanning the bits, so doing a bit shift operation, and then

573
doing a logical ANDing (Refer Time: 06:13) you will be able to find out that what is the
corresponding class of IP address that you are being used.

Now, for this five different classes of address, you have this kind of network address and
the host address division part. But, even before going to that, in IP based protocol, we
have a concept of multicast. So, what is this, is multicast that some time it is required to
send a packet not to a single destination, rather a group of destinations. So, you have a
group of machines, which are being identified by a single address. And whenever you are
trying to send a packet, the packet will be delivered to all the machines in that group.

So, it is similar to like a broadcast mail or sometime we call it as a multicast mail. So, in
case of a multicast mail, say if you want to send it to all the B.Tech students or the CSE
department, so your address would be to all B.Tech students, department of CSE, IIT
Kharagpur, Kharagpur 721302, West Bengal, India.

If you are sending a letter by this address that means, a copy of that letter will be sent to
all the B.Tech students, which are there in, who are there in the Computer Science
Department of IIT Kharagpur, so that is the concept of multicast. And IP also uses this
concept of multicast, and keep provisioning for using multicast IP addresses. So, this
class D addresses are multicast addresses. And with this initial bits that the initial bits as
1 1 1 0. So, this multicast addresses start from 224 dot 0 dot 0 dot 0 to 239 dot 255 dot
255 dot 255.

(Refer Slide Time: 08:13)

574
So, just for this notation briefly, if you are not familiar with this particular notation, so
what we do that this entire 32 bit IP address, this 32 bit IP address we divide into 8 bit
chunks. So, if we divide into 8 bit chunks, we will have four different chunks of 8 bits.
So, this is the first chunk, this is the it is a second 8 bit chunk, this is the third 8 bit
chunk, and this is the fourth 8 bit chunk. So, every individual chunk is a 8 bit chunk. So,
you have some 8 bit say 1 0 1 1 1 0 1 1, 1 0 0 0 1 0 0 0, 0 1 1 0 0 1 1 1, 1 0 1 0 1 1 0 0
something like this.

Now, in that the representation of the IP address, we write it in the dotted decimal format.
What is this dotted decimal format, the dotted decimal format is that for this 8 bits, we
represent this 8 bit binary in a 8 bit integer. So, we represent it in a 8 bit integer, and then
put a dot, then again represent this as 8 bit integer, so this 8 bit integer, again a dot, the
third 8 bit integer a dot and a final 8 bit integer. So that way an IP address looks like
something like 203 dot 110 dot 30 dot 42. So, each of these are 8 bit integers.

Now, if it is a 8 bit integer that means, a maximum you can have up to 2 to the power 8,
so you can go up to that, so 2 to the power 8. So, if you if you start with all 1s, then that
is the maximum. And the minimum is so, 1 2 3 4, 1 2 3 4, you can go from all 1’s to all
0’s.

So, if you have all 1’s that means, it is it comes to be 255, 2 to the power 8 minus 1, so it
comes to be 255. So, these individual dotted decimals, they go from 0 to 255. So, the
every individual chunk can go from 0 to 255, so that is the way we represent the entire IP
address in the dotted decimal format.

Now, in this dotted decimal format, the multicast IP addresses they range from 224 dot 0
dot 0 dot 0 to 239 dot 255 dot 255 dot 255. So, 224 corresponds to these four g 1 1 1 0
followed by again four 0’s. And 239 corresponds to 1 1 1 0, so that means, it is from 1 1
1 0 0 0 0 0 that would be the first chunk dot the remaining things, then 1 1 1 0 1 1 1 1, so
that corresponds to 239. So, it moves from 224 to 239 that is the multicast use.

This class E IP addresses, they are reserved for future use, they are not normally used.
So, it is from 240 dot 0 dot 0 dot 0 to 255 dot 255 dot 255 dot 255. So, they are reserved
for future use. The other three classes of IP addresses class A, class B, and class C, they
are divided into the network address and the host address part.

575
(Refer Slide Time: 12:06)

Now in case of class A IP address, we have 24 bit in case of class A in case of class A, it
was 24 bit host address. And 8 bit of network address out of which 1 0 was reserved for
denoting class A, so you have a total of 7 bit. In case of class B IP address, you have 16
bit of host address, and then 16 bit for the network address. So, out of this 16 bit, two bits
are reserved for denoting it as a class B, so you can have a total of 14 bit.

In case of class C IP address, you have 8 bit of host address. So, whenever you have a 8
bit of host address in the network address part, you can have 32 bit. Out of this 32 bit
sorry you have 24 bit. Out of this 24 bit, you have 3 bits results. So, whenever you have
3-bits result, the remaining bits you can use for the network IP part.

576
(Refer Slide Time: 13:22)

Now, in this case, you can see that class A, it supports maximum number of hosts, so
class A supports maximum number of host. So, the supported host can be as high as so, if
we are using 24 bit host address for class A. So, the supported number of host can be as
high as 2 to the power 24. Obviously, it is not exactly equal to 2 to the power 24, we will
later on look into that there are certain reserved IP addresses.

So, it is slightly less than 2 to the power 24, but close to 2 to the power 24. So, in case of
class A you can support close to 2 to the power 24 number of host. In case of class B,
you can support close to 2 to the power 16 number of host because you have a 16 bit of
host address. In case of class C, you can support around 2 to the power 8 number of host
close to the power 8 number of host, because you have a 8 bit of host address, well.

577
(Refer Slide Time: 14:12)

So, the question is that this network address, it is used to identify a network. And this
host address part it is used to uniquely identify a host inside a network. Now, we have in
every individual class of IP addresses, we have two special address; one address we call
as the network address, and the second address we call it as a broadcast address.

So, the network address is the part when where we have all 0’s in the host address part.
So, it is used to uniquely identify a network. So, a class A network is identified as all the
0’s in the host part. So, in case of class A, you will have 24 number of 0’s in the host
part; and you will have this 8 bits at the network part with this initial reserved 0.

So, this entire thing which is in dotted decimal format 126 dot 0 dot 0 dot 0 that uniquely
identify a class A network. Similarly, a class B network, you have all these host address
part the 16 bits they are equal to 0. So, they 0’s and the initial two bits are 1 0, then the
remaining part your network address part. So, in the dotted decimal format it is 189 dot
233 dot 0 dot 0 that denotes class B network address.

Similarly, we have a broadcast address. So, a broadcast address means if you send the
packet, send the IP datagram with that particular address as the destination address. So,
with this broadcast address at the destination address, that means, all the host in that
network will get that packet, so that is why we call it as a broadcast address.

578
So, in case of broadcast address, the broadcast addresses are denoted as all 1’s in the host
address part. So, in case of broadcast address, you have all the 1’s in the host address
part. So, in case of a class A broadcast address, you have so you it corresponds to this
126 dot 0 dot 0 this dot 126 dot 0 dot 0 dot 0 this network address, you have these all the
1’s in the host address part that means, 126 dot 255 dot 255 dot 255 as the broadcast
address.

Similarly, for the class B network, 189 dot 233 dot 0 dot 0 if you put all 1’s at the host
address part that means, it corresponds to the broadcast address for this network. So, the
broadcast address for 189 dot 233 dot 0 dot 0 is 189 dot 233 dot 255 dot 255, so that way
for every individual network address you should not put all the 0’s in the host address
part or all the 1’s in the host address part. So, these two are being omitted, because these
two are being omitted. So, this all 0’s and all 1’s are not used as a host address. So, if you
just take a class A IP address, and if I ask you that how many number of valid host can be
there in case of a class A IP address. So, we can compute it like this way.

(Refer Slide Time: 17:41)

Say for a class A IP address, I have 24 bits in the host address part. Whenever you have
24 bits in the host address, that means, your number of valid host for a class A IP address
is 2 to the power 24 minus 2. So, these 2’s are we are omitting all 0’s and all 1’s in the
host address part. So, all 0’s which is to denote the network address.

579
(Refer Slide Time: 18:35)

And all 1’s which is to denote all 1’s to denote the network address. So, these two are
omitted. Now, in case of so that was for a class A IP address. So, in case of a class A IP
address we are omitting all 0’s and all 1’s. So, we have a 2 to the power 24 minus 2
number of valid hosts in a class A IP address.

(Refer Slide Time: 19:09)

Similarly, if you go for class B IP address, in a class B IP address, you have 16 bits for
the hosts, so; that means the number of valid hosts are 2 to the power 16 minus 2. Again

580
for these two we are omitting all 1’s which is the broadcast address; and all 0’s which is
the network address.

For a class C IP address, you have 8 bits in host. So, because you have 8 bits in host, so
the number of valid address is 2 to the power 8 minus 2. So, this 2 is again omitting all
1’s and all 0’s. So, every time for a particular network address, we should not use all 0’s
at the host address part or all 1’s at the host address part, because these two denotes the
special addresses of the network address and the broadcast address.

So, if all 1’s at the host address part is a broadcast address, where the packet is being
forwarded to all the host in that network. And in a in case of a all 0’s that is a special
address which is used to denote that particular network. So, the utility of this network
address we look into that when we discuss about this routing procedure.

(Refer Slide Time: 20:52)

Now, one interesting question say you have to 255 number of host in the network. Now,
the question comes that which IPv4 address class you should use. So, whether you
should use a class C IP address or you should use a class B IP address. Now, if you look
into a class C IP address in case of a class C IP address, you have 8 bits in the host pace.
So, for a class C IP address, your number of valid host is 2 to the power 8 minus 2 which
is equal to 256 minus 2 that is equal to 254. So, you have 254 number of valid hosts.

581
So, whenever you have 254 number of valid host in case of a class C IP address, and you
want to support 255 number of host, obviously, we will not be able to support that with a
class C IP address, so that class C IP address is not possible in this case.

(Refer Slide Time: 21:52)

But, if you use a class B IP address, in case of a class B IP B IP address, you can support
2 the power minus 16 number of different host, but here you are just using 255 addresses.
So, you are using only 255 address, in 255 different addresses out of possible 2 the
power 16 minus 2 addresses, so that is you are losing or you are wasting a huge address
space. So, that was the major problem with the classful IP address that was initially
designed as a part of IPv4 addressing mechanism.

So, that is why from this classful addressing we are moving towards a direction which
we call as the classless addressing or it is recently called as classless inter domain routing
or CIDR. Now, the idea of CIDR is that you can split a large network into multiple small
networks or you can combine multiple small networks together to have a larger network.
So, that you can provide a handful of IP addresses to the hosts inside that network.

582
(Refer Slide Time: 23:09)

So, for that we have these two different concepts sub netting and super netting. So, the
idea of sub netting is to divide a large network into multiple small networks and a idea of
super netting is to combine multiple small networks into a single large network. So, this
concept of sub netting and super netting together they form this concept of classless inter
domain routing or the CIDR.

So, the CIDR is the concept used for the routing mechanism by utilizing this classless
addressing scheme that we will look later on. But the idea here is that rather than binding
the class boundary at 8 bit, 16 bit or 24 bit, can I use something in middle. So, can I
combine multiple smaller subnets together to form a larger subnet, which we call as
super netting or can I break a large subnet into multiple small subnet and then allocate IP
addresses or 1 class of IP address to individual subnets so that is the concept of sub
netting.

So, this concept of sub netting and super netting leads to another thing like now we do
not have a fixed class boundary. Whenever do you do not have a fixed class boundary,
you need to have another information to determine that what is your class boundary. So,
to determine the class boundary we used the concept called the subnet mask. So, this
subnet mask it denote the number of bits in the network address field.

So, right now you are not going to use this 8, 16 or 24 bit fixed numbers in subnet mask,
rather the things are variable, because the things are variable your subnet mask actually

583
determining that how many numbers are there in your address space which is
determining a subnet or the corresponding network IP address.

(Refer Slide Time: 24:59)

So, let us look into the entire thing. So, in case of your classful IP addresses, you had the
network prefix along with the host number. So, this entire host number space is now
divided into subnet number and the host number. So, this original network prefix from
classful addressing and a subnet number that together gives you the subnet IP. So, this
subnet IP is the IP of the network on which your machine belongs to.

So, now we are not using this fixed networks rather we are saying that a network consist
of multiple subnets in a hierarchical fashion. So, the subnets are being combined together
form a network and that network work as a subnet in the next layer, so that way it is
multiple subnets are there, they are again getting combined and forming another set of
another network, and that hierarchical fashion is going on. And this entire network prefix
and the subnet number that forms this entire team forms your subnet IP and then you
have the host number field. So, we are taking certain bits from the host numbers to
denote the subnet number.

584
(Refer Slide Time: 26:16)

So, here is one example. So, in case of your IP address say these are this is your IP
address, in this four 8 bit chunks. And as I mentioned that you require this netmask or
subnet mask to determine that how many number of bits are there to denote your network
IP or the subnet IP.

Now, we use the term network and the subnet interchangeably. So, you have this subnet
addressing part. So, this subnet mask determines that well, the subnet mask is again a 32
bit binary, where there are few consecutive 1’s and then few consecutive 0’s. So, these
few consecutive 1’s determines that well up to this part is your subnet address. So, if you
think about a class A IP address, in case of class A IP address, this was your network
address; in case of class B this was your network address boundary; in case class C, this
was your network address boundary. Now, we are not using those fixed boundary rather a
variable boundary in that variable boundary this subnet mask the where we have all 1’s.
So, this all 1’s denote that this many number of bits are your subnet IP belongs to that
determines your subnet IP.

585
(Refer Slide Time: 27:54)

So, in CIDR addressing format, we write the IP address in this format. So, we have the IP
address in the dotted decimal format followed by slash some number. So, this number
determines that how many bits in the subnet mask are 1, so that means, if I my address is
191 dot 180 dot 235 dot slash 12; that means, the first 12 bits are the network address
and the remaining 20 bits are the host address.

So, the first 12 bits of network address means my subnet mask would be the first 12 bit
will be 1; and the remaining bits will be another 8 bits remaining bits will be 0. So, I will
have 12 number of bits first 12 number of bits as 1’s in the subnet mask; and remaining
20 number of bits are 0’s. So, this determined that well the first 12 bits denotes my
subnet IP.

586
(Refer Slide Time: 29:07)

OK. So, in case of CIDR if you have done this manual IP, manual IP setting in different
operating systems, so you have to provide the IP address and the corresponding subnet
mask. And you will see that here the subnet mask is 255 dot 255 dot 255 dot 0 that
means, that 24 bits the first 24 bits are the subnet IP; and the remaining 8 bits are used to
denote the host address.

So, in this particular IP address, from this particular IP address, you can determine that
because this first 24 bits are my network IP so the network IPs 192 dot 168 dot 1 dot 0
under this network it is number 50 host is identified by this IP address. So that is the
beauty of the subnet mask. Similarly, whenever you are setting up the things in Linux
you can also set it with this net mask field. So, this word subnet mask and netmask are
used interchangeably. In Windows, we use the term subnet mask; and in Linux we use
the term net mask.

So, that is the broad idea about the way you give allocate IP addresses to different
machines. In the next class, we look into 1 specific example of this CIDR with
subnetting and supernetting that given a IP address pool, how can you divide that IP
address pool into multiple subnet and then allocate IP addresses to different host inside
that subnet, that is that we will discuss in the next class.

So, thank you all for attending this class today.

587
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and engineering
Indian Institute of Technology, Kharagpur

Lecture – 28
IP Addressing (IPv4) II – (CIDR)

(Refer Slide Time: 00:23)

Welcome back to the course on Computer Network and the Internet Protocols. So, in the
last class, we are looking into this concept of IPv4 addressing, and we have looked into
the concept of classful and the classless addressing scheme with the help of subnetting
and the supernetting. So, today we will look into a specific example about the subnetting
and supernetting, and given a larger address pool, how can you construct multiple
subnets out of that particular address pool.

588
(Refer Slide Time: 00:51)

So, we have looked into this basic addressing format in CIDR. So, you have a IP address
and a corresponding subnet mask. The subnet mask determines that how many number of
bits are there in your subnet IP field. So, here in this particular example your this many
number of first 8 plus 4 that 12 bits are your network IP, and the remaining bits are for
the host address. So, this gives your subnet boundary. So, this bits are for your subnet IP,
and the remaining bits are identifying the host inside that particular subnet.

(Refer Slide Time: 01:37)

589
So, let us look a few example of subnetting that how can you actually have this kind of
hierarchical addressing concept in network. So, assume that the IP address of a network
is 203 dot 110 dot 0 dot 0 slash 16. So, this slash 16 in CIDR notation means you have
16 bits in the network IP field, and the remaining 32 minus 16 that means, the 16 bits are
for host addresses, so that is the address pool that is given to you.

(Refer Slide Time: 02:12)

Assume that is an organization network, this organization network it has this border
router from the central IP allocation authority. In case of India, it is a PNIC; from there,
they get this particular pool of IP address say 203 dot 110 dot 0 dot 0 slash 16, so, that is
the IP address, which is denoting this entire network.

Now, in this network, say the organization want to divide this network into three subnet.
So, inside this network I have say three subnets; this is one subnet that they want to
create, then this is another subnet that they want to create, and say a third subnet that
they want to create. So, they want to create these three subnets.

So, the question comes that how will you divide this entire address pool into three
different subnets. So, the first question comes that how many bits do you require to have
three subnets. So, to create three subnets indeed, we require 3 bits and not 2 bits. Why
not 2 bits, because we want to avoid again all zero’s and all one’s in the subnet
addressing field.

590
(Refer Slide Time: 03:48)

So, these 203 dot 110 dot 0 dot 0 slash 16 it says that well, these 203 dot 110, this part is
my network address part, then I have 16 different bits. So, I have 8 bits here followed by
8 bits here, this 8 bits plus 8 bit 16 bits I can use to create the subnets. Now, whenever I
am creating the subnet, if I have to create three subnets, I have to take certain number of
bits from the host.

So, whenever we are taking certain number of bits from the host to create three subnet,
we should not take 2 bits. So, because if you are taking 2 bits, your subnet IP so, say here
you are taking 2 bits if you are taking 2 bits here, so one subnet IP can be 0 1, then the
host address part, another one can be 1 0, then the host address part, the third one need to
be either 1 1 or 0 0. Say if you are using all one’s and all zero’s, then there are certain
problems. So, let us see what is the problem there.

591
(Refer Slide Time: 04:52)

So, the problem of all zero’s and all one subnets are something like this. Say if you are
using all 0s as a as a subnet IP, so here this particular router has the IP address of 192 dot
168 dot 0 0 slash 16. Now, say you create a subnet by taking this 0 at the subnet in the
indication part, so this one I want to divide into two subnet. Now, in this subnet, I am
using this 0 to denote one subnet, and this 1 to denote another subnet.

Now, if you use this 0 to denote this subnet, now considering the network address part
and the subnet part, I have 17 bit, which is being used for denoting this subnet. But,
interestingly if you use 0 as a identifier for this subnet, the network address for this
subnet is equal to the network address for the your original network.

So, the network address for this subnet will be 192 dots 168 dot 0 dot 0; the network
address for this subnet will also be 192 dot 168 dot 0 dot 0, and that is why we normally
refrain from using all 0 subnet. Because, if you are using all 0 subnet, we call it as subnet
0. So, if you are using all 0 subnet, then you may have a problem like the subnet IP
becomes equal to original to your the original network IP.

Similarly, for the all 1 subnets, here you see that whenever you are creating a subnet like
192 dot 168 dot 128 dot 0 slash 17. so here I am taking this 1 as the subnet identifier, the
subnet indicator. So, if I take this 1 as the subnet indicator, so in that case my subnet IP
comes to be 192 dot 168 dot 128 dot 0, so 1 followed by all 0s. If 1 is here then all 0s,
then this comes to be 128 in decimal format.

592
(Refer Slide Time: 07:09)

So, in that case if you try to find out the broadcast IP for this subnet, so the broadcast IP
for this subnet will be equal to all 1s in the host bits, then all 1s. So, this is equal to 255,
this is equal to 255. So, the broadcast IP for this subnet is 192 dot 168 dot 255 dot 255.

Now, what is the broadcast IP for the original subnet, so the broadcast IP for this original
subnet is again, because this is a 16 bit, so I need to make all these bits as 1. So, it is 192
dot 168 then all 1s and all 1s, so 192 168 dot 255 dot 255 that means, the broadcast IP for
this subnet becomes equal to the broadcast IP of the original subnet, so that is the
problem of all 1 subnet.

So, if you find out the broadcast IP for this subnet, the all 0 subnet that will be different
that will be equal to 192 dot 168 dot 0 then all 1s dot all 1s that would be different. But,
the problem is that the network IP for the subnet becomes equal to the network IP of the
original network that is the problem for subnet zero for subnet one or all one subnet. The
problem becomes that the broadcast IP for the original network becomes equal to the
broadcast IP of your subnet, so that is why we do not use the all zero’s and all one’s in a
subnet IP field.

So, in the previous case, again if you are going to use 2 bits to denote three subnets, then
either you have to use 0 0 as a part of the subnet or 0 1 as a part of your subnet IP. So,
you do not want to use that to avoid all zero’s and all one subnet. So, you can you need
to use three bits for doing this subnets.

593
(Refer Slide Time: 09:20)

Now, if you want to use three bits for doing this subnet, your subnet IP can have the IP of
1 0 0, subnet 2 can be 1 0 1, subnet 3 can be 1 1 0, and the remaining 13 bits can be used
to addressing the hosts inside those subnets. So, in that case, if you are using 1 0 0 as the
subnet IP, the subnets becomes 203 dot 110 dot 128 dot 0 slash 19 that is the yeah so that
is the subnet mask. Because, we are taking 3 bits from the host address to denote the
subnet, so the subnet mask becomes 16 plus 3 that is equal to 19.

The 2nd subnet if you are using 1 0 1, then the second subnet in the dotted decimal
format becomes 203 dot 110 dot 160, 1 0 1 followed by all 0s 0 slash 19. If you are
taking 1 1 0, it becomes 203 dot 110 dot 192, 1 1 0 followed by all 0s by a decimal
equivalent of 192 followed by 0 slash 19. So that way you can create three different
subnets out of the network IP that is given to you.

594
(Refer Slide Time: 10:36)

Now, let us see another concrete example of CIDR. So, I have taken an scenario of IIT
Kharagpur. So, this is our computer and informatics center. So, our CIC, they have taken
IP pool of from PNIC. Say the IP pool, they are getting is 203 dot 110 dot 0 dot 0 slash
19.

So, if this IP pool is given to them that means, the 19 bits are for the network address,
and then the remaining 32 minus 19 that means 13 bits, they can use for the host address.
Now, with this 13 bit at the host address which is their total inside IIT Kharagpur. Now,
assume that we are just concentrating on three different departments of IIT Kharagpur
CSE Computer Science, VGSOM Vinod Gupta School of Management, and Electrical
Engineering EE.

Now, assume that the CSE has 2000 host, VGSOM has 500 host, and EE has 500 host.
And with this 13 bit at the host field, you want to create three different subnet; one
subnet is for CSE, the second subnet is for VGSOM, and the third subnet is for EE. So,
the question comes that with this 13 bit, how will you do that.

595
(Refer Slide Time: 11:54)

So, first let us do an estimation that to address this many number of hosts, how many bits
do I require? Now, to address 2000 host, you require at least 11 bits, because 2 2 to the
power 11 becomes equal to 2. So, 2 to the power 11 is 2048. So, with 11 bits, you can
support 2000 number of host. And then 9 bit is required to support VGSOM. 9 bits
means you can support 512 minus 2 that means, 510 number of host, so that is for
VGSOM. Similarly, for EE, you require 9 bits.

(Refer Slide Time: 12:56)

596
Now, here you see that if you are the maximum number of bits that is required to having
this host is 11 bits. So, if that is the case, then if you are taking 11 bits to addressing the
host, then there are only 2 bits remaining, because here you can have a total of 13 bits
from this subnet mask. You can get a total of 13 bits to denote the host.

And out of the 13 bit if you require 11 bits to denote a host, only 2 bits are required for,
only 2 bits are remaining for doing the subnetting. And as we have looked earlier that
using 2 bits, you cannot do the subnetting properly. So, here we apply the concept of
supernetting. So, let us see that how we apply the concept of super netting here.

(Refer Slide Time: 13:25)

So, what we do, so that is the entire thing. So, our address space was 203 dot 110 dot 0
dot 0 slash 19. So, we have 13 bits, which are available to serve all the host of IITKGP
network, and we need to divide this address space among three subnets. And what we
have seen that CSE requires 11 bits, VGSOM requires 9 bits, and EE requires 9 bit for
their host address.

So, we have only 2 bit left for identify the three subnets. So, again to avoid all zero’s and
all one subnets, this is not possible. So, here we apply the concept of supernetting that
means we combine VGSOM and EE network together. So, if you combine VGSOM and
EE network together, let us see what happens.

597
(Refer Slide Time: 14:11)

So, we are combining VGSOM and EE together. So, together, now they have they have
500 plus 500 that means, 1000 number of host, and to address those 1000 number of
host, 10 bit at the host address space is sufficient. And now, with the remaining 2 bit, you
can always divide it into two different subnets.

So, what we are doing here, we are putting this additional router here in between that
router is helping me to treat this entire subnet as a this combination of these two subnet
as a entire (Refer Time: 14:50) network. So, now I need to, I do not need to divide it into
three subnet from here, I need to divide it into two subnet. And using 2 bit, I can safely
divide it into two subnets.

598
(Refer Slide Time: 15:05)

So, what I can do that now CSE requires 11 bits, VGSOM plus EE together, they require
10 bits. So, with 11 bits, I can serve all the host. So, what I do that; that was my original
network address 203 dot 110 dot 0 dot 0 slash 19. So, with 19, so this is up to my
network address place, and this X that we can use as the host and a subnet. So, we take
these two bits.

So, using these two bit, we divide it into two different subnet; one subnet is for CSE,
another subnet is for this VGSOM plus EE. So, let us use 1 0 to denote the CSE network,
so in the place of these two bits. So, if I use 1 0 here, then I have this 8 plus 3 11 number
of bits available to address all the host in the CSE network. So, my IP address for the
CSE network becomes 203 dot 110 dot 16 dot 0 slash, now I have taken two bits here at
the network address space, so this becomes 19 plus 2 that is 21.

And the VGSOM plus EE network address, it becomes so, these 2 bits I am making them
as 0 1, so I am avoiding all 0s and all 1s here. And so, the VGSOM plus EE network that
is the combination of that subnets the supernet, they have the address of 203 dot 110 dot
8 dot 0 slash 21. So, 8 dot 0, because this 0, this 1, and then again all 0s in the place of X,
the way we get the network address for a particular subnet. So, we get this address for
the VGSOM plus EE network.

Now, so this is our scenario. So, this was my entire address pool. This entire address
pool, I have divided into two subnet, one subnet is going to CSE, and the second subnet

599
is going to VGSOM plus EE. Now, this second subnet again I have to divide it into so,
after this router, so this intermediate supernetting router that I have placed here. So, after
this router, I have to again divide this address pool into two different subnet; one subnet
is for VGSOM, another subnet is for EE.

So, here we see that well, the 21 bits have been used for the network address space. So, I
have 11 bit total 11 bits remaining. So, total 11 bits are remaining, and VGSOM requires
9 bits, and double E requires 9 bits. So, my life is simple here.

(Refer Slide Time: 18:05)

So, now VGSOM requires 9 bits, EE requires 9 bits. This is my network address. So, this
network address, these two bits I have already used in the previous step of subnetting to
make a combination of VGSOM plus EE network. Now, we use the next two bits. So,
this using this next two bits, I can differentiate between VGSOM network and the EE
network.

So, for the VGSOM network, I am giving a network IP of 1 0. And to the EE network, I
am giving a network IP of 0 1 to this XX (Refer Time: 18:43) place. And accordingly, I
get the VGSOM network address as 203 dot 110 dot 12 dot 0 slash 23. Earlier it was 21,
I am taking 2 bit from the host and putting it at the network, so the subnet mask becomes
23. And the double E network it becomes again 203 dot 110 dot 10 in the dotted decimal
format dot 0 slash 23.

600
So, that way, now I am able to with the help of the subnetting and supernetting I am able
to distribute this entire IP address space that was given to me into two different subnets,
so or three different subnets in a hierarchical way. So, initially we divide it into two
different subnet, where I have CSE in one side, and the combination of VGSOM plus EE
in another side. And in the next step, I have divided these, the second level of IP address
to the VGSOM network and the EE network.

So, that way in a hierarchical way, you can once you are getting a pool of IP addresses
for your institute, you can divide it into multiple molar subnets, and allocate the IP
addresses to the individual subnets. There is another interesting fact in CIDR, because
we do not have this kind of fixed class boundary, what we can do that we can use what
we say as the variable length subnetting.

(Refer Slide Time: 20:22)

So, we use something called a variable length subnetting. What is this variable length
subnetting? So in the earlier example in this particular example; if you look into this
particular example, here actually we are using something called a fixed length subletting.
So, what we are doing that whenever we are breaking this entire thing into two subnets,
for both the subnets, we are using slash 21 as the netmask.

Similarly, whenever in the second level, we are dividing it into VGSOM and EE, we are
again using for both the cases slash 23 the equal length or the similar length or the fixed
length subnet subnet mask or netmask. But, CIDR does not restrict you to use this kind

601
of fixed length subnet mask, you can always use variable length subnet mask that means,
for one subnet, you can have subnet mask of length n, for another subnet under the same
network, you can have subnet mask of say length (Refer Time: 21:31) m, which is
different from n.

(Refer Slide Time: 21:40)

So, let us see that how you can utilize variable length subnet mask for this particular
example, variable length subnet mask. So, let us see an example of variable length subnet
mask. So, assume that your network IP that was given to you is 202 dot 110 slash 0 slash
0 slash 20.

Now, with this, you have 20 bit at the network IP network address space network prefix.
So, you have 12 bits for hosts. See if you have 12 bits for host that means, you can
support 2 to the power 12 minus 2, this many number of host that means, equal to 1024
minus 2 1022 number of host.

Now, assume that you want to divide it into three different subnets with subnet 1 having
1000 hosts, subnet 2 having say 500 hosts, and subnet 3 having another 500 hosts. Now,
if this is the case, then for subnet 1 you require 10 bits, because 2 to the power 2 equal to
1024, for subnet 2 you require 9 bits, for subnet 3 you again require 9 bits.

Now, here’s you see that you have only 2 bits are available, if you are using 10 bits for
doing the subnetting. So, in case of if you want to use a fixed length subnet mask for all

602
the subnets, then you can at least keep provision for 1000 host for all the subnets that is
the maximum number of host, which is there in any of these three subnets S1, S2, and
S3.

So, in that allocation, you require 10 bits for the host address part, and 2 bits are
remaining for the network prefix. If 2 bits are remaining for the network prefix just by
avoiding all zero’s and all one subnet, you will not be able to do that, because with 2 bits,
you can you need to avoid 0 0 and 1 1 as the subnet prefix. But, using variable length
subnet mask, you can do that.

So, what will be that variable length subnet mask, say my network IP is 202 dot 110 now
for S1, what I do that I take 2 bits to denote the subnet mask. So, for S1, I am taking
these 2 bits, and then the remaining bits are host bits. The host bits I am writing as X 1,
2, 3, 4 dot X X X X X X X X. So, these can be the network address for S1.

Now, here what we are doing my net mask would be earlier it was 20, I am taking to 2
bits, so the netmask could be 22 bits. Then in the second case, for these two host, it is not
required that you have to use slash 22 as the netmask with the help of this variable length
subnet mask, which is being supported in CIDR.

So, what you can do, here you can take three bits, so while you are taking this 3 bits, you
need to be little cautious, let me say what is that. So, 202 dot 110 dot 1 0 1 then you take
1, 2, 3, 4, 5, 6, 7, 8 dot 1, 2, 3, 4, 5, 6, 7, 8 slash 23 as your net mask.

So, here I am taking 1 0 1, but whenever I am taking 1 0 1 the interesting fact is that this
1 0 1, so this 0 1 is not a prefix of this 1 0 1. So, if you take this 1 as 0 1 0 you see that 0
0 1 0 instead of taking 1 0 1, if you take 0 1 0, 0 1 0 can be a host of the subnet S1, so
that one we should not take. So, we should not take 0 1 0, so we should take something
which is not becoming a prefix of the regional one.

And for S3 similarly, I can make the subnet as 1 1 0 slash 1 0 0 10 slash 23, so that way
by using this variable and subnet variable and subnet mask, where I am using slash 22 as
the subnet mask here, slash 23 as the subnet mask here, and then again slash 23 as the
subnet mask. I will be able to solve this IP allocation problem, which was not possible
with this fixed length subnet mask, so that is one of the advantage of CIDR.

603
So, these examples that I have discussed today so, these examples give you an idea about
how you can effectively do IP allocation to a machine using this IPv4 addressing scheme
of a host in a network. By considering this IP hierarchy, where you have this concept of
network address which will uniquely identify a network. And then the host address,
which will uniquely identify a host inside that network, so that is the way we use this
concept of address hierarchy to provide unique addresses to or unique IPv4 addresses to
all the host inside a network.

In the next class, we will look into the routing mechanism the CIDR routing mechanism,
which is being utilized on by using this IPv4 addressing. And we will also look into that
how you can effectively utilize IPv4 addresses with the help of a concept called network
address translation. And we look into the concept of IP version 6 in brief, and give you a
little bit overview about what a IPv6 is and how it is different from this IPv4 addresses.
And interestingly that is actually one of the biggest failure in computer network this IPv6
addressing. But what is the reason behind that failure we will discuss that, so that would
be interesting for you.

So thank you all for attending this class, we will meet again during the next class.

604
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science And Engineering
Indian Institute of Technology, Kharagpur

Lecture – 29
IP Addressing (IPv4) III – Network Address Translation ( NAT )

Welcome back to the course on Computer Network and Internet Protocol. So, we are
looking into the IPv4 Addressing schemes in details. So, now, we will look into a
specific problems in IPv4 addressing and network layer protocol using IPv4 and we will
look a possible solution about how we’re actually mitigating that problem in the current
internet.

(Refer Slide Time: 00:45)

So, the concept that we are going to discuss today it is called Network Address
Translation or NAT which is actually a widely used concept which is used now a days for
almost all the institute network. So, the problem which we have with IPv4 addressing is
that the number of IPv4 address that we have they are very limited.

So, if you look into the address space which are there. So, this address space we have
primarily class A, class B, class C. These 3 sets of a 3 classes of IP addresses and then
class D IP address is for a multi cast data transfer and class E IP address is for the
reserved category. So, we are not able to use this class E IP address for our general
internet data transfer whereas, class D data address because they are designated for

605
multicast data delivery in today’s internet multicast are actually rarely used it is not used
widely for data transfer.

So, the address space that are reserved for the multi cast data delivery we cannot use it
for the normal data transfer, but that is actually being wasted or remaining underutilized.
So, the 3 address, 3 classes of address that we have this class A class B and class C from
class A class A, class B B or class C address. We have to allocate the address well, what
we can maximum do? We can apply concept of classless addressing or CIDR to
combining multiple classes together or to break a single class into multiple subnets and
then assign the address space to individual subnets.

But broadly if you just think of that the total number of available addresses that we have
for combining class A, class B and class C although IP address is 32 bit, we are not
getting 2 to the power 32 different number of addresses. We are only utilizing class A,
class B class C, but inside also class this 3 classes we have this broadcast addresses, then
this network addresses.

So, for every individual class A, class B or class C network, we are not able to use those
broad cast address and the network address to assign to a host. So, this further limits the
number of available addresses that we have in the internet. And with this limitation if
you just think of the number of devices that we have now a days that require an IP
address, it is significantly getting boosted up. So, it is increased quite a few hundred fold
from the time when IP was first introduced.

So, if you think about a number of IP addresses that we actually require is again not
equal to the number of devices that we have. Many of the devices that we have
nowadays, they have multiple network interfaces and actually we require one IP address
for every individual interfaces. And because of that we again require further more
number of IP addresses from the available address space.

606
(Refer Slide Time: 03:54)

So, that is the major problem with IPv4 addressing scheme that the number of address
space that we have it is limited. And the number of devices that is the networking
equipment that we have, they are increasing exponentially. And the large number of
addresses, they are either wasted or remaining underutilized like the class D or class E IP
addresses.

So, what can be a possible solution? So, a possible solution is that if we can make the
address reusable. So, ideally IP addresses are not developed to support reusability
because, every individual device or every individual networking equipment with the
network interface card should be uniquely identified in the network.

Now, the question comes that how will you apply this reusability. Here also we apply the
concept from our normal day to day life. Say my name is Sandip Chakraborty, it is not
necessary that in world I am the only person who are having the name Sandip
Chakraborty. So, how do we actually disambiguate two persons, whenever we are
sending postal mail? So, we see that what is the location of that particular Sandip
Chakraborty is it inside IIT, Kharagpur or is it say inside some other place say IIT xyz.

So, if we want to send the postal mail to Sandip Chakraborty at IIT, Kharagpur, what I
have to do? I have to use or address in way that Sandip Chakraborty inside IIT
Kharagpur or Sandip Chakraborty inside IIT xyz. That way you can possible try to
disambiguate between two person, but again if there can be two Sandip Chakraborty

607
inside IIT, kharagpur. Then we want to or we will possibly disambiguate based on the
department and even there are two Sandip Chakraborty in the department, then I do not
know how that can be done, but at some level we require uniqueness.

So, what we can do possibly that within an organization or within an institute possibly
the name that we are using or the addresses the local addresses that we are using that can
get reused. So, here by borrowing the similar kind of principle, we use the concept of
reusability for IP addresses. So, what is it this reusability for the IP addresses? So, we
have certain block of IP addresses which we call as the private IP addresses.

Now, this private IP addresses can be reusable. So, the private IP addresses can be put
inside a IIT, Kharagpur at the same block of private IP addresses can be put in IIT
Bombay or IIT Kanpur or IIT Hyderabad or any other institute in the globe. So, that way
we will be possibly be able to disambiguate between two addresses by looking into
whether that address is in IIT Kharagpur address or IIT Bombay address or IIT
Hyderabad address or say some Stanford address.

So, that concept of reusability we need to bring in to the addressing concept. But
whenever you are bringing this concept of reusability in the system, you still have a
problem. That problem is that how will you route that packet or send that packet. Now to
send that packet over the internet, ultimately you require an addresses which is unique in
the globe. So, what you can possibly do that you can possibly disambiguate the things
based on whether it is IIT Kharagpur or IIT Bombay or IIT Delhi. So, you have one
address which is unique globally. So, this IIT Kharagpur it is unique globally, IIT
Bombay it is unique globally, Stanford it is unique globally.

So, that way you first disambiguate whether you need to send the mail to IIT Kharagpur
or IIT Delhi or a Stanford. Now once the mail is reaching there, then you send to the
person concerned who is inside that institute whether it is Sandip Chakraborty or
someone else inside that particular institute. So, we require a notion of publicly available
name or publicly available unique address and then the private address inside that
organization which can reused in multiple places.

608
(Refer Slide Time: 08:33)

So, what we do in Network Address Translation on NAT? We divide the available


address space into reusable address and non reusable address. So, the reusable address
are the private address and the non reusable address are the public address which are
unique and which are used to send the packets globally.

Now, to transfer the packet, what you have to do? You need a translation mechanism to
translate the internal or the private address to the external or the public address. So, this
also hide the internal machines from the external device because the external people now,
they are not able to see whether the mail is going to Sandip Chakraborty or the mail is
going to Soumukh K Gosh rather they are just seeing that the mail is going to IIT
Kharagpur.

So, IIT Kharagpur is now becoming the identity the public identity. Now once it reaches
to the local people or the local postal center of IIT Kharagpur, then they disambiguate
whether the mail need to be delivered to Sandip Chakraborty or that need to be delivered
to Soumukh K Gosh that way we basically disambiguate the entire system.

So, you allow internet access you will be able to allow the internet access to a large
number of users via few public address. Now, here is another interesting factor which is
there while we are doing this private to public mapping. The interesting fact is there if
you just think about the population of IIT Kharagpur the number of students or number
of faculties, number of staffs who are there inside IIT Kharagpur not all of them access

609
the internet simultaneously. Sometimes some, students are accessing sometime the
faculties are accessing or there is bounded number of users who are actually accessing
the internet.

Now, the users who are accessing the internet at this moment for them, I require an IP
addresses. The people who are just sleeping for them, I do not require an IP address at
all. So, that way if you have a small set of pubic IP addresses, then I can possibly make a
dynamic mapping between this private address that I am providing to them with this
public IP; one of the public IP whenever they are waking up and trying to connect to the
internet. So, that way we can ensure the reusability of the system.

Now, if you look into the IPv4 address block; the IPv4 address block gives a private
addresses from individual classes of IP address pool. So, from class A we have 10 dot 0
dot 0 dot 0 to 10 dot 255 dot 255 dot 255 that is the private address range. From class B
it is 172 dot 16 dot 0 dot 0 2 172 dot 32 dot 255 dot 255. From class C it is 192 dot 168
dot 0 dot 0 to 192 dot 168 dot 255 dot 255. So, from individual classes of IP addresses,
you have taken one block of IP address or few block of blocks of IP addresses and
designated them as the private IP address.

(Refer Slide Time: 11:45)

Now, this is the basic operation of a NAT. So, NAT is nothing, but a device a router or a
gateway whatever you call it. So, in one site of the NAT, we have a private network. So,
this is my private network; this is my private network and then I have my public network

610
right. Now, in the private network, I have multiple machines who are identified by this
private IP addresses. So, this is an internal machine inside the private network, you can
just think of it as a IIT KGP network, say this is IIT KGP network. In the IIT KGP,
network one machine is identified by this private IP address 10 dot 0 dot 1 dot 2.

Now, whenever this machine want to send the packet to the outside machine say this
machine and this machine has a public address of to 13 dot 168 dot 112 dot 3. You want
to send a message. So, what you do? You would prepare an IP packet and in that IP
packet you have the source IP of 10 dot 0 dot 1 dot 2 the private IP of this machine and
the destination is the public IP where you want to send the packet.

Now, with this private IP, you will not be able to send a send a packet to the outside
world to the public network. So, whenever it is coming to the NAT device, what the NAT
device does? It makes a mapping between the private address and the public address. So,
this private address of 10 dot 0 dot 1 dot 2. It is mapped to one of the available public
address which is 128 dot 143 dot 71 dot 21 and that public address is put to the packet
which is going in the public network.

Now the NAT device is replacing this private IP with this public IP and sending the
packet. Now the packet reaches to the destination. Once the destination receives that
packet, it generates a reply back and in the reply it puts this source IP as the designation
IP. Now, with this destination IP this 128 dot 143 dot 71 dot 21, this is an IP which is
associated with this NAT device. So, this device is actually having a pool of IP addresses
associated with them. So, any packet to those IP addresses will be delivered to that NAT
device. So, the packet is delivered to the NAT device. When the packet is coming to the
NAT device the NAT device is maintaining this NAT table where it has maintained a
mapping between with the private address and the public address.

Now, what it does it finds out that well this public address has given to this machine. So,
it replaces the source address; this particular destination address with the private address.
Now whenever this packet is coming to the inside network, the address the destination
address is replaced from the public address to the corresponding private address and with
that private address the packet is delivered to this machine.

That is the way NAT works. So, now, you can see that every individual machine inside
that network may have one private IP address and you do not require that many of public

611
IP address because all the machines are not getting connected to the internet
simultaneously. So, you require a small set of public IP addresses may be the number of
users who are getting connected to the internet simultaneously. And then whenever a user
request send the packet to the NAT, the NAT just make an address translation from a
private IP to a public IP. Put that information to the local NAT table to the map and then
transfer that packet to the outside world. And whenever the packet reaches to the
destination machine, the destination machine reply back to you by using that public IP
address; the source IP now become the destination IP.

So, that packet traverses to the network and reaches to the NAT device. Once the NAT
device receives that packet, it again look into the NAT table to find the mapping the
reverse mapping better to say. So, from the reverse mapping, it finds out that well this
particular public IP was given to this machine with the private IP. It make a replacement
in the destination IP and send it back to the internal network and the internal network
forward that packet to the final destination. Well. So, that is the entire operation or the
idea of NAT.

(Refer Slide Time: 16:27)

Now, in NAT the organization, they manages the internal private network and the NAT
boxes. NAT boxes are nothing, but routers they manages a pool of public IP address, For
outgoing connection the NAT boxes, they select one of the IP address from its pool and
forward the packet from that IP.

612
(Refer Slide Time: 16:48)

Now, NAT has multiple interesting use cases apart from supporting more number of
users with the help of a limited public IP. One interesting fact is whenever you want to
migrate between different ISP. Now an organization can connect to multiple ISPs for
better reliability. So, for example, IIT Kharagpur network is connected to ERNET
network as well as NKN (Refer Time: 17:13) network. They have multiple outgoing
network, we call it as a multi home network.

Now, this NAT it allows a easy interchange between the ISPs by changing the IP address
in the NAT boxes. So, whenever you are making a change of the ISP your public address
IP address pool is getting changed, but the internal machines you do not need to
reconfigure the IP address for all the internet internal machines which are there inside IIT
Kharagpur. They are having their fixed private IP address and only a mapping is being
done to the corresponding ISP address to which the NAT box which is working like a
gateway is currently connected.

So, without NAT what you have to do that every internal system address need to be
changed to reflect the network IP of the ISP, but here you do not require that the NAT
box will take care of that. So, you do not need to make a change into the internal
machine.

613
(Refer Slide Time: 18:11)

So, here is an example like say initially the NAT device was connected to ISP 1, when it
was connected to ISP 1 during that time you are giving the address from a pool of 128
143 dot 71 dot 21. Now the moment this ISP got a failure or something happened, then
the NAT device gets connected to ISP 2. It start giving address from a different address
pool say from 128 dot 195 dot 4 dot 120.

So, only thing is that the public address gets changed and these public address are
managed by the NAT device. But the private IP that 10 dot 0 dot 1 dot 2 which was
assigned to this particular machine that remains as it is. So, that address do not need to
change. So, you do not need to reconfigure every machine independently to reflect these
changes.

614
(Refer Slide Time: 19:12)

OK. Now another interesting thing is in NAT is that you can utilize something called IP
masquerading. So, what is IP masquerading? It is like that, you have a single public IP
address which you can map to multiple host. Now how you can do that? You can actually
use the port address along with the IP address. So, this concept is interesting in the
context of in the context of NAT. So, what you are doing here that. So, it is basically an
extension of NAT which is sometime called as a port based NAT or PNAT.

Now, in PNAT what happens that one, so ultimately if you think about the
communication the communications are basically a process to process communication.
One process at the source machine is communicating with another process at the
destination machine. So, these process system are identified the IP address of the
machine plus a port number. So, this port numbers are used to uniquely identify a process
which is running inside a machine. Now, you can use this IP port pair actually together to
make this mapping. So, how you can do that?

615
(Refer Slide Time: 20:48)

So, let us see one example here. So, this is the thing say assume that one application is
running to this machine at port 2001 that has a private IP of 10 dot 0 dot 1 dot 2. There is
another machine say this is machine A, this is machine B. In machine B, it is using a
different private address 10 dot 0 dot 1 dot 3 and the application is running at port 3020.

Now, whenever these packets are going outside and they are trying to communicate to
some public machine same or different that is immaterial to us. So, whenever these
things are being happen during that time, what the NAT device now do? NAT device
makes a mapping of this IP port to another IP port. So, what happens here that this
particular private IP and the port number is being mapped to a public address and one
port. The second private IP and the port is mapped to another public IP and the port.

Now, here I can use the same public IP for both the machine because this port number is
actually making the differentiation. So, whenever I will get a response, if I am getting a
response at port 2100 of the IP 128 dot 143 dot 71 dot 21, I know that in the reverse
mapping that will be mapped to 10 dot 0 dot 1 dot 2 at port 2001. Similarly if you are
receiving a packet at the NAT device at port 4444 from this particular mapping you know
that this IP port pair will be mapped to 10 dot 0 dot 1 dot 3, it port 3020.

So, that way now you can support more number of users with a very limited number of
IP addresses because any way you have around 65000 more than 65000 different number
of ports. If I even remove the reserve port address, still you have some port numbers in

616
the order of 10000 even it is something similar to 50000 that many different unique port
number you have.

So, that is why if you have a very few public IP addresses. With that very few public IP
addresses by making a mapping with IP port pair, you can actually support a large
number of users in the private network. And for them you can use the same public IP, but
with different port number and the mapping is basically done based on the IP port pair
ok. So, that is the concept of IP masquerading to which you can support again large
number of users inside the private network.

(Refer Slide Time: 23:31)

And well another use case in NAT is that it can help in doing a load balancing of servers.
So, balances of load of multiple identical server, they are accessible from a single IP
address. So, the NAT box it translate the different incoming connections to different
internal IP addresses to balance the load between the server and the internal systems are
now configured with private address.

617
(Refer Slide Time: 23:57)

So, an example is something like this that whenever you are getting the request, you are
getting the request to the same destination IP; that means, 128 dot 143 dot 71 dot 21. And
the whenever this particular request are coming to the NAT device based on the load the
NAT device can redirect some of the machines some of the request to one machine at 10
dot 0 dot 1 dot 2 and some of the request to a different machine at 10 dot 0 dot 1 dot 3.

So, that way the same public IP is mapped to multiple private IP and the NAT can do
actually the load balancing by distributing the requests to the multiple private IP
addresses. Now, you can think of this machine such the web servers and you have two
different copies of the web server. And whenever the web request are coming to this
particular IP address 128 dot 143 dot 7 dot 21. So, you are making a mapping to one of
the private address either 10 dot 0 dot 1 dot 2 or 10 dot 0 dot 1 dot 3 based on the
availability. And or based on the load balancing principle and then send the request to
those particular machine.

Now, this is the broad idea of NAT. Now one limitation of NAT is that see, you need to
show to have someone from outside to communicate with this particular machine, they
need to have this particular mapping in the NAT device. So unless you have this mapping
in the NAT device, you will not be able to serve a outside request. So, that is why if you
are behind the NAT during that time, someone from outside will not be able to directly
connect to you unless they have the information of the public IP of the NAT box.

618
So, whenever you are making a connection from inside, during that time you are actually
allowing the outside machine to get a information about the public IP address through
this source destination IP pair.

(Refer Slide Time: 25:59)

So, assume that this is your NAT boundary and you have the NAT box. One machine is
there inside and this is the machine at the public domain. So, this is my public domain
and this is my private domain.

Now, whenever you are sending the packet if the connection is initiated from inside, then
you have the source IP as a private IP, say 10 dot 0 dot 1 dot 2 and destination IP as a
public IP say 202 dot 141 dot 81 dot 3. And whenever the packet is going outside, the
NAT box is making a change to this source IP source IP to some public IP say 194 dot 3
dot 2 dot 2 and the destination IP as earlier. And then this machine whenever it is
receiving this particular message from this IP, it can comes to know that well this should
be my destination IP the source IP in the request. So, that was the request message.

The source IP at the request should be the destination IP at the reply. So, it uses
destination IP in the reply message. It uses the destination IP as this is 194 dot 3 dot 2 dot
2 and send that packet back. When it comes to NAT, then the NAT makes an change
makes this destination IP, change to this source IP and the packet as forwarded to the
internal machine.

619
(Refer Slide Time: 28:24)

But if the internal machine is not initiating the connection, during that time the life is
difficult. During that time, what you have to do that say, this is my internal machine in
the private domain and this is the machine at the public domain. Now, in that case here is
the NAT box now, this public machine does not cannot send the packet to this internal IP
of 10 dot 3 dot some 4 dot 2. It need to know the public IP of the NAT box. So, unless
you have a information of the public IP of the NAT box, this machine in the public
domain will not be able to initiate a connection.

Now, to solve this problem people use DNS. So, in that case of DNS, you have a
mapping so, rather than naming these things the example that I have given as a web
server. So, for IIT Kharagpur, we have these dub dub dub dot iit kgp dot ac dot in. And
whenever you are accessing a machine with this DNS name, the DNS actually has the IP
of corresponds to which is mapped to dub dub dub dot iit kgp dot ac dot in say
something like 202 dot 141 dot 81 dot 2 and this particular IP is mapped to a IP of the
NAT box.

So, whenever the request comes, so we have multiple web servers multiple copies of the
web servers. Based on the load balancing principle, it forwards the request to one of the
machines which are internal to the private network. So, that way by using DNS, we
sometime resolve this problem whenever we require this kind of load balancing. But in
general unless you have the IP of the NAT box, you will not be able to initiate a

620
connection from the outside world or from the public world. You need to initiate the
connection from the private network or from the internal network.

So, that is all about this concept of network address translation which is actually a very
useful mechanism to support large number of nodes with the help of IP version 4. And in
the next class, we look into IP version 6. Although IP version 6 is not a very successful
protocol and although the network design understood long back that IPv6 is required, but
till now people are not able to successfully deploy IPv6 globally for every purpose.

IPv6 provides more number of address space compared to IPv4 and it has nice
mechanism of managing the IP protocol. Although that is not a success, but in many of
the places in island wise IPv6 are being used recently people are exploring IPv6 for
internet of things (Refer Time: 31:28) communication. So, in the next class, we will
briefly look into the basic principles of IPv6 protocol and look in to the way people are
trying to make a mapping or make a compatibility between the IPv4 addressing
mechanism and the IPv6 addressing mechanism.

Thank you all for attending the class today, see you in the next class.

621
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 30
IPv6 Addressing

Welcome back to the course on Computer Networks and Internet Protocols. So, in this
course till now we have looked into, the details of the internet layer or the network layer
and we have looked into the addressing scheme, which is used in the network and we
looked into the details of IP version 4 addressing format; where the network uses a 32 bit
IPv4 address to individually identify each host.

Now, in this particular lecture today, we will move towards the most recent version of IP,
the IP addressing scheme along with the IP protocol, which is called a IP version 6 or
IPv6. So, we will first look into the short comings which are there for IPv4. And then we
will go to the design choices of IPv6 and the how IPv6 mitigates different problems, in
which are associated with IPv4 addressing. So, let us have a journey on IPv6 addressing.

(Refer Slide Time: 01:24)

So, first of all why do we require this new version of IP which is IPv6? So, if you look
into the demand of internet addresses as there is with the grow of different devices in the
internet; so, when the internet was first designed it was meant for military applications,
as we have looked into the early days of internet history. And then people gradually

622
started using internet for normal, then general day to day usage. Now with this if you
look into the grow of devices which we get connected to internet, then you will see that
the number of devices are growing exponentially day by day.

So, earlier we had the desktops which are getting connected to the internet. Now each
person has 1 or even more than 1 devices; many of the cases it is more than 1 devices
like you have your desktop you have your laptop, the mobile phones, which you can get
connected to the internet. And that way you require more number of IP addresses,
because IP addresses associated with every network interface. And nowadays we are
moving towards the era of internet of things, where you have multiple small sensor
devices mounted on single board computers which are mounted on different places in a
smart room or smart city or a smart hospital. And all of this tiny or the small devices they
get connected to the internet.

So, you connect a sensor to your fridge, to your ac, so, to your washing machine, even
the doors, the lights, the smart lights, and then you can get data through those sensors
and have a automated and smart operating of those devices. And all these devices are
now getting connected over the internet. And whenever you will make a device to get
connected over the internet, during that time device will obviously, require an address.
Because our requirement is that we need to have unique IP address for all the devices
which are getting connected in the internet. And that is why if you look into the trend of
IP address requirement, in respect to years, so this graph is from January 94 to July 2017.
Interestingly it is July 2017 is the time when IPv6 was standardized.

So, if you look into the growth of internet address which are there, you will see that there
is a sharp increase in this growth. So, you have an exponential growth in the requirement
of IP addresses. Now at this point, the things gets mostly saturated. So, whatever IP
address we have, in the IPv4 address space with 32 bit addresses and as you know, we
have we have discussed that these 32 bit IP address all though, theoretically it can
support you 2 to the power 32 different IP addresses. But all this address are not usable
for connecting a interface network interface with the internet. Because you have the
reserved IP addresses, you have the special IP addresses, you have this broad cast IP
addresses and the loop back IP addresses. Then you have this sub netting concept, where
you need to allocate a set of IP addresses to the network address and then, individual host
in the network. And because of all this reasons we are almost getting stagnant or we are

623
almost getting saturated at the requirement of the IP addresses. So, the IP address space,
which are available to us it is getting saturated. So, that is why you will see that, there is
a drop in address usage in the recent years and this drop is not because the demand has
become less but rather we do not have sufficient number of IP addresses in our hand. So,
we are trying to manage with different ways like, using the network address translation
NAT this kind of techniques that we discussed earlier.

So, what the take way message from this discussion is that, the IPv4 address that we
have the total number of addresses are very limited and that is why, we need to have
large pool of IP addresses, which can support global usage or global utilization with the
help of a large number of addresses for a huge number of devices which are getting
connected over the internet.

(Refer Slide Time: 06:15)

Now, let us look into brief the problems which are associated with the IPv4 addressing;
so why do we need a new IP structure, so, first of all as we have mentioned that the
address space is not sufficient even with CIDR. So, this is the primary reason, that we
require a larger address space but that is not the only requirement for us.

So, apart from the address space, there are multiple other problems which are associated
with IPv4 addressing scheme. And as you know or as we have discussed that this IPv4
addressing scheme, it was initially designed for the standard desktop computers which
are fixed and which does not require the mobility support. So, during the early days of

624
internet people where was not able to imagine that one day your devices which will
mobile like the mobile phones which will move from one place to another place and that
will need to get connected over the internet. And traditionally this IPv4 addressing
scheme it does not support mobility.

So, there are way to make mobility support in IPv4 with the help of mobile IP, that is the
variant of IPv4 address or what you can say that it is like a patch on top of the IPv4
address. But overall, by default this IPv4 addressing scheme that does not support
mobility and at the same time during the early days of the internet people was not
bothered about security authentication this kind of aspect too much. So, during that time
connectivity was the prime requirement.

So, as I have discussed some time back that, you should always read the paper of the
history of DARPA internet protocol by, David Clark which actually talks about, the
different requirements which where there in the mind of the DARPA people, when the
internet was first designed. And during that time connectivity was the utmost
requirement and a prime requirement and security, logging, auditing all these things
where the secondary requirements. And because of that we had this IPv4 address, where
connectivity was the major issue.

So, you need to uniquely identify every individual devices in the internet but the other
goals like the security, the auditing that became the secondary goal and that was added as
a patch on top of the IPv4 address. And another thing was the quality of service. So in
IPv4 the quality of service was vaguely defined. We will look into the details that, what
is mean by quality of service later on in some lectures.

In brief quality of service is something like that, say initially when this IP addressing
scheme was designed during that time people was only interested to transmit data traffic.
But nowadays, we are transmitting multimedia traffic over the internet. So, we are
transmitting voice data over VoIP type of applications, we are doing video streaming.

So, interestingly the majority of the traffic in the internet nowadays comes from the
video traffic; from the video streaming kind of applications like YouTube, Netflix, this
kind of applications. And whenever you are doing the video streaming, there are different
kinds of video streaming, like this buffer video steaming, which is there in case of
YouTube or Hotstar or that kind of application. And there is also kind of live video

625
streaming like, what we do in case of Skype or live video chat. And all this type of
multimedia applications, they require special services from the internet, because you
need to transfer the data in a delay sensitive way. So, if your packet transfer takes too
much of time, that will not sustain in the network.

In IPv4, quality of service was not the prime goal and that is why the quality of service
was vaguely defined in a IPv4. So, we need real time service support for modern day
applications. And as I have mentioned that, mobile applications are in general
unmanageable in IPv4 although, there are certain patch of mobile IP but that does not
perform good in a real application and there is no direct security support in IPv4.

So, again that works like a patch on top of IP, using this transport layer security or secure
socket layer kind of security module under transport layer and IP security kind of module
on top of IPv4. Because there is no integrated support on IPv4 itself for this kind of
application, QoS security mobility, the entire protocol became too complex and became
unmanageable for a large internet.

(Refer Slide Time: 11:15)

Because of these reasons, we require a new IP structure and we gradually move towards
this IPv6. Now, there is a interesting fact regarding IPv6. The draft version of IPv6
proposal it came sometime in December 1998. But then we took around 10 years to
make the protocol standardized.

626
So, the protocol became the IPv6 protocol became standardized just last year around July
2017. So, it took around 10 years to look into the different aspects of the protocol
different internals of the protocol and to make it publish as a standardized protocol. So,
the basic features of IPv6 are as follows: First of all it supports a larger class of address
space compared to 32 bit address in IPv4; we have 128 bit addresses space in IPv6.

Then, it uses a mechanism called globally unique and hierarchical addressing for
efficient routing mechanism. In case of IPv4 we have seen that although we had the mind
of having a hierarchical structure of the global internet, but ultimately we failed because
of the unavailability of sufficient number address space and that is why we moved from
the classful addressing which were there in initially. The classful addressing as you know
that, it is a prefix based system. So, just by looking into the initial bits of IPv4 address,
you can find out in which class it belongs to and accordingly you can find out the
network address and the host address and then can do the route based on that.

But because this classful addressing was making a wastage of address space and we
require more number of address spaces, in the subsequent time. That is, why we
gradually move from the classful addressing scheme to the classless addressing scheme
and then, this classless inter domain routing or the CIDR kind of things.

With this, what happened that, this hierarchical architecture it was preserved locally, it
was preserved within a network and in this subnet. But globally, this hierarchical
architecture got broken. Also we have these private IPs and private lands in between by
utilizing this NAT concept which actually violates or which actually moves little bit
further from the global hierarchical structure. But with IPv6 address we try to build up a
globally unique and hierarchical addressing scheme.

The third feature is the optimized routing table using prefixes rather than address classes.
So, here you just look into the initial few bits of the address space and determine that in,
which hierarchy, in which path of the hierarchy, the device belong to and accordingly
you route the packet in that path. That way you can optimize the routing table, rather
than having this routing based on classful addressing.

Then the feature of auto configuration of network interfaces; that means, whenever you
make a device live the network interface can automatically get an IPv6 address. So,
whatever, we were you doing in IPv4 with the help of DHCP dynamic host configuration

627
protocol; the same thing is implemented in IPv6 with the help of auto configuration. And
that became a part of the IPv6, rather than having a different protocol like a DHCP which
was there in IPv6.

Then the support for encapsulation; we will discuss this encapsulation in details. The
service class support to manage quality of service classes. Then this built in
authentication and encryption mechanism to support security and a backward
compatibility with IPv4 so, that you can gradually migrate from IPv4 based system to
IPv6 based systems.

(Refer Slide Time: 15:19)

So, let us look into the header format of IPv6. So, in a case of IPv6, this is the header
structure, in the header we use 128 bit source address and 128 bit destination address; the
source and the destination address field. Along with that you have this traffic class field
for supporting quality of service. This is the protocol version, then the flow level,
leveling every flow based on its QoS classes, the payload length. The next header and the
hop limit; so the next header is that in IPv6 you can have multiple optional headers, we
will come to that point. And the hop limits denote that, how many hop the packet should
traverse because, before you discard the packet from the internet.

628
(Refer Slide Time: 16:17)

Now, this is the mandatory header structure of IPv6. Every IPv6 packet should have one
mandatory header and along with one mandatory header, it can have multiple extension
headers. So, these extension headers are used for special purposes. And with this
mandatory header, so, in this diagram, this part is the mandatory header. In this
mandatory header you have a pointer to the next header. So, this pointer actually points
to the next header, in the total IP packet.

So, you have multiple, you can have multiple such extension header. One extension
header can be you can put hop by hop option that whenever the packet traverse in each
hop, how the packet will be treated there. Then, you can have a routing information
embedded inside the inside the header itself. So, if you are applying something like
source routing, where the source of the packet it will find out that in which route the
packet need to be traversed to reach at the destination, the source can put the entire
routing information in the IP header packet. So, that is the routing information optional
header.

Then the fragment identification; if your IPv6 packet gets fragmented into multiple
pieces, then this fragment information can contain in the fragment header. Then your
authentication data as I have mentioned that authentication or the security became a
inbuilt part of the IPv6. So, the authentication information can be put inside the optional
header. And then you have this TCP header and the corresponding data.

629
So, that way, you can have such multiple extension header along with the mandatory
header which will give you additional information about this, how the packet will be
treated by the IP protocol.

(Refer Slide Time: 18:09)

OK. So, this is the format for the IPv6 addressing. So, as we have mentioned that, we use
a 128 bit IP addresses. It is represented in 8 hexadecimal numbers. So every hexadecimal
number is like FE80 then 0000. So 16 bit binary that is converted to the corresponding
hexadecimal number and they are separated by a colon. So, that way, we represent this
128 bit address in IPv6.

Now this entire address we further reduce the total spaces, that is required to store an
IPv6 address. So, first of all if your hexadecimal number has all 0’s, then you can replace
it by a single 0. So, if, you have a single 0 that means, you have 4 consecutive 0, so all
the bits in that part are 0’s. Then if you have few consecutive 0’s that consecutive 0’s that
can be replaced by a double colon. So, here these numbers of consecutive 0’s are
replaced by a double colon. But you need to remember that, this double colon feature can
be used only once, because if you have two different double colons; one say here and
another double colon if I put here, then it will be difficult for you to find out that how
many 0’s are here and how many 0’s are here. So, that is why we cannot use it more than
once, this double colons syntax we can use at most one. So, that you can find out that
well here this it is, FE80 then it is 1. So, that means, it is 0001, then 8 0023E7 5FDB. So,

630
you have 8888 and 8 1 2 3 4 5 5 into 8, that many bits are there and remaining bits are 0,
which will be placed here in the place of those two double colons. So, that way you can
have a more optimized representation of the entire address in IPv6.

(Refer Slide Time: 20:19)

Now, this entire address space it is divided into multiple groups based on the prefix. So,
this prefix actually determines that, how many addresses will fall into what group. So, if
you look into the prefix values; that means, if the first 8 bits are 0’s we can represent it as
0 then colon colon slash 8. So, this slash 8 represent the prefix and which was there in
the CIDR concept as well, the concept of prefix that the first bits number of bits which
will be used to identify the type of the address.

So, if this first 8 bits are 0’s those this reserved class of address then if this bit is a first 8
bit is 200; that means, 0000 followed by 0010. So, here your prefix is 7 bit first 7 bit. So,
if you look into the first seven bit, if the last bit is 1, it is reserved for NSAP. If the bit is
10 in the address range, we can write it as 400; 400 because, this is 0 then, this becomes
4. If it is 400 then, this with this slash 7 prefix it is reserved for IPX protocol.

Then, if the first 3 bits are 001; that means, this 001 means, the address is 0010 0000
then all 0’s, that is the first hex part. So, the first hex part this becomes 2 and then all 4’s
are 0’s 2000 and your prefix is slash 3. If that is the case then, it is the aggregatable
global unicast address, which is assigned to individual host in the network. And that is

631
the 1/8th of the entire IPv6 address space that we have. So, that way we have a sufficient
number of addresses that can be utilized for addressing every interface of a network.

(Refer Slide Time: 22:37)

Then you have other classes like, the link local unicast, where the first few bits are
1111111010 with a 10 bit prefix. Then site local unicast again with a 10 bit prefix the
multicast address with the 8 bit prefix where all the first 8 bits are 1.

So, that way we have this multiple group of IP addresses, which are there in IPv6 and the
interesting part is this global unicast address which are used in addressing every interface
of individual devices.

632
(Refer Slide Time: 23:18)

Now the global unicast address format in IPv6 this entire address is divided into 3
groups. You have a global routing prefix which is of n bits and then you have a subnet id
of m bits and finally, 128 minus m minus m bits which are the corresponding interface
id.

Now, this global routing prefix it is a value which is assigned to a site for a cluster of
subnets of the links. The global routing prefix it is designed such that this entire network
globally that can be structured hierarchically. So, the routing agencies they design these
global routing prefix such that you can have this entire internet, you can structure the
entire internet in a hierarchical way and then inside that individual level you can have the
subnet ID, followed by the internet ID and your prefix the way we have noted it in
CIDR, the same way the prefix is used to denote the globally routing prefix plus the
subnet id.

633
(Refer Slide Time: 24:27)

Well, now let us look into few features in IPv6; we look into a little detail. The first
feature that we will discuss is neighbor discovery. So, neighbor discovery in IPv6 that
was you can say it is a replacement of ARP in IPv4. So, it enables a node to identify the
other host and routers on its links. The node they needs to know of at least 1 router, so,
that it knows, where to forward the packet. So, similar to the ARP protocol in IPv4,
whenever you want to send a packet to another host you know its IPv6 address, but
alongside you need to also know its MAC address. So, having a mapping from this IPv6
address to the MAC address that is, work done by this neighbor discovery protocol.

(Refer Slide Time: 25:18)

634
Now this neighbor discovery protocol here is an example; like you say 4 devices A B C
and D which have their IP address and the MAC address here, the IP address are the IPv6
addresses. Now say A wants to send some packet to B, now if he wants to send some
packet to B, A knows the say the IP address of B but A need to find out the MAC address
of B. So, that it can find out that how to forward the packet to B. So, this is done with the
help of this the neighbor discovery protocol.

(Refer Slide Time: 25:54)

So, in case of neighbor discovery protocol what happens that, the node which wants to
send the packets send a data here the node A in the preceding example, it sends a
neighbor solicitation packet.

So, this neighbor solicitation packet, this is the structure of the neighbor solicitation
packet, you have a source address field and the destination address field. This destination
address field is an interesting feature that I will come in a couple of minutes So, this is
your part of IP address, IP address and this is the part of your ICMP message, that is the
neighbor solicitation message in IPv6. So, the ICMP extension in IPv6 we call it as,
ICMP version 6.

So, this is the ICMP message. So, in the ICMP message it is type 135; that means, it is a
neighbor solicitation message. Then your target address is the given IPv6 address, so that
means, this target address field it tells you that you want to find out the MAC address

635
corresponds to this IPv6 address. And you have a source link layer address, so the MAC
address of the source which is a part of the ICMP message.

Here the interesting part is that, this destination address. So, this destination address is
the address of the solicitated node. So, if you look into the ARP in IPv4, in case of ARP
of IPv4, we actually broad cast the IPv4 ARP query. So, the query ARP query is
broadcasted and the nodes which receive that, if they have the information they reply
back otherwise, they further broadcast it. But in case of IPv6, we do not broad cast this
query, rather we send to a targeted node. So, every node has associated with one
solicitated node, the information of the solitcitated node is already available to the source
node. So, it will send the query to only this solicitated node.

(Refer Slide Time: 27:56)

So, here in this preceding example, say node C is the solicited node of node A. So, node
A will send the query to node C and then node C will find out the path to node B and
then informing to node A.

636
(Refer Slide Time: 28:15)

OK. Now this response to the neighbor solicitation message is the neighbor
advertisement message. In the neighbor advertisement message, you include the target
address, the target IPv6 address and the corresponding target link layer address. So, this
is the address for node B and you send the MAC address of node B the neighbor
advertisement message.

Now, one feature is that, it is not like that neighbor advertisement are only send as a
response to neighbor solicitation. Whenever you are sending a neighbor solicitation,
during that time you will get a advertisement. But apart from that every node periodically
send this neighbor advertisement message, so that they can formed a one half link
connectivity.

Now, here because of this you can see there are 3 flags. So, these flags are the R flag
means the sender of the advertisement is a router, the S flags means the advertisement is
a response to a solicitation and O means override; that means, the source of the
solicitation it must update the cache, with this new information.

637
(Refer Slide Time: 29:20)

Ok, now coming to the mobility support in IPv6, so in case of IPv6 mobile node, it uses a
temporary address, when it is away from the home location. So, it use this IPv6
destination optional headers, to store the home address home address means, where it
was initially connected. Now the mobile station it can list all the routing header, for the
packets to follow a particular path for establishing a connection with a service provider
network.

So, as you have seen that the advantage of IPv6 is that, you can add a additional number
of optional headers to support this mobility. With this optional header you can add this
additional information like whenever a node is moving from one location to another
location, how the packet would be forwarded to this node, that can get embedded with
this routing header information.

Now, the packet sends to a mobile node, it can be tunneled by IPv6 routing headers and
we do not require the foreign agents like IPv4. So, if you look into the IPv4 for mobility
support, in IPv4 mobility support you have a foreign agent, that is a designated router
and that designated router will actually make a mapping between the original address of
the machine and the when the node has moved to a different subnet the new address
corresponds to this mobility location. So, we do not require a foreign agent here in IPv6.
We have the neighbor discovery protocol and the address of a configuration mechanism
that can be used to directly connect a node to any subnet. So, the node will get a new IP

638
address IPv6 address with the help of this neighbor discovery and interface or address
auto configuration.

Now the interesting fact is that, you cannot migrate from IPv4 to IPv6 in 1 day, because
currently all the machines are majority of the machines in the internet is support IPv4.
And IPv6 has a huge new set of features now if, you want to migrate from IPv4 to IPv6
how will you do that? There are broadly three ways of doing that. One is the dual stack
support. In case of a dual stack support, you have a support for both IPv4 and IPv6 in the
same protocol stack.

(Refer Slide Time: 31:35)

So, if you are communicating with the IPv4 machine, then you use the IPv4 stack, this
part of the stack to communicate with the IPv4 machine. If you are communicating with
the IPv6 host, they would then you use this IPv6 stack to communicate with the IPv6
host; so, that means, the single machine should have both the IPv4 stack as well as the
IPv6 stack. The second mechanism is tunneling.

639
(Refer Slide Time: 32:08)

The tunneling mechanism says that you tunnel the IPv4 headers through IPv6 headers.
That means, the tunneling mechanism says that, you have a IPv4 header. So, whenever
you want to send it to IPv6 host, you add up an IPv6 header along with the IPv4 header.

Now, if you are sending it to IPv4 host these part of the header will be read, if you are
sending it to the IPv6 header this part of the header will be read out.

Then the concept of header translation, it says that you translate a IPv4 header to IPv6
header. That means, you have a IPv4 header and you create a corresponding IPv6 header,
by converting the values in the IPv6 format and then add it with the original packet.

Now, whenever you are doing a header translation, an important requirement is that your
address must be translated. That means you should be able to translate the IPv6 address
to IPv4 address and the vice versa. So, to make this conversion if you want to make a
conversion from IPv6 to IPv4 then, you take the low order 32 bit address to make the
corresponding IPv4 address. If you want to convert from IPv4 to IPv6 you have 32 bits,
you require additional 96 bits, you put all this 96 bits as initial 0’s and then all 1’s for the
last hex part. (Refer Slide Time: 33:35)

640
So, an example is here. Say this is your IPv4 address. If this is the IPv4 address, this is
your corresponding IPv6 address. So 202 corresponds to CA, 141 corresponds to 8D, 80
corresponds to 50, 20 corresponds to 14. So, note that this is in the decimal notation and
this is in the hexadecimal notation.

So, we take this 16 bits and convert it to a hex format. Then we take this 16 bit and
convert it to a hex and then all 0’s followed by last ones. And if you have a IPv6 address
like this to convert it to a corresponding IPv4 address, you take the lower order 32 bits,
that means this part of the IPv6 address and convert it to the corresponding IPv4. So, FE
means 254, 80 means in hex means 128, 23 in hex means 35, 81 in hex means 129. So,
your address is 254.12.35.129. So, that is all about IPv6 that we wanted to discuss here,
but I have not discussed all the details.

641
(Refer Slide Time: 34:34)

So, the IPv6 details are much more than what I have covered, I have just tried to give
you a basic introduction about IPv6. So, to know more about this IPv6 there are some
pointers that you can follow, the RFC’s. So, this RFC’s are these RFC 2460, RFC 4291
and RFC 3587, this discuss about a various aspects of the IPv6 in details. And then I
have pointed two different links, one is the IANA documentation; that talks about the
IPv6 addresses, multicast addresses and another is the 6NET website. The 6NET is a
project that worked on the design and development of IPv6.

So, you can visit the 6NET website to look into their white papers the documentations
which are there to know more about different features in IPv6. So, that is all about IPv6
and I will say that it is a very brief introduction about IPv6 there are much more details.
So, please explore the pointers which are given at the end of this slide to know more
about IPv6 addressing format.

Thank you for attending this class.

642
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 31
Internet Qos – I ( What is Qos )

Welcome back to the course on Computer Networks and Internet Protocols. So, today we
will we are going to start a new topic which we call as tje Network Quality of Service.

(Refer Slide Time: 00:28)

So, in this introductory lecture of the internet quality of service we will first look into
what is quality of service, and what do we require quality of service. Indeed in today’s
network quality of service is an very important topic because, nowadays we are going to
use different kind of multimedia data and multimedia traffic like we use mobile phones,
and in mobile phones we have thousands of different apps or applications which are
running there. And we do different kind of multimedia based applications like this
YouTube app like Facebook life then this Hotstar, Netflix all these different type of
applications which use multimedia streaming of data.

So, this streaming data the nature of streaming data is much different compared to the
nature of normal file transfer. Why? Because in case of normal file transfer, you just need
to transfer the bytes at the bits at the other end and in the other end, you can just combine

643
all the bits all together whenever you are receiving, or whether you have received all the
bits and then you can reconstruct the file.

But in case of multimedia streaming say just think of the example, of YouTube streaming
say for example, when you are watching this video during that time the data is coming
over the internet. So, and you are playing it simultaneously, so do not think about the
offline video downloading that is a different ballgame that is similar to that file transfer,
you are just transferring the video file and playing it offline. But whenever you are
playing it online over say YouTube, during that time from the YouTube server to your
client which is running at your browser, the video data is getting transmitted
continuously, and by the time this video data is getting transmitted, during the same time
you are playing the video. And, many of the time I think you have observed that
whenever your network quality is poor you do not have sufficient bandwidth, you may
observe for degradation of the video quality. Suddenly you will see that, the video
quality is getting dropped or sometime you may observe some events what we call as the
re-buffering. So, what happens that the video got stuck and you keep on seeing the
circular thing that is rounding about for trying to download the video data.

Now, for this kind of video transmission we need to maintain certain level of quality of
service. Quality of service in the sense that what the other end or the client side is
expecting from the internet. So, here in case of this YouTube video streaming the client
side the YouTube client it is expecting a continuous stream of videos such that it can
render the videos directly on the player and play the video without having this kind of
quality drop or re-buffering. So, that is why or to ensure such kind of application quality
we need to provide certain special services at the internet level.

Now, remember that providing this kind of special service over the internet requires
something like a dedicated line or a dedicated resource that is given to you. So, do not
get confused over the fact that while you are observing the videos over YouTube why
you are not able to see properly whenever your video is getting bandwidth, whenever
your network bandwidth is getting dropped or whenever you see some quality
degradation. That is because your network bandwidth on which you are currently
subscribed that does not provide that kind of service level agreement, that you require to
get the network quality of service.

644
Now, today we will look into briefly that what type of quality of service parameters are
required for this kind of smooth video streaming, or to improve the quality of service or
in other words sometimes we call it as quality of experience. The, what term quality of
experience actually indicates the users perceived quality of particular applications. For
example, how good you are thinking about the video streaming service or the quality of
the video that you are observing in YouTube.

So, on that the network need to provide certain services. So, that you can look into those
videos more smoothly and; obviously, for that you have to pay more to your network
service provider, and you have to go for an agreement with your network service
provider that you require these particular types of video quality of service. And the
network service provider should provide you that level of quality of service. So, this
gives you a kind of broad overview of what quality of service actually means. Now let us
go into the details of different parameters, which we need to play with while providing
quality of service to the end users from the network perspective and how we can insure it
over a large internet.

Indeed in the beginning of the lecture let me give you an information that, in today’s
internet providing quality of service is indeed a very challenging task considering the
scale of the network. So, that is why we actually apply certain kind of approximation
there and you will never get a perfect quality of service unless you have a dedicated least
line connection, where you are getting the entire bandwidth. But, for a general internet
for a general data transfer over the internet we try to provide certain level of quality of
service. So, let us look into the details of this particular topic.

645
(Refer Slide Time: 06:29)

OK. So to start with our journey on quality of services, we start with this specific
question that, does this TCP congestion control ensures no congestion in the network?
So, our objective is to see that whether this TCP congestion control algorithm ensures
that there will be no congestion in the internet unfortunately this if you look into the TCP
congestion control algorithm in details what TCP does TCP tries to avoid congestion.

So, in other words what TCP does whenever TCP detects that there is certain congestion
in the internet during that time, TCP simply finds out the reason for congestion; that
means, whether you have you have exceeded the slow start phase and you are observing
certain kind of packet loss due to congestion. And TCP simply reduces its rate and
because of that what TCP does or the TCP congestion control behavior. It is like that
once the congestion happens in the network TCP detects it and then only TCP responses
to the congestion by reducing the sending rate of the sender.

So, that way you are actually never avoiding the congestion in the network, rather what
you are trying to do you are trying to have congestion in the network and then once
congestion happens in the network, you are trying to coming out of that congestion
scenario. So, TCP congestion control algorithm does not ensure that congestion will
never happen in the network rather it works in a different way, like it first finds out
whether there is certain congestion in the network by observing the packet loss. And if

646
there is congestion in the network then only it acts or it updates its sending rate, to avoid
the congestion from the network.

Now, the question comes that if there is still a possibility of congestion in the network
how this congestion impact the network performance. So, we look into four specific
parameters on top that impact the network performance, when there are congestion in the
network the first parameter is the network Bandwidth. Obviously, whenever the
congestion is there you are expecting less bandwidth from the network, because the same
bottleneck (Refer Time: 08:58) bandwidth is getting shared by multiple applications.

The second parameter is the delay. We will look into the different components of delay in
details and we will see that whenever the congestion is there in the network, during that
time, that delay gets impacted like if there is a congestion, that means, the packet need to
wait for more amount of time in the packet buffer. Because the packet needs to wait for
more amount of time in the packet buffer, you will experience that the packet will be
transmitted, with a higher delay because the queuing delay the time to wait inside the
queues at intermediate routers that get gets increased.

The third parameter which we are going to talk about we call it jitter. So, possibly you
have heard about this term bandwidth and delay earlier, but jitter may be a new term for
you. So but in respective of quality of service jitter is a very important parameter. So,
what is jitter? So, jitter is basically the variance of delay. So, we call the variance of
delay as the jitter. So, what do you mean by variance of delay? So, variance of delay
means assume there are two packets, which are coming from the or which are going
through the network. So, whenever there are two packets which are going to the network.

647
(Refer Slide Time: 10:24)

So, assume that these are the sequences of packets, which are being transferred over the
network. Now, individual packets will have individual delay. So, say this first packet has
a delay of 10 millisecond; that means, you have a source here you have a destination here
and from this source to destination there are multiple routers, and over that you are
transferring this packets. Now, whenever you are transferring this packet during that time
these different packets may have different delay. So, said this packet has 10 millisecond
delay this packet has say 15 millisecond delay then this packet has say 6 millisecond
delay and this packet expect some say 2 millisecond delay.

Now, why this there is a variance here? So, what you can see from here that the variance
of delay among those four packets is significant like it the maximum delay is something
like 15 millisecond and the minimum delay is something like 2 millisecond and, why
there can be variance? Because different packets may experience different level of
congestion at the intermediate routers.

So, it may happen that whenever this first two or three packets who are getting
transmitted, during that time you have the congestion in the network and as a result due
to this congestion the packets have experienced more waiting time inside the packet
queues at this intermediate routers. But this last packet it came out of the congestion and
because it was able to came out of the congestion true the TCP congestion control
algorithm which is running at the transport layer. So, maybe at this point of time TCP has

648
experienced or TCP has found out a packet loss, and whenever TCP has found out a
packet loss, TCP has reduced it rate and as the TCP has reduced it rate, the congestion
will slowly get out of the network, and you will see less delay. But this delay variation
among multiple packets that actually impact the performance of the quality of video
streaming services.

Now, the question comes that how it impacts the quality of video streaming services. Just
think of the scenario when you are observing a video in a YouTube player and during
that time, every data packet is coming one after another that is getting buffered inside the
client buffer that you have at the YouTube player and then the YouTube player is
rendering that video.

Now, if different packets has different delay then, the problem is comes for the live
streaming. So, for the live streaming what happens whatever I am doing here or whatever
I am say recording here that is getting streamed immediately. So, currently you are
observing something called a buffer streaming because the video has been recorded and
you are getting the video from the video server, but if there is a live streaming session
just think of an NPTEL live streaming session which is going on.

Now, in that live streaming session, whenever some video is getting recorded,
immediately that video is getting transferred. And that video is getting played in the
YouTube player where you are being observed. Now if different data packets has
different amount of delay, what will happen? Some packets will reach there at the client
side and the client will play it then the next packet comes. So, the next packet has see a
higher delay. So, the client wait for some amount of time and place it again that third
packet say it comes very fast. So, the client plays it immediately the fourth packet gets a
higher delay, and there is a delay in playing that particular video and as a result what
happens that at the client side you will see lots of this kind of jerkiness in quality.

So, the quality some time it good becomes good some time there is a it is waiting for the
next video frame, but it is not getting that, after that it is again immediately getting the
frame, then again there is a delay. So, you will see a lots of jerkiness in the quality level
because the data which is coming from the server it is not coming at a constant bitrate it
is coming in a variable bitrate and thats too at a high variation. So, that is why jitter is

649
indeed important for ensuring quality of service. So, that we do not see lots of up and
downs in video quality.

So, in that particular context or that particular perspective jitter is an important parameter
for consideration and the final parameter is the packet loss. So it triggers that how much
packet loss the a particular video streaming service or a particular quality of service
associated application can sustain. So, certain application they can sustain a level of
quality of service, but for some other application say for the voice application loss is a
very important parameter. So if you have a significant amount of packet loss you will not
be able to hear the voice correctly, if you are transferring the voice over the normal IP
network data. Now, we will look into all these individual parameters in little details so.

(Refer Slide Time: 15:55)

OK. So first let us look into the network bandwidth. So, by definition as you know that
the network bandwidth is the amount of data that can be transmitted over a link within a
fixed amount of time. Now network bandwidth is something like we do not have much
control over that. So, I actually liked very much this line by Tim Greene from a book
called QoS versus more bandwidth, an article there he mentions that when drain
chronically runs sxlow even though it is not plugged it is time to get a bigger pipe. So,
what does it mean that if your connection does not have sufficient bandwidth, but you
require more bandwidth then you will never be able to manage with the existing pipe or
existing line that you have, better to go for a subscription of a higher bandwidth line.

650
So, that is regarding bandwidth. If you have a lower lower capacity pipe or lower
capacity network channel you will always experience bandwidth if you are going to
going to say deliver or if you are going to use more amount of bandwidth. Say for
example, you have a think of you have a 1 Mbps list line and with that 1 Mbps list line
you are always trying to observe high definition video.

Now, high definition video if you are trying to observe it every time 1 Mbps may not be
sufficient for you. And because of that, you require more bandwidth you need to go from
1 Mbps to 8 Mbps or even more bandwidth. Now some applications in the network are
bandwidth hungry such as this video applications and congestion limits per user
bandwidth and that is why we need to design networks with high capacity to improve the
bandwidth. So, if you think that your application or your network is going to run
applications like video applications which are kind of bandwidth hungry applications,
then you purchase network lines with more bandwidth ok.

(Refer Slide Time: 18:04)

Now, coming to delay, in network there are three different types of delay or you say that
there are three components of delay, the first one is the Transmission delay then we have
the Propagation delay and the third one is the Queuing delay.

Now, what is a transmission delay? The transmission delay is the amount of time to push
all the packet bits in the network. So, it is like that it actually depends on the capacity of
your network. So, for example, if your network bandwidth is 8 Mbps and your packet

651
size including the packet header is 1 megabyte then what is the transmission delay? So, 1
megabyte packet means it is 8 megabit packet and you are transferring data at a rate of 8
Mbps. So, your network capacity is 8 Mbps. Now if you are the 8 megabit bit of packet
then to transfer that 8 megabit data over 8 megabit per second line you require exactly 1
second. So, that is the transmission delay that we have over the network. So, it depends
on the amount of bandwidth that is given to you and based on the amount of bandwidth
that is given to you need to transfer the data over that capacity. And the example, that I
have given if your capacity of 8 megabit per second and you are going to transfer 8
megabit of packet, that means, you can transfer that 8 megabit data for 1 second. So, it
will take 1 second to transfer the packet from the sender to the receiver.

So, this particular delay component we call it the Transmission Delay component. So,
this transmission delay component depends on the capacity of the channel now the
second component of the delay we call it as the Propagation Delay. So, the propagation
delay is time to transfer one bit from one end of the link to another end of the link. So,
usually depends on the underlying communication video. Now what is the difference
between this transmission delay and the propagation delay. So, let us see it with the help
of an example.

(Refer Slide Time: 20:05)

Now, think of a Sender and a Receiver. So, this is my sender and this is my receiver now
the capacity. So, you can think of that we have a pipe between the sender and the

652
receiver through which you are sending data. Now, the capacity of the pipe will depend
on what is the width of this time. So, how much data it can pump to that pipe. So, if you
think of that the capacity of data is say 8 Mbps the example, that I was giving; that
means, from the sender side you can pump data to this capacity channel at a rate of 8
megabit per second. So, you can push 8 megabit data to this particular channel.

So, it is if it is depending on this capacity or the width of the pipe. Now if you have a
wider pipe say, if you have a pipe of something like this between the same sender and the
receiver where the capacity the width is more say it is 16 Mbps. If that is the case; that
means, you can push data at despite at a rate of 16 megabit per second. So, if your packet
size is still 8 megabit then it will take 0. it will take 0.5 second to push this entire data in
this pipe. So, because you are increasing the capacity of the pipe. So this particular delay
to transfer or to push the data in the pipe that we call as the Transmission Delay. Now
what is the propagation delay now think of that you have pushed the first bit of data in
the say the at the first bit of data has been pushed in the pipe. Now that particular data
that particular bit need to reach at the other end.

Now, the time to reach for this bit to the other end that particular delay we call it as the
Propagation Delay. So, whenever you are transferring a single bit you can think of it in
the form of a signal that, you are transferring now the signal will get propagated over this
particular channel, and if the length of the channel is more, it will take more time to get
propagated. So, that is why this transmission delay it depends the transmission delay
component it depends on the capacity of the pipe or the capacity of the channel and
whereas, the propagation delay it depends on the length of the pipe or the length of the
channel or the distance between the sender and the receiver.

So, these are the two different delay components that we have: the Propagation Delay
and the Transmission Delay and there is a third delay component which we call as the
Queuing Delay. Now the queuing delay is an interesting component. So, the queuing
delay is the delay at the interface buffer. So, whenever you are transferring certain data.

653
(Refer Slide Time: 23:37)

During that time you have from the sender to the receiver you have multiple intermediate
routers. And these routers form a network and you have say multiple senders which are
sending data. So, you have device 1 device 2 and device 3 which are sending data
simultaneously. So, assume that so another device a device 4 which is again sending
data. So, device 4 is sending some data device D1 is sending some data, but you have
certain fixed capacity of this out going link say assume D4 is sending data to D3 as well
as D1 is sending data to D3.

But at this router say R1 you have some fixed capacity of this particular router, because
you have some fixed capacity of this particular router, the packet gets enqueued in the
intermediate buffer queue, or packet buffer queue that is your that is associated with this
particular router. Now, as you have more data which are coming to this router, your delay
for transferring the data from this queue will increase. So that packet has to wait for more
amount of time in the queue. So, you can think of it in this way say the packet this
particular queue it can process say 1 packet per second. So, if it can process 1 packet per
second; that means, at the outgoing link you can send 1 packet per second and assume
that you are receiving data at a rate of 8 packets per second.

So that means, at every second 8 packets are getting enqueued and that is, but the router
is able to process only 1 packet per second so that means, by the time the routers will
send this 1 packet in the channel another 8 packet will get enqueued. So, you can just

654
think of a line, a queuing line in the in the gate of movie hall, ticket counters say at
INOX ticket counter and the people are coming at a faster rate compared to the service
rate of that ticket counter. So, you have to wait for more amount of time in that particular
line. So, the same thing happens here and this particular delay component we call it as
the Queuing Delay. So, the queuing delay is the major delay component which impacts
the network.

(Refer Slide Time: 26:10)

Now, in general what we have that these Queuing delay it is significantly much more
than the Transmission delay and the Propagation delay. So, that is why the queuing delay
it dominates the network. Now packet multiplexing in the network devices loud like the
routers or the switches it impact the queuing delay, the example, that I have just shown
you. Now if you have congestion in the network congestion in the network means more
packets are coming to the queue and it was not able to serve it. So, it increased the
queuing delay.

655
(Refer Slide Time: 26:44)

OK. Now, coming to the third component which we call as the Jitter; so, as we have
mentioned jitter is the Variation in End to End delay. So, you do not have a study stream
of packets like this one rather what you have you have a stream of packets which are
irregulated and there are different packets are transmitted at different instants of time,
and you do not have a steady stream of packets which impacts the jitter.

So, in case of video streaming as the example that we have given earlier this kind of jitter
it impacts significantly the application performance. So, the example, that we have given
earlier that you are watching a live streaming and then packets are coming will differ in
delay. So, it is not coming at a constant bitrate. So, the video player will not be able to
play the service at a constant rate. So, it will see lots of up and downs in a video quality.

656
(Refer Slide Time: 27:43)

OK, now, coming to the fourth component which is the Loss. So this loss is a relative
measure of the number of packets or sometime we represent it in the form of segments or
bits, that were not received compared to the total number of packets or segments or bits.
So, this loss is a function of availability in general, if the network is available, that
means, if your capacity is more than the demand then the loss will generally be zero you
do not see any loss there, but if your capacity is less then you will see a significant loss
from the network.

So, that is why whenever there is a congestion you will see there is a significant loss, and
that is why TCP takes that loss as an indication of congestion, but this particular
principle does not hold the exactly in case of wireless network, because in case of
wireless network there can be loss from the channel as well like you are transferring data
in a open media and that is why you can just think of that lots of people are talking
together in a single room. If a lots of people are talking together in a single room over
that open environment then it will create a noise and none will be able to hear others
voice.

So, the same thing happens in case of wireless media what we call as the interference
during the discussion of wireless physical layer we’ll talk about this interference in more
details, but this interference is also results in packet loss. So, in wireless there are

657
multiple results the multiple reasons for packet loss are indeed that is the reason you will
experience more amount of packet loss in a wireless environment.

(Refer Slide Time: 29:26)

OK. So, if we look into the Application level Quality of Service. So, different application
requires different level of quality of service in terms of delay jitter and bandwidth. And
here is an example chart for that. So, you can see that the for the voice application so this
data is taken from Cisco typical networking company. So, the voice data has a loss
tolerance of less than equal to 1 percent you need to it can tolerate very few losses the
deal delay should be less than equal to 150 millisecond the jitter need to be less than
equal to 30 millisecond and you require some 21 Kbps to 320 Kbps of dedicated
bandwidth.

For interactive video like the live streaming, the lost need to be less than 1 percent the
delay can be around 150 milliseconds the jitter need to be 30 millisecond and the
bandwidth is on demand like if you are watching a high quality video you will require
high bandwidth. If you are watching standard quality video we may require little less
bandwidth.

For the streaming video like the video that you are watching right now in YouTube,
where the video has been pre recorded and now getting streamed. It can sustain more
amount of loss why it can sustain more amount of loss because the video is already
recorded. So, that is why say for example, you have received frame 1 frame 2 has lost

658
and you have then received frame 3 then by doing averaging over frame 1 and frame 3
you can recover certain part of the frame the lost frame, because it is just like images
frames means; images one after another. So, that is why it can sustain for more amount
of loss the delay is equals to the buffer time at the client side jitter is again depends on
the buffer time and the video is on demand.

If you are going for high definition video, you will require more amount of bandwidth.
For normal data transfer, we do not have any bound on lost delay or jitter and the
bandwidth is the best for the best bandwidth that you can support for that application.

(Refer Slide Time: 31:24)

OK. So, here is the formal definition of quality of service which is coming from Cisco.
So, I have highlighted the different part of the definition in different color the important
key words. So, quality of service refers to the capability of a network to provide better
service to selected network traffic - why it is selected network traffic? Because we are
looking into network traffic which are quality of service associated like the voice traffic
or the video traffic, over various technologies including frame relay, asynchronous
transfer mode ethernet and 802 that 1 networks, SONET, and IP based networks. So, you
need to remember that, whenever you are trying to transfer data from one end host to
another end host, say this host is India and this host is in US, in between you have
multiple such links and different links may be of different types.

659
Here the first hop may be wireless, then the second hop maybe Ethernet, the third hop
maybe optical network like SONET. So, you can have multiple networking technologies
in between. So, you need to provide quality of service over multiple technologies. IP
route network that may use any or all of these underlying technologies. So, the primary
goal of quality of service is to provide priority including dedicated bandwidth, for certain
classes of traffics controlled jitter and latency. Latency means one way delay required by
some real time and interactive traffic and improve loss characteristics. So, this is the
formal definition of quality of service.

(Refer Slide Time: 33:01)

To ensure quality of service over a packet switched network, we need to find out these
four different things. First of all what the application need from the network, what type
of quality of service it is expecting, how to regulate the traffic that enters the network to
provide quality of service we will look into all these things in details in the subsequent
lectures. Then how to reserve the resources at a router to guarantee performance because
you need to have end to end dedicated resources to ensure certain classes of quality of
service, and whether the network can safely accept more traffic while not violating the
quality of service of the existing traffics.

660
(Refer Slide Time: 33:43)

So, the primary Quality of Service parameters that you have already seen. There are four
such parameters the Bandwidth, Delay, Jitter and Loss.

(Refer Slide Time: 33:53)

So, in terms of quality of service many of the time will use this term Flow. So, this flow
is a stream of packets from a source to a destination now when we call as a source to
destination there can be multiple such definitions. It can be a machine to machine
communication, so we want to ensure quality of service between two machines, it can be
process to process communication like we want to provide quality of service between

661
two different processes when they are communicating with each other. We may want to
ensure quality of service from application to application or from socket to socket,
different ways we can define the two end of a flow. Now, different flows require different
levels of quality of service and accordingly we need to provide quality of service to those
flows.

(Refer Slide Time: 34:40)

Now, another important question is that why quality of service is considered at the
network layer, because maintaining quality of service requires both per hop and end to
end behavior. So, whenever you want to ensure quality of service over the network, say
you have these two different end host and between these two different end hosts you
have multiple intermediate routers or switches.

Now, what you have to do you have to see that what is this end to end requirement to
ensure quality of service, what end to end bandwidth you want to ensure, what end to
end delay you want to ensure, what end to end jitter you want to ensure, or what end to
end data loss you want to ensure, but to ensure this you have to this reserve the resources
at every individual hop of the network. So, to guarantee quality of service you require
this per hop behaviors or you need to reserve the resources at every individual hops in
the end to end path.

So, that is why we need to consider quality of service by considering the information
from end to end perspective as well as per hop perspective. Now, if you look carefully

662
this network layer it sits in between the transport layer and the data link layer. So, the
data link layer considers per hop behaviors and the network layer provides you this
routing over that individual hops whereas, the transport layer it gives you the end to end
information. So, you can get a feedback from the transport layer and apply the things to
the data link layer. So, that is why you implement quality of service at the network layer.

(Refer Slide Time: 36:20)

So, that is the point I have this mentioned resource reservation need to be on per hop
basis otherwise end to end requirements cannot be guaranteed and because the network
layer bridges the end to end like the transport layer and per hop the data link layer you
implement quality of service at the network layer.

663
(Refer Slide Time: 36:37)

Now based on the quality of service we define multiple application classes like the
constant bit rate classes. So example of constant bit rate is telephone applications like
Voice over IP. So you require constant streaming of data bits. Then the second one is the
real time variable bit rates. So, in case of real time variable bit rate example is some
video conferencing service where the bit rate can be variable depending on the frames
that you are going to transfer, but it need to be a real lifetime.

The third one is non real time variable bit rate like on demand video streaming. So, for
example, television service over IP network. So, if you want to observe a TV over IP
network, it is a variable bit rate at the same time it did not to be in real time and then
available bit rate service at the best effort service like the file transfer services. So, we
look into all these classes of traffic in more details. And, in the next class we will look
into that considering this different level of quality of service or different classes of
quality of service, how the network should design itself so, that it can provide the desired
level of quality of service.

So, hopefully you have got a basic idea about what quality of service means and in the
next class we will go to the details about how the network actually provides quality of
service in the internet.

So, thank you all for attending this class.

664
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 32
Internet QoS – II (Basic QoS Architecture)

Welcome back to the course on Computer Network and Internet Protocols and in the last
2 class we were discussing about quality of service in the internet and we have looked
into the basic definition of quality of service and what is mean by quality of service and
what are the parameters that impact quality of service and we have seen that 4
parameters, a bandwidth delay jitter and loss they have an significant impact on the
network quality of service. And whenever we are trying to ensure quality of service over
the internet we need to have a control over these 4 parameters.

Now, we look into that what support do we require from the TCP/IP network to ensure
the quality of service in the network. So, we look into the architecture in details in
today’s lecture.

(Refer Slide Time: 01:17)

So, as we are discussing in the last class that based on the quality of service, we can have
multiple classes of applications, we can have constant bit rate application, constant bit
rate application means in us so, in short form we call it as a kind of severe application.
So, in case of severe application you expect the data at a constant bit rate. So, the

665
receiver expects that the data will be coming at a constant bit rate and then the receiver
will process that data and we will be able to render the data further.

So, the example of constant bit rate requirement QoS requirement is telephone
application or these voice over IP application. Say whenever you want to make a VoIP
call to make a VoIP call you have to transfer the data or the voice data over the IP
network. So, whenever you are transferring the voice data over the IP network, the voice
is actually converted to a digital signal, the voice signal is digitized and after digitizing
the voice signal that data need to be transferred at a constant bit rate.

Then the second class is real time variable bit rate. So, here the bit rate can be variable,
but you need to transfer the data in real time. So, by real time we mean that there is a
maximum delay by which you need to send the data. If you fail to send the data by that
time then your transfer your data transfer we consider to be failure. So, the example of
real time variable bit rate is the video conferencing or live streaming.

Then the third class is non real-time variable bit rate. So, here you do not need to send
the data in real time you do not have a such strict delay requirement that by within this
time you have to transfer the data. Buffering is supported, but you require certain QoS
still you have a kind of loose delay on the loose bound on the delay or loose bound on
the amount of packet loss that can be tolerated and that is example can be on demand
video streaming or IPTV kind of services.

And then finally, comes to the fourth class of service, which we call as the available bit
rate or the best effort service. So, best effort means whatever is the available bandwidth
now in the network you utilize that bandwidth for transferring the data for say file
transfer. For file transfer as such we do not need any strict requirement on the quality of
service parameters you can transfer it with whatever available bandwidth is there in the
network. So, that kind of transfer we call it as available bit rate transfer or Best Effort
transfer.

666
(Refer Slide Time: 04:06)

So, this is the basic quality of service architecture in the internet. This figure I have taken
from a Cisco website and the link is given here. So, you can see that there are multiple
stages in this enter end to end pipeline. So, let us explain this figure and then we will go
to the internals of every individual step. So, the packets are moving from one end into
another end and at every individual step we are applying certain filters, filters means we
are actually looking into the property of this packet and taking certain kind of corrective
measurement to ensure quality of service in the end to end application perspective.

So, the first thing is kind of admission control. So, if you remember whenever we
discussed about that what is our expectation from the network to ensure quality of
service? One expectation was to find out whether the network can take or the whether the
network can accept more flows without violating the quality of service of the existing
flows. Now to ensure that we have the first module which is called the admission control
module.

So, what this admission control module does?

It basically admit a new flow in the network by ensuring that even if you are admitting
this new flow in the network and if you know that what is the quality of service
requirement for that particular kind of flow. So, this requirement we call it as service
level agreement or SLA. So, we will discuss all these terminologies in details later on
just giving you a broad overview kind of backside view of the entire system.

667
So, based on the service level agreement you know that, what is the expected QoS level
for this particular flow? Now whenever you are entering this flow in the network during
that time you try to estimate that, if you enter this flow in the network, then whether you
will be able to satisfy the quality of service for all the existing flows plus this new flow
in the same network or not. If you are able to do that then you admit or allow that new
flow to transfer the packet otherwise you block that flow.

So, that particular module is termed as admission of control. After the admission control
is done then the next step is classification and marking. So, what this classification
module does? The classification module basically identifies the classes of packets which
are there. So, as you have discussed that there are 4 different classes of application, they
are kind of broad classes in different network context you can have much more granular
definition of quality of service classes.

So, considering those 4 classes of service, the guaranteed bit rate or the constant bit rate,
the real time variable bit rate, the non real time variable bit rate and a best effort are
available bit rate. You classify and mark the packet that which packet require say
constant bit rate, which packet require non-real time variable bit rate, which packet
required real time variable bit rate and which packet requires this available bit rate. So,
basically does not require any particular bit rate.

So, based on that you mark the packet so, just like a blue packet, a red packet, a green
packet, or a yellow packet, like that and then go to the next filter next level of filters.
Now all these filters are actually implemented at all the layer 3 devices; that means,
inside the router. So, inside the router so, we implement all these individual filters that
we are currently talking about.

And the third filter is traffic policies and markdown. So, what traffic policing looks into,
traffic policing in looks into that whether certain kind of flows or certain kind of packets
in the flows is significantly violating the quality of service requirement or not. If it is
violating the quality of service requirement then you simply drop those packets. So, the
idea is there that if you know that well your end to end delay requirement is say 10
millisecond, let me explain it with the help of an example figure say your end to end
delay requirement is 10 milliseconds.

668
(Refer Slide Time: 08:56)

So, you have a host, a source host, then coming to an intermediate router and then there
is this destination host. And in between you have an intermediate network through 2
different networks they are say connected OK. So, in this network now say that end to
end delay requirement is 10 milliseconds so my end to end delay requirement is 10
millisecond.

Now one up once so you are sending a particular packet say you are sending a particular
packet from the source and once this packet reaches to this router then this router finds
out that the packet has already experienced 9 millisecond of delay. If the packet has
already experienced 9 millisecond of delay and this router is very sure that it is
impossible to transfer this packet to the destination within 1 millisecond.

So that means, if the packet has already experienced a 9 millisecond delay, then within
10 milliseconds you have to send it to the destination; that means, within one millisecond
you have this remaining one millisecond you have to send the packet from this router to
the final destination. And the router knows that it is totally impossible. If that is the case
then what the router does, the router simply drop this packet.

Why the router drops this packet? The reason is that you know that you will not be able
to satisfy the quality of service for this particular packet. If you are not able to satisfy the
quality of service then there is no meaning to send that packet unnecessary to the link,
because it will again clog the link it will take certain bandwidth, it will reach at the final

669
destination, the application again need to process that packet. So, there is a hell lot of
overhead which are associated with this entire process.

So, if you are sure at a intermediate step that you will not be able to satisfy the quality of
service requirement for some specific packets of some specific traffic classes then you
immediately drop those packets. Coming back to the stages so that is called the policies
and - policing and markdown.

Then the next step is scheduling, scheduling where we applied the queuing and the
dropping policies. So, scheduling means based on individual requirement of traffic
classes we basically prioritize individual packets, prioritizing individual packet means
say again let me give you an example.

(Refer Slide Time: 11:53)

Say your packets are coming to an input link and you have multiple service queues. OK.
So, say this is a red queue, I have a blue queue and I have a say yellow queue. Now these
3 queues has 3 different priority levels. So, say the red queue has a priority of 1, the blue
queue has a priority of 2, and the yellow queue has a priority of 3. So, priority 1 means it
is the highest priority and priority 3 means it is the lowest priority.

Now, the scheduling works in this way, say if you are receiving a red packet then this red
packet you put it in the red queue ok. So, red packet means say that this is a voice packet.
So, red means voice say voice has the highest priority because we have seen that it has a

670
very strict requirement on delay jitter and bandwidth. So, say red means voice. So,
whenever you are getting a voice packet you are putting it in the say red queue.
Whenever you are getting a blue packet say this blue packet is assume it is a video
packet the second class of traffic you are putting it in the blue queue.

And whenever you are getting a yellow packet, say yellow packet means data it is the
lowest priority as we have seen. So, whenever you are getting a yellow packet you are
putting it in the yellow queue. Now here you have the server that we will finally, serve
this individual 3 queues in a round robin fashion and there you apply this priority
queuing mechanism. So, the priority queuing mechanism says that if you have some
packets in the red queue you first transfer those packets.

So, this is the first transfer if the red queue is empty then only you go to the blue queue
and transfer the packets besides the second priority and if both the red queue and the blue
queues are empty then you transfer the packets from the yellow queue. So, this is the
least priority. So, that way you are ensuring that the voice traffics which are there in the
link they are getting highest priority and they are transmitted first. So, that they are strict
QoS delay requirement gets satisfied.

So, this is just an example of different kind of scheduling mechanism this is not the only
scheduling mechanism which is a used or which is implemented in the network. So, this
is one type of scheduling mechanism which is called priority queuing. There are other
kind of queuing mechanism like custom queuing, weighted fair queuing, fair weighted
fair queuing and so on. So, we will discuss those in details later on. So, the scheduling
means scheduling the packets in different application queues based on our different flow
queues based on their QoS requirements ok.

Then the step which we call as the traffic shaping. So, traffic shaping basically tells that
say in a link you are getting the packets. So, traffic shaping actually ensures that smooth
jitter in the network, it controls the jitter in the network say you are getting the packets at
random delay, now you send it to a shaper. The shaper will output the packet at a
constant rate. So, you are actually getting the packet at with the jitter introduced. So, the
shaper will remove the jitter and send it to the outgoing queue. So, that is the objective of
the traffic shaper so, that you can regulate the flow of traffic over the outgoing link.

671
So, it is a kind of traffic regulator and finally, we apply certain link specific mechanism
like if it is a wi-fi links, then wi-fi has their own QoS service QoS provisioning service
like a prioritizing traffic for link layer, channel access and so on. So, these link specific
mechanisms are finally applied. So, this is the broad mechanism, broad QoS architecture
through which we try to guarantee end to end quality of service in the internet.

So, we will now look into all these individual steps in little more details.

(Refer Slide Time: 16:40)

So, let us start with admission control as we are mentioning that admission control
ensures that new flows are entered in the network only if the quality of service of all the
existing flows including the new flow can be satisfied.

672
(Refer Slide Time: 16:59)

So, you have actually experienced this context of admission control, many of the time
whenever you are dialing over say the cellular network you have hard disk space like all
lines are busy please dial after sometime.

So, whenever you are hearing this voice that is actually blocking your call because the
cellular service provider it does not have sufficient amount of resource to ensure the
minimum quality of service for your call. So, that is why it is blocking your call and for
long distance call it is pretty common that it will say that, all lines are busy please dial
after some time. So, it is like that the network does not allow new flows if all the
network resources are blocked in servicing the existing flows based on their quality of
service requirement.

So, that is the first phase of maintaining quality of service. So, you do not admit a new
flow if you cannot support quality of service for all the flows including the new flows.

673
(Refer Slide Time: 18:01)

The second mechanism was classification and marking as I have mentioned that
classifies the packet based on their application QoS requirements and then mark the
packets accordingly.

(Refer Slide Time: 18:13)

So, to classify it in case of IP we use a header in the IP header field it is called the IP type
of service. So, we have a 8 bit field, 8 bit type of service field in the IP header in that
type of service field in the IP header you have 3 bits for IP precedence.

674
So this IP precedence value it define different kind of traffic say if the precedence value
is 0 then it is a kind of routine packets. Then if the precedence value is 1 it is the highest
priority packet, if the precedence value is 2 it is the immediate priority packet, if it is a
priority 3 it is a kind of flash packet, if it is priority 4 flash override packet, for 5 the kind
of critical packet, for 6 it is internetwork control packets 7 it is network control packets.

So, that way we define these 8 different classes of traffic based on the IP precedence.
Then the next 4 bits it actually defines the priority inside the classes for example, if you
want to send voice video voice and streaming video simultaneously, you can use it under
this critical class and under the critical class you can again relatively prioritize a voice
give more priority to voice over the video traffic.

So, that way this 8 bit IP type of service header can be type of service field in the IP
header can be utilized to identify or to mark the packet to a specific quality of service
class.

(Refer Slide Time: 19:57)

Now, the third filter which we apply for quality of service it is policing and markdown.
So, policing and markdown means monitor the flow characteristics and take appropriate
action based on the flow QoS.

675
(Refer Slide Time: 20:13)

So, for traffic policing as we are mentioning initially that we have a terminology called
service level agreement. So, this service level agreement says that you have an
agreement or a contract between the customer and the service provider to maintain the
quality of service of an application. Say for example, if you want certain quality of
service for the VoIP data, for the VoIP data, you have to go for a service level agreement
with your service providers. Say if you are purchasing network from Airtel or from say
Vodafone. With the service provider you have to make an agreement that well I want to
transfer the VoIP traffic, for that VoIP traffic I require this class of service. So, for that
what is the money that I have to pay?

So, you have to pay that much of money and in that case you have a service level
agreement or SLA with your service provider. Now this SLA will determine that how
your packets will be treated when the packets are going over the network. Say one
interesting example of service level agreement is whenever you are subscribing for say
broadband connection. So, whenever you are subscribing for broadband connection there
are you will see that there are multiple packages say you can have 1 Mbps of leased line
for 1 month, you have can have 256 Kbps of leased line for 15 days and so on.

So, these packages are kind of service level agreements. So, they are saying that
whatever data you will send for that data we will try to give you 1 Mbps of peak
bandwidth or 256 Kbps of peak bandwidth. Many of the time you will see that there is a

676
differentiation between the uplink traffic rate and a downlink traffic rate. So, it will say
that you can have 256 Kbps of uplink rate and say 1 Mbps of downlink rate. All those
things are kind of service level agreement that you have with the service provider
whenever you are subscribing for a specific package for getting your internet connection.

Now, this kind of service level agreements are actually also embedded in the IP packets
and this is one example of configuring service level agreement in a particular router that
track 10 IP SLA 11 reachability and agreement is delay down 15 up 15; that means, in
the downlink it can tolerate up to 15 millisecond delay in uplink it can also tolerate into
up to 15 milliseconds of delay.

So, this is one service level agreement which has been configured in a particular router.
So, I have just taken the trace of a router to show you that this way you can configure the
service level agreement in the edge router or the gateway routers of a specific network
service provider. So, the network service provider so, whenever you are going for a
service level agreement the network service provider actually writes down all those
service level agreement in the network based on this their policies based on their their
architecture and so on.

(Refer Slide Time: 23:40)

Now, this traffic policing it monitors the flow of traffic and mark them to take
appropriate action, like whether you want to reduce the priority or whether you want to
drop the packets and so on ok.

677
Next the fourth step was traffic scheduling as we have mentioned that based on the
markdown by different traffic policers, the scheduler schedule the traffic into output
buffers of an interface.

(Refer Slide Time: 23:58)

And the example that I was discussing in the terms of priority queue that you maintain
multiple queues at the interface, the scheduling mechanism service the scheduling
mechanism services the queues based on the scheduling policy. So, one example is the
priority queue that I was mentioning. So, on arrival of a packet you classify the packet
and then put it either in the high priority queue or in the low priority queue.

If you are in the high priority queue you will be serviced first compared to a customer at
the low priority queue. So, the link will sub it one by one and send a packet in the
outgoing link. So, that way you are giving priority to certain classes of traffic which will
experience better quality of service compared to others.

678
(Refer Slide Time: 24:47)

Finally, the traffic shaping as you are mentioning the so, the traffic shaping control the
outgoing traffic rate, irrespective of the incoming traffic rates. So, you are always
regulating that what is going to be your outgoing traffic rate. So, either it has constant bit
rate output from the interface buffer or you also want certain delay or certain jitter based
on the application requirement.

(Refer Slide Time: 25:12)

So, here is the example of traffic shaping. So, you are having irregulated traffic at the
input and at the output you are getting the regulated traffic, which by the from the figure

679
you can directly see that it is minimizing the jitter in the network. So, output traffic has a
constant packet rate so it reduces the jitter in the network.

(Refer Slide Time: 25:35)

Now, these there are 2; this 2 different terms the traffic policing and traffic shaping. So,
let us look into the difference between traffic policing and traffic shaping.

So, traffic policing what it tries to do it just looks that whether certain flows or certain
packets are violating the QoS service requirements or not. So, you are getting the traffic
at this rate and your expected traffic rate is this dotted line, in that case whatever are the
peaks you just drop those packets. So, this is your traffic policing.

So, you see whenever whether something is violating the requirement if someone is
violating the requirement you drop the packet. In case of traffic shaper it does something
the traffic shaper it actually have this irregulated traffic and it tries to regulate the traffic
further.

So, you are regulating the traffic at the expected traffic rate. So, this is the difference
between traffic policing and traffic shaping. So, we require both in the network because
see traffic shaping can may not always be able to give you a smoother rate. If you are
average rate is more than this expected rate then traffic shaping will not work directly in
that case, you have to apply the traffic policer to drop the packets, which are violating the
quality of service requirements, which are violating the service level agreement then

680
from the remaining packets where your average rate or your mean traffic rate is less than
your expected bound, then you can apply traffic shaper to regulate the output rate.

So, remember this difference between traffic shaping and traffic policing. So, this gives
you a kind of broad overview of the basic QoS architecture and in the next class we will
go to more deeper inside this 3 components which are very important from the QoS
perspective, the traffic shaping, traffic policing and traffic scheduling. So, we look into
the details of these individual filters that we apply for quality of service.

So thank you all for attending this class.

681
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 33
Internet QoS - III (Traffic Policing and Traffic Shaping)

Welcome back to the course on Computer Network and Internet Protocol. So, we are
discussing about internet quality of service in details.

(Refer Slide Time: 00:26)

So, in the last class, we have looked into the broad internet QoS architecture. Today we
will look further into 3 important aspects of internet quality of service traffic policing,
traffic shaping and traffic scheduling.

(Refer Slide Time: 00:42)

682
So, let us start with traffic policing and traffic shaping. So, in the last class we were
discussing about the difference between traffic policing and the traffic shaping. So, what
we have seen in case of traffic policing, you just look into the peaks which are violating
the required quality of service and if they are violating you simply cut them out and drop
those packets. Whereas, in case of traffic shaping what we are doing that to apply traffic
shaping, you actually smooth out this entire this entire rate which is there.

So, in general in a network whatever mechanism we are apply for ensuring traffic
shaping or traffic policing we actually apply similar kind of mechanism. So, in a typical
network having perfect guarantee of a constant bit rate is very difficult. Because the
packets are going via multiple routers one after another and that is why we do certain
level of approximation and that approximation actually combines both traffic policing
and traffic shaping all together.

So, the idea is that what you do that you design a mechanism such that your output rate
will get regulated and at the same time the additional packets which are there which will
not be able to confirm to the quality of service policies that will get violated. Now to
solve this let us look into the mechanism that we can apply here.

(Refer Slide Time: 02:23)

683
So, the first mechanism that we are going to talk about is leaky bucket algorithm. So,
although in the slides I have mentioned that leaky bucket for traffic policing, but as I
have mentioned the ultimate mechanism is a combination of traffic policing and traffic
shaping. So, this leaky bucket mechanism by idea it is very simple, the idea is that you
have a bucket just what you are seeing in the example.

So, you have a bucket and you have a hole here. Now if you just think of like pouring
water in that bucket what will happen like from that hole based on the size of the hole
you will get the output at a constant rate. So, you will get a constant rate out and if you
put more water rather than the capacity of the bucket then the additional water will get
overflowed from the bucket.

So, that way the capacity of the bucket is actually confirming the requirement for traffic
policer, like if you are exceeding this much of capacity at a time then you drop out or you
delete drop the additional packets additional data packets which are there. And this size
of this hole it will actually trigger that at what constant rate you will send a packet to the
output queue. So, that is the idea of leaky bucket algorithm. So, incoming packets are put
in the packet queue. So, this particular queue we call it as a packet queue.

So, incoming packets are put at the packet queue. So, this packet queue works like a
bucket and a single server queue with constant service time that particular server serves
the queue. So, here in this queue so, I am just drawing it in the queuing notation. So, you
have a single server queue and this single server queue always output at a constant rate r.

684
So that means, whatever be the packet in that particular queue, then you will take packet
out of the queue at a rate of r packets per second, say I am assuming that all packets are
same. Otherwise you can go for bit per second that how many bits are coming in the
queue and how many bits you are taking out of the queue. So, you are getting data at
some rate say capital R and packets are getting input in a queue and we are using a
constant size queue, say the capacity of the queue as we have mentioned here is tau. So
you can hold as much as many that much of packet in the queue and it serves at a rate of
r.

So, at the output you will always get a constant rate service at r packets per set or I will
better say it is the maximum thing like you will get maximum at r packets per second if
there is no input data in the queue; obviously, you will not get anything at the output. So,
it sometime drop from r otherwise you will get at a peak rate of r packet per second and
if your input gets more than tau if you are trying to push more than tau packets, then it
will get dropped. So, this part where we are taking it out at a constant rate it is applying
traffic shaping and this size it is applying traffic policing.

(Refer Slide Time: 06:11)

So, the diagram would be something like this that you have an input of something at say
some peak rate and whenever you are getting the output the output is having at a say this
is my rate r, if this is my rate r then you are getting it at a rate if there is some additional

685
packet here due to this peak those additional packet gets dropped if the queue becomes
full.

So, if queue full, then those additional packet gets dropped otherwise those packets are
transmitted at a rate and whenever there is a drop in the rate well this additional
bandwidth will something get consumed here. But then you can see a little grip here due
to this drop again whenever it is increasing it will increase and, but it will always
maintain the maximum of this constant rate r. And then if whenever there is a drop it will
again drop and here from here also if the queue becomes full you can experience certain
packet drops.

Now, this diagram you can see that it is little violating from the diagram of traffic
shaping that we have shown earlier the ideal diagram of traffic shaping was something
like this that it will always maintain a constant rate, but ensuring that in a typical network
is difficult because your output rate also depends on your incoming rate, like the rate at
which the application is generating packet. Obviously, if the application is not generating
any more packets, we will not be able to serve those packets and this dips in the rate are
actually because the application is not generating any further data. So, that is why you
are observing a drop in the rate, but if otherwise the application is generating rate you
will get at that particular rate. So, and that is the case that is the output case. So, that way
we are actually applying traffic shaping and traffic policing together with the help of this
leaky bucket algorithm.

(Refer Slide Time: 08:22)

686
We will go for another algorithm for traffic policing and shaping it is called a token
bucket algorithm. So, the token bucket algorithm the idea is little interesting and it
supports something called traffic burst.

So, the idea of this token bucket algorithm is something like this you have a bucket a
token bucket. Inside the token bucket, you are inserting the tokens at a rate of r and this
token bucket also have a size of b. Now apart from this token bucket you have another
packet queue in the packet queue whenever whatever packet you are receiving you are
putting that packet in the packet queue. Now you have the scheduler, what the scheduler
will do?

If there is a token in the bucket it will take out the token take a packet and send them out.
Now these tokens are kind of logical token, it is not a kind of physical entity. So, the idea
of the token bucket is that you regulate the traffic in such a way, so that if there is
available tokens in the token bucket, then only you will be able to send a packet at the
output. Now what is the difference between token bucket and leaky bucket, let us try to
visualize that.

(Refer Slide Time: 09:38)

687
So, in case of leaky bucket what was happening, you had this leaky bucket and a small
hole in this leaky bucket. So, whatever packet you are getting here you are taking it
output at a constant rate. Now in that case if there is a no at a constant rate r in that case
if there is no packet then there would be no output.

In case of leaky bucket what is happening, you have that is in leaky bucket in case of this
is for leaky bucket, in case of token bucket you have this token bucket you have inserting
tokens at a say at a rate token generation rate of say b I am just putting some arbitrary
parameter at a token generation rate b and it has some size say h. And you have a packet
buffer where the incoming packets are weighted keeping weighted and then this server it
actually multiplex the token bucket and the leaky bucket all together. The idea here is
that if there is no packet here if there is no incoming packet here, then the tokens are
getting added right.

So, if there is no incoming packet then the token is getting added. So, the moment you
are getting a packet now you say at a instance of time you are getting 10 packets and
during that time, you had some 6 tokens in the token bucket. In that case what can you
do? You can immediately transfer these 6 packets in the output rather than sending it one
by one. So, that is the difference from the leaky bucket and the token bucket, in case of
leaky bucket you have to always send the packets one by one ok.

So, there is no such concept of traffic burst that even if you have not utilized a bandwidth
previously, you can utilize it right now and send a burst of traffic at a moment. Here in

688
case of token bucket it is supporting that in case of token bucket there is a maximum
burst length. So, this is the maximum burst length so the maximum amount of tokens that
can be generated in that token bucket. So, you can get a kind of burst traffic.

So, burst traffic means say you are making a say regulation of traffic then say, the
packets are not there. So, you are observing and drop and during that time the tokens are
getting inserted the logical tokens are getting inserted the moment you got some new
packet immediately. You can send a burst of packets altogether and then again can say
after sending these burst of packets you can start doing the regulation, based on the token
generation rate. So, you are generating that token at b tokens per second. So, that is the
difference between token bucket and leaky bucket.

In case of leaky bucket if I draw the same graph it will look something like this. So, this
burst will not come here. So, this kind of peaks we are allowing in case of token bucket
algorithm which we call as the data burst. So, that is the difference between token bucket
and leaky bucket. So, the idea of token bucket came into practice because sometime it
happens that you are not utilizing the bandwidth.

If you are not utilizing the bandwidth then whenever you are getting some additional
data that may be of higher priority to you. So, rather than trying to shape it immediately
send the entire data to the receiver side. So, for say kind of buffered video streaming, this
kind of architecture is sometimes very useful because you will send more data to the play
buffer, if you send more data to the play buffer it will get sufficient data and a video
player can render further data with the available data in the buffer.

So, coming back to this concept of token bucket algorithm so, as I am mentioning that
incoming packets are put in the packet queue; say I assume that the token generation rate
is r tokens per second at that rate the tokens are getting generated remember that these
tokens are the virtual token. So, we are just you can think of in the implementation side
in the program you have implemented the token bucket and you are observing that
whether there is a token there or the not. If there is a token then you sending the packet
to the output queue.

So, the token generation rate is r tokens per second and the bucket size is b. Now the rate
of the output traffic it is bounded by the token generation rate you will not be in
generally we will not be able to surpass that. But if you have more data immediately you

689
can send it further. So, the output rate you can characterize it in this way say, Pt it
denotes your incoming packet rate. So, this line Pt it denotes your incoming packet rate
and this b plus rt it denotes your token generation rate ok.

So, if that is the case then your output rate will be minimum of Pt and b plus rt. So, your
output rate will be when your incoming packet rate is less than this b plus rt, you can use
that whenever it becomes at this cross section it overshoots b plus rt then you send the
data at a rate of b plus rt. So, that actually gives you the output rate.

Now here this gives you so this b is the initial token bucket size and this cross point and
at this packet side. So, this side I am showing we are showing packets and this side we
are showing time. So, at the packet side this particular length will give you the maximum
burst sizes.

(Refer Slide Time: 16:35)

Now let us try to estimate the maximum burst size. So, we had Pt as the incoming packet
rate. So, we can just write it as Y equal to Pt at the Y axis. So, the Y axis is denoting
packets that have been received and X axis which is denoting time and this is that
cumulative number of packets that you are receiving with respect to time. Let us write it
cumulative number of packets that you are receiving with respect to time. So, this is Y
equal to Pt. Now with this let us have the rate for this broken bucket. So, this red line
gives you the token bucket. So, this is the bucket size b and then and then so, the notation
that we used earlier that b plus rt.

690
So, Y equal to b plus rt. So, you are inserting token at a rate of r. So, your cumulative
number of token will be rt. So, initially you have be number of token initially we are
assuming that the token bucket is full from that point we are starting after that you are
inserting token at a rate of rt. So, you are getting it at a rate of the cumulative rate is Y
equal to b plus rt.

Now this particular point the cross section at time T it will give you. So, this is equal to
say T equal to t1 this will give you the maximum burst size. Now let us try to estimate
this maximum burst size, why this will give you maximum burst size at this point you
can get the maximum output data. So, to find it out what we can do we can find out this
cross section.

So, just at point t1, we can write down Pt 1 equal to b plus rt1 at this cross section point
from there you can find out t1 equal to b by P minus r. Now putting this value of t at say
Y, you can put it in any of this equation you can find out say if I write it as Y1 equal to
MBS Y1 will be Pb by P minus r this particular quantity. So, this will give you the
maximum burst size that can happen in case of a token bucket algorithm.

So, with this estimation, let us go back to our discussion. So, that way this kind of token
bucket algorithm in contrast to leaky bucket it is supporting burstiness well. (Refer Slide
Time: 20:07)

So, here is the difference between the leaky bucket versus token bucket algorithm. So,
the leaky bucket algorithm it smooth out traffic, but it does not does not permit

691
burstiness. Whereas, token bucket it smooth out traffic and also permit burstiness if there
is no incoming packet tokens are get added to the in the token bucket and the bus traffic
is permitted up to the amount of token that has been accumulated.

So, that particular calculation we did earlier. So, we actually calculated the amount of
token that can get accumulated up to this point because after that it will your output rate
as we have seen. So, if we draw the output rate your output rate will follow this line. So,
whenever your Pt is less than b plus rt. So, your output O it will be equal to minimum of
Pt and b plus rt.

So, during that time you did not have sufficient amount of packet to take it out. So, that
is why those at that time those tokens are getting accumulated here accumulated in the
token bucket. And at this point you have reached at the peak of the burst and then you
have transferred the data at the constant data.

So, if I just put it in terms of amount of so, here we have shown the cumulative number
of packets, if in the y axis if I show packets per second and in this type time. So, the
graph will be something like this, whenever you are getting the incoming packet you will
have it then there is this burst after the burst you are you will send it at a rate of this rt.
So, here you will send at a rate of rt this was your token generation rate r you will send it
at a rate of rt and here you got this burst. So, this is my burst size that we have estimated
here.

Now, as you are mentioning that both the leaky bucket and the token bucket algorithms
can be used for traffic shaping. And so, the difference that I have mentioned earlier that
with this leaky bucket and token bucket what happens that, sometime your rate can go
deep although you are expecting the average rate r. But if the application is generating
less amount of data, it can go at the lower side in that case for this data what you can do
possibly if you want a complete smoothed rate of the original figure that we shown
initially. If you want data at that particular depth what you can do that you can add an
additional playout buffer.

So, playout buffer is an additional buffer, which can be added in front of your traffic
shaper. So, the idea of the playout buffer is to introduce additional delay to the packets
which come first. So, here you had this deep because you had certain packets which
came faster.

692
So, you can introduce some delay to additional delay to those packets and to this
additional delay you can experience something more similar to that. For some very strict
application, we sometime apply this kind of playout buffer to introduce the additional
delay.

So, this is all about leaky bucket and the token bucket algorithm in details for ensuring
traffic shaping and traffic policing. In the next class we will look into the different kind
of traffic scheduling algorithms which are there by applying different type of queuing
mechanisms, like priority queuing, weighted fair queuing, custom queuing and so on.

So thank you all for attending this class.

693
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 34
Internet QoS – IV (Traffic Scheduling)

So welcome back to the course on Computer Network and Internet Protocols.

(Refer Slide Time: 00:21)

So, in the last 3 lectures we have looked into the basic quality of service architecture to
provide quality of service over the internet. So, today we will dig again further to look
into different kind of a queuing and congestion avoidance strategies, which we apply to
provide the quality of service to different applications.

694
(Refer Slide Time: 00:38)

So, we start from this point that we have already seen earlier, in the basic quality of
service architecture what we have seen that whenever the packets are coming to the
network. First you have to use this admission control strategy to enter the flows in the
network for which you can support the desired quality of service requirement.

Then we do something called a classification and marking. So, this classification and
marking it is used to mark individual packets, based on their quality of service classes
like the red packets, blue packets or green packets.

Then we apply something called traffic policing, in case of traffic policing we have seen
we have seen that different type of traffic shaping and the policing mechanisms are
applied in intermediate routers. So, we apply different kind of traffic policing and
different type of traffic shaping mechanism.

Now, in between we have this module which we called as the traffic scheduling. So, what
this scheduling actually does? So, whenever you have this different marked packets by
like, the red packets, green packets, and the blue packets. So, now different marked
packets require different level of quality of service. So, because different marked packets
require different level of quality of service, you need to schedule those packets
accordingly at the intermediate routers. So, all these different gates that you are
observing here you can think of a intermediate routers of the network.

695
So, in that routers we need to apply the scheduling strategies to ensure the desired quality
of service for different marked packets either red packet, green packets and the blue
packet. So, you can think of the red packets as the voice applications like this VoIP
applications, which require strict quality of service. Say the green packet may be
something like a video on demand services, which also require another class of quality of
service. It requires more bandwidth and requires a less jitter whereas, this blue packets
are normal best effort services like this FTP based traffic delivery.

So, you need to give more priority to VoIP than the video and the less priority will be the
FTP. So, that way you need to design a scheduling strategy at individual routers so that
different level of quality of service can be ensured of different classes of packets. So,
today we will see all these quality of service in details. So, let us start our journey on this
quality of service concept.

(Refer Slide Time: 03:17)

So, to do the traffic scheduling as I have mentioned the first stage is this classification
and marking. So, this classification and marking it ensures that the marked data packets
they enter into the network and we divide them into different traffic classes like from the
users.

Say for example, whenever you are connecting your smartphone to the internet you are
enabling the data services over your smartphone during that time. So, if you have certain
level of quality of service associated with your service provider, then the smartphone will

696
or the smartphone or your SIM card will actually create one service level agreement with
your service provider, say the Airtel or BSNL that I want this much amount of service
and I am paying you money for this particular service so treat my packets accordingly.

Now in that case say for example, if you are going to have a VoIP service, voice over IP
services. So, this voice over IP services is still not very popular in India, but in many
countries they are very popular. So, if you are going to support this voice over IP services
from your smartphone, then your network service provider at the first hop router say the
base station where your smartphone is connected it should understand that will you are
going to transfer this VoIP data, voice over IP data. Now, whenever it understand that
you need to transfer this voice over IP data during that time it marked this particular
packets which are coming from your smartphone as the voice over IP data.

Now, remember that in your smartphone you can run multiple applications. You can run
Facebook, you can run YouTube and at the same time you can run voice over IP
applications. Now the network need to understand that this particular application is
actually voice over IP application and for that I should give the required resources for
ensuring quality of service of that VoIP application. So, that is why this kind of
classification and marking is requirements.

So, this classification and marking it marked the data packets into different traffic
classes. So, the mark traffics are of different priority classes and require different level of
quality of service based on the service level agreements. So, this SLA stands for service
level agreement, the service level agreement is something like whenever you are
subscribing to a particular network during that time, you say the network service
provider that I am going to use VoIP services and you should give me this much amount
of data for or this much amount of services you should ensure from your end to transfer
my voice data or VoIP data over your network.

So in that I think you have seen some level of service level agreement, whenever you are
purchasing certain packs from Airtel or Vodaphone or any other service providers, you
will see they mention something like that will provide you these minutes of free calling
send them 100 SMS per day then 1.2 GB of uplink data and 5 GB of downlink data per
day. This is one example of service level agreement that you have with your service
provider.

697
So, this is not application level service level agreement, but this is like user level service
level agreement. So, whatever data you are going to transfer you will get that 1.5 GB of
uplink bandwidth and 5 GB of downlink bandwidth if you have made a service level
agreement like that. So, that way all your applications will use that bandwidth, but you
can also do that application level service level agreement to it the network service
provider.

So, as I have mentioned just a couple of minutes back that these things are not very
popular in India, because you are not using VoIP services right now. And that is why you
do not see this kind of application level service level agreements, but once this VoIP
becomes popular and our network service provider migrates to the 5G cellular network
and start using or start providing VoIP services possibly we will see this kind of
agreements which are coming whenever you are going to purchase some packs from the
service providers.

Now, we have this different classes of traffics like it can be high priority delay sensitive
traffic like voice over IP, it can be high bandwidth requirement traffic like video on
demand or IPTV kind of applications, it can be best effort services like HTTP or FTP. So,
best effort service means that whatever bandwidth you get you try to transfer your data
over that bandwidth only.

(Refer Slide Time: 08:06)

698
Now, in case of scheduling whenever you have this different classes of traffic like what
we say here that we have multiple traffic classes here, say the traffic class 1 denotes the
high priority delay sensitive traffic. The traffic class 2 denotes the medium priority
bandwidth hungry traffic and the traffic class denote the low priority best effort traffic.
So, these different classes of traffic require different treatments. So, that is why, what we
go for is called multi class scheduling. So, this multi class scheduling ensures that
different traffic classes are treated differently and you provide the specific services by
your scheduling algorithm to the corresponding service class.

(Refer Slide Time: 08:49)

So, the solution is that in case of multiclass scheduling here is a possible solution to do
that say because your traffic class 1 was a high priority traffic. So, you ensure a
minimum queuing delay for this packets for the packets from those traffic class. So, what
we have seen earlier that queuing delay is the dominant component of delay and because
of the queuing delay we expect a significant loss in quality of service.

So, for traffic class 1 you ensure minimum queuing delay, for traffic class 2 you ensure
sufficient bandwidth because those are bandwidth hungry applications and traffic class 3
it is a best effort traffic. So, you do not have any specific requirements. So, you using
you start using the best effort services. So, whatever bandwidth you have you try to serve
using that.

699
So, now, to differentiate among this different traffic classes based on their requirement
we used different queuing strategies. So, this queuing strategies ensures that I have
multiple different queues in my device rather than maintaining a so, you have a single
packet buffer queue where all the incoming packets are getting entered.

Now, from that packet you apply the marking policy, the classification policy to classify
the packets into different traffic classes and put the packets into different queues. Say this
is a high priority traffic, this is a medium priority traffic and this is the low priority
traffic. So, you put it in different queues now different queues will be treated differently
based on the their queuing based on their a class requirements are based on their service
requirements.

So, in this queue we will apply one scheduling strategy, in this queue we will apply
another scheduling strategy and in the third queue we may apply a third scheduling
strategy. So, that way we will try to provide the quality of service support for this
different classes of services in together. So, that we call as the multi class scheduling.

(Refer Slide Time: 10:54)

So, here is the example of this multiclass scheduling, the similar kind of figure that I
have drawn earlier.

So, you have multiple different flows. So, this from this different flows the classifier
identifies that what are the different priority of traffic, say the green flow; that means,

700
flow 3 has the highest priority. So, it is put in the highest priority queue, then you have
this red and the red means flow 7 and yellow means flow 2 these 2 different flows which
are medium priority traffic. And this blue, indigo and green; that means, flow 6 flow 8
and flow 1 they are the low priority traffic so, you put them in that respectively. Then the
scheduler will run over these individual queues and send the traffic based on this
scheduling strategy to the output port.

So, we look into this different scheduling strategy in details and this scheduling strategy
are based on the queuing principles that we have. So, we look into different kind of
queuing principles for a multiclass scheduling.

(Refer Slide Time: 12:06)

So, the first scheduling that we are going to look into we call it as the priority scheduling.
So, what happens in case of priority scheduling, we have multiple queues of different
priority. Now we have a incoming traffic, the classifier classifies the incoming traffic and
put it into different queuing queues either in the high priority queue or in the medium
priority queue or in the low priority queue.

Now the scheduler in case of priority queuing the idea is that if you have some packets in
the high priority queue you first serve that packets. So, you first serve the packets from
this high priority queue only when this high priority queue becomes empty then you
come to the medium priority queue and serve it, when the medium priority queue
becomes empty then you come to the low priority queue and serve it.

701
Now, here the scheduler can be a preemptive scheduler on a non preemptive scheduler in
case of non preemptive scheduler you work in a round robin fashion and in that round
robin fashion it works in this way that, whenever there is some data packet in the high
priority queue you first transfer all the packets of high priority queue. When it becomes
empty you come to the medium priority queue transfer all the packets. When the medium
priority queue becomes empty you come to the low priority queue transfer all the packets
from the low priority queue and then go to the high priority queue the, that we call as the
non preemptive scheduling.

So, you are not non-preemptive scheduling. So, in case of non preemptive scheduling
what you are trying to do, you are actually applying a scheduling strategy where the
scheduler is not preempted or not broken in between. So, it serves this 3 priority queues
in a round robin fashion and whenever one particular queue becomes empty it moves to
the next priority queue.

(Refer Slide Time: 14:05)

The second type of priority queuing strategy you call is the preemptive priority
scheduling. In case of preemptive priority scheduling what happens that the scheduler
serves in the round robin way, but it may get preempted, preempted in the sense like say
for example, it had served all the packets from the high priority queue then it comes to
serve the medium priority queue. When it is serving the medium priority queue by that
time some packets come to the high priority queue. Then it will preempt the service at

702
the medium priority queue and immediately goes back to the high priority queue and
serve the packets from that high priority queue.

Again when the high priority queue becomes empty it will come to the medium priority
queue and then once the medium priority queue becomes empty it will come to the low
priority queue. But while serving the low priority queue again if a packet comes to the
high priority queue or the medium priority queue, it will preempt the service at the low
priority queue immediately you will return back and the serve the packets from that high
priority queue or the medium priority queue.

Now, in case of a preemptive service as you can understand that sometime the low
priority queue may get stuck because always you are receiving the high priority queue,
high priority packets or the medium priority packets. So, the scheduler is never able to
serve the low priority packets, but the advantage is that you are providing very less
amount of delay and you are ensuring low jitter for the packets at the high priority queue
and the medium priority queue.

So, it is like that whenever you can just think of the high priority queue as the VIP passed
line. So, the VIP’s need not to wait whenever they are going to that particular queue they
are immediately send 2 inside. So, in a airport you can think of that as a as the VIP gate.
So, that VIP is coming and they are served immediately. So, they do not need to wait,
similarly in the network perspective you can think of certain packets as those VIP
packets which who do not need to wait at those gates or the queues they are served
immediately. Even there is no one to serve them, no one to serve them then from other
gates people are taken and they are serve those VIP peoples. So, that is the concept
which is applied in case of a priority queue.

Now, that is the idea behind priority queue. So, we applied priority queuing to give
different priority to different packets say for example, you can think of the network
control packets. The network control packets are very high priority packets. So, if you
make a delay in the network control packets your entire network operation may get
affected. So, that is why whenever certain network control packets are generated
immediately those packets are served, if those are the high priority traffic. So, we do not
keep them waiting inside the waiting queues. So, this is one type of scheduling strategy.

703
(Refer Slide Time: 17:01)

The second type of scheduling strategy that we are going to discuss it called as the
custom queuing. So, what happens in case of custom queuing? So, you have different
queues of different lengths say for example, I am normalizing the queue length to 1 and
in this example the first queue has a length of 0.3 the second queue has a length of 0.2
and the third queue has a length of 0.5.

Now, in this context remember one thing that if you do not have sufficient number of
packets and if your network is very lightly loaded then it does not matter actually, then
quality of service indeed does not matter because you have a sufficient amount of
capacity and everyone will get served within their time bound. But the problem starts
occurring when the network capacity is not sufficient and during that time you are going
to push the packets in the network.

So, you can just think of the airport scenario whenever it is a non peak time say at at a
around 2 PM in the noon when there are not much passenger, so you in you go to the any
of the gates you will need to wait for a minimal amount of time. But if you go at the peak
hours when there are huge numbers of passengers in the airport then you have to really
think about this kind of quality of service. So, you have possibly seen that well during
the non peak hours whenever you are going at least that happened to myself a quite a few
number of times that I normally prefer flights at the non peak hours and during that time

704
whenever I go to the airport I find that well even I am being allowed through the VIP
gates.

So, it is something like that. So, no one cares about what is the quality of service because
the load is not very high, but the problem starts occurring when the load is very high and
you have certain congestion in the network and during that time you have to really think
of that what is happening inside network. So, this particular concept is actually important
in the context of this custom queuing, why? Let us see.

So, you have 3 different queues and in that 3 different queues of 3 different plane. So, the
first queue has length of 0.2, the second queue has a length of 0 point sorry the first
queue has a length of 0.3, the second queue has a length of 0.2 and the third queue has a
length of 0.5. Now, just think of what will happen at the peak hours. So, in the peak
hours all the queues are full and what the scheduler is doing? The scheduler is simply
applying a round robin scheduling.

A round robin scheduling means it is just taking one packet from the first queue, then one
packet from the second queue, then one packet from the third queue, then one packet
from the fourth queue, one packet from the again, one packet from the first queue, one
packet from the second queue, one packet from the third queue. Then one packet from
the first queue, one packet from the second queue, one packet from the third queue. So, it
is scheduling it in a round robin fashion.

But in the peak hours the queues are always full. So, when the peak queues are always
full and you are getting certain traffic if you do not have any passage in a queue, the
packet will actually get dropped. So, at what you are necessarily doing here? So, you are
actually providing 30 percent of your capacity to this particular queue, 20 percent of the
capacity to this particular queue and 50 percent of the capacity to this third queue.

So, that way this particular custom queuing mechanism where you have different queue
length and in the peak hour so, and there are lots of traffics which are coming for these
50 percent queue size it has more amount of spaces it can hold more traffic. So, it can
serve more amount of traffic from that particular queuing. And it can serve very less
amount of traffic from this 20 percent queue.

705
So, that way this custom queuing mechanism it supports what we call as the guaranteed
bandwidth. So, you can provide guaranteed bandwidth with the help of this kind of
custom queuing strategy. So, whenever you require guaranteed bandwidth like this video
kind of application you can use custom queuing mechanism.

(Refer Slide Time: 21:26)

Now, let us see the third queuing mechanism which we call as the weighted fair queuing,
again in the case of weighted fair queuing we have 3 different queues. But here you
consider that well the packet sizes may vary; in the earlier cases we have considered a
scenario when there are fixed packet sizes, but here the packet size can vary. So, what is
happening here? You can think of that the blue packets are of size 1 unit the red packets
are of size 4 unit and this green packets are of size say 2 units. Then in that case in case
of weighted fair scheduling, what we try to do? We want to ensure fairness among
different classes of traffic. So, we want to ensure that all these different classes of traffic
should get almost equal amount of bandwidth, then what you have to do? You have to
transfer 4 packets of one unit then 1 packet of 4 unit then 2 packets of 2 unit. So, you can
see that now total amount of blue packet is 4 unit, total amount of red packet is 4 unit
and total amount of green packet is again 4 unit. So, you are providing what we call as
the fairness in this particular system and remember that normally what we do that we
apply multiple queuing strategies together.

706
So, sometime you require providing priority classes and at the same time you need to
provide certain level of a fairness among the priority classes of that different traffic.

(Refer Slide Time: 23:04)

So, in that particular architecture what you can do, that after your packets are getting
classified, then you put it into different priority classes say this is a priority 1, this is a
priority 2, this is a priority 3. Now you know that in priority class 1 you can have
different packets of different sizes.

So, here in the first level we are applying say priority queuing, now at the second level
say for priority 1 classes, it can have different size packets it can have small packets as
well as large packets. So, that is why from here you can again apply something called
this weighted fair queuing. So, the second level of scheduling can be a weighted fair
queuing scheduling.

So, that way we can certain sometime applies multilevel queue scheduling. So, here this
first level of scheduling it ensures a priority scheduling, whereas, this second level of
scheduling it supports fairness in the system. So, that way we will be able to support both
priority as well as fairness in your system. OK.

707
(Refer Slide Time: 24:31)

Now, that these are the different type of queue scheduling which we have. Now we look
into another interesting concept which we call as the congestion avoidance in the
internet.

So, as we have discussed earlier that TCP it does not avoid congestion, what it does that,
whenever congestion occurs in the network then it responses on detection of the
congestion in the internet. So, what TCP does that, TCP detects congestion based on
packet loss and whenever there is a congestion detected then it ensures that a flow
performance does not get affected by the congestion and it tries to drop or reduce the
sending rate.

So, these congestion avoidance that we are talking in the perspective of internet that is
different from TCP congestion control. So, we are not actually controlling congestion
rather we are avoiding congestion. So, what we are doing, that we are ensuring that
congestion does not occur in the internet. So, this is like before the congestion actually
happens we are considering certain measures so that we can ensure that the high priority
traffic does not get affected due to congestion.

Now one interesting question that you can think of that if congestion avoidance is there
in the network layer, do we still need congestion control at the transport layer? Do you
still need the service from the TCP?

708
The answer is yes, we need why we need that particular service because whenever you
are applying the congestion avoidance algorithm you will see that we are actually again
applying congestion avoidance on class based.

So, we are ensuring that the high priority traffic does not go into the congestion, if at all
condition occurs in the net network that should occur under low priority traffic site. Say
for example, if you have VoIP services over your internet and at the same time you have
FTP services then this congestion avoidance algorithm ensures that the VoIP does not get
into the congestion. But well FTP can always get into congestion and in that case you
require congestion control algorithm for the TCP which is running the FTP to make FTP
come out of the congestion. So, that is the difference between the congestion control and
congestion avoidance.

So, in perspective of this congestion avoidance we actually require both in the internet,
we require both congestion control and congestion avoidance to support services over the
internet. Now, the reverse question is also there as I have already mentioned that if
congestion control is there we also require congestion avoidance to support quality of
service. Otherwise the voice traffic or the high priority traffic will also get into
congestion. Now, let us see that how we avoid congestion in the internet.

(Refer Slide Time: 27:36)

So, that is another problem that why congestion avoidance is necessary for quality of
service. So, internet carries multiple data packets from different applications having

709
different quality of service requirements and broadly we have 2 different classes of
traffics we call them as the elastic traffic and inelastic traffic.

So, this elastic traffics are the TCP like traffic which ensure elastic nature of flow control
based on the AIMD principle that we have learned earlier. So, it increases the rate
whenever there is no congestion and on detection of congestion it reduces the rate. So, it
has certain kind of elastic behavior. So, expand the rate and then reduce the rate, again
expand the rate reduce the rate.

In case of in a inelastic traffic, they are the kind of UDP traffics they are kind of
smoothed or the controlled or constant bit rate traffic. Now, these kinds of inelastic
traffic are preferred for real time applications, so why? Because they do not get affected
due to the overhead of TCP that we have. So TCP congestion control is always a
overhead for the quality of service of associated traffic. So, first of all you can think of
that in case of TCP because of this elastic nature you are actually introducing jitter in the
network.

Because whenever you have in, whenever you are increasing the capacity we will have
less amount of delay. Whenever you are dropping the rate you will have more amount of
delay for the application data. So, that way by TCP congestion control you are actually
introducing jitter in the network. So, that is why for real time traffic there are protocol
like real time streaming protocol or the real time protocol, RTP they prefer UDP based
constant bit rate delivery.

But do not get confused with YouTube, YouTube is not a real time, YouTube live is real
time, but your standard YouTube the thing that you are watching now it is not real time,
it is the video has been already recorded and now it is getting streamed.

710
(Refer Slide Time: 29:37)

So, just a kind of practice question for you that if you have elastic traffic and inelastic
traffic in your network, which traffic will dominate over the link? So, what will happen
here actually, if you have a elastic traffic, the elastic traffic will try to increase its
bandwidth.

So, whenever it will try to increase in bandwidth the inelastic traffic does not have any
control over that congestion and you will experience a significant amount of loss from
that inelastic traffic. So, there will have a adverse effect whenever you are transferring
elastic traffic and inelastic traffic together over the internet and that is why you require
congestion avoidance.

We required that the inelastic traffic that we have which is used to transfer a multimedia
data they do not get into congestion bit, due to this congestion control algorithm of the
elastic traffic because this elastic traffic they will increase the rate, whenever they will
increase the rate they will take more bandwidth. But inelastic traffic do not have any
control over that. So, you will experience more packet drop from that inelastic traffic.

711
(Refer Slide Time: 30:43)

So, the algorithm that we applied for congestion avoidance in the internet we call it as
random early detection or RED. So, in case of random early detection what we do first,
the first principle is that we drop the packets; we drop the packets for certain applications
to avoid the congestion. So, remember that to avoid the congestion, the only principle is
that if you are expecting that certain application is sending too much traffic which is
more than the capacity then you drop the traffic for those applications.

Now, if you drop the packets for those applications, so what we apply in case of random
early detection: that this drop probability it is different for different traffic. So, it depends
on the nature of the traffic, whether you are using elastic traffic or inelastic traffic or
what type of quality of service classes for that particular traffic has. So, this RED it
smooths out the drop probability across all the flows depending on the congestion
probability. So, it detects the possibility of congestion in the internet, if congestion
probability is high you randomly drop packets before enqueueing the packets.

So, this random term is important because of which we call this mechanism as a Random
Early Detection or RED. So, there are 2 term random and early detection. This early
detection is early detection of congestion we will see how we are applying early
detection of congestion and then we apply this random principle to randomly drop the
packets.

712
(Refer Slide Time: 32:15)

So, here is the principle of RED. So, first you determine the possibility of packet drop by
observing the average queue length. So, you have the incoming packet after incoming
packet you compute the average queue length, now you have 2 different threshold. One
is the maximum threshold, this maximum threshold is the maximum queue length
threshold a minimum queue length threshold and you have this average queue length.

Now, if your average queue length is less than the minimum threshold; that means, you
are in a safe zone. So, you enqueue the packet if your minimum threshold, if your
average queue length is in between this minimum threshold and the maximum threshold;
that means, you are going to the danger zone. So, you calculate some packet dropping
probability; if the packet drop probability is high you drop the packet otherwise you
enqueue the packet.

And if your average queue length is more than the maximum threshold; that means, you
are already within the danger zone. So, to avoid the congestion you drop the packet. So,
that is the principle of random early detection.

713
(Refer Slide Time: 33:22)

So, this is the way we calculate this packet drop probability. So, we have to calculate the
packet dropping probability here. So, we calculate the packet drop probability here say
assume that Max p is the maximum packet drop probability and d k denotes the drop
probability, then d k will be Max p into k minus MinThresh divided by MaxThresh
minus MinThresh. So, k is the current queue length. So, we calculate the packet drop
probability from the current queue length. Now, let us see what is the significance of this
equation.

(Refer Slide Time: 34:00)

714
So, to look into the significance of this equation we plot this packet drop probability with
respect of average queue size. So, if you look into the packet drop probability of this
average queue size you will see whenever it is less than this minimum threshold your
packet the probability is 0. After that the packet drop probability increases linearly based
on the equation that we have written, the packet drop probability increases linearly.

Now, whenever you are crossing this maximum threshold your packet drop probability
becomes equals to 1. So, that is the significance here that as you are moving from this
minimum threshold to the maximum threshold you are gradually increasing the packet
drop probability and once you have reached to the maximum threshold, your packet drop
probability becomes 1 and you drop all the packets for that particular application.

Now, here the interesting fact is that what we are doing here, we are ensuring that
whenever things are going good we do not do anything, but when things are moving
towards the bad side we you do some kind of early detection of a congestion by
observing the current queue length, because the current queue length gives you a reliable
indication of the congestion. If the queue length becomes high, that means, you have
more number of packets in the queue and a queue has say length 5 and you have already
filled up the queue with 4 packets; that means you are gradually going towards the
congestion.

The moment there will be 5 packets in the queue and the queue become full, you will
start experiencing congestion. So, that is why as you are increasing the queue length you
are moving more towards congestion and accordingly you detect it early based on the
average queue length and then randomly drop the packets to ensure that things are going
out of congestion.

Now, this random drop has an implication you remember that in case of TCP we detect
something as congestion whenever you have 3 consecutive packet loss. So, you are
getting 3 duplicate acknowledgements or you are having a time out. Now, if you have a
random packet loss then it is just like that one of the packet will get lost and we will get a
single duplicate acknowledgement or you will not experience any time out for that
particular packet.

715
So, that way TCP will not get triggered a congestion control there, but as you are
gradually moving towards congestion, you will detect a drop more packet and TCP will
trigger the congestion control algorithm at that instance of time.

So, that is all about this congestion avoidance algorithm in the internet, which helps you
to come out of congestion or have a early signature of congestion, but as you have seen
that as the load increase gradually it moves towards the scenario of congestion and then
TCP should come in the picture and run it congestion control algorithm, to make the
system come out of congestion. So, to support quality of service we need to run both
congestion avoidance as well as congestion control in our system. So, that is all in the
next class we will look into 2 specific QoS architecture in the internet call integrated
service and the differentiated service architecture.

So thank you all for attending this class.

716
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 35
Internet QoS - V (Integrated and Differentiated Service Architecture)

Welcome back to the course on Computer Network and Internet Protocol.

(Refer Slide Time: 00:21)

So, today we are going to cover the last topic of Internet Quality of Service. So, we are
going to talk about two specific quality of service architectures called integrated service
architecture or IntServ architecture or that under differentiated service architecture or
DiffServ architecture. So, in the beginning let me give you a brief idea about the
differences between this IntServ and DiffServ architectures. So, we have two modes of
services to provide quality of service over the internet.

So, the first mode of services, which we call as the guaranteed service, that is the
integrated service architecture. So, the integrated service architecture what we try to do?
We try to provide the kind of guaranteed service to the end users based on their service
level agreement. So, what is mean by guaranteed service? Guaranteed service means if
the service level agreement says that all of my packets should not get more delay than 10
millisecond. Then the network will ensure that all the packets of my which as coming

717
from my devices, they will get less than 30 millisecond of delay or the 10 milliseconds of
delay that I have on my service level agreement.

So, that we call as the guaranteed service. Now, you see that for this kind of guaranteed
service to or to support this kind of integrated service architecture, what you need to do?
You need to ensure that every individual router in the network should take care of about
your service level agreement. So, every individual router need to make an estimate
whether it will be able to provide your service or they need to do a prereservation of
resources inside the routers, to ensure that that specific service level agreement is made.

Now to do that the routers need to coordinate with each other; because the packet is
flowing through multiple routers whenever it is moving from one source to another
destination and then individual routers need to coordinate with each other to reserve the
resources for you such that it can guarantee the service that is promised to you. So, this
particular architecture we call it as integrated service architecture. Now in this integrated
service architecture the problem is that, this coordination among the routers. Now you
think of the scale of the internet you have millions of routers and whenever you are
transferring certain application then it need to pass a large number of routers there under
the control of different service providers at different levels.

You have this tier 0 ISPs, tier 1 ISPs, then tier 2 ISPs, then the local ISPs. So all these
different service providers they need to coordinate with each other and the entire
mechanism is very much complicated for this internet scale or internet level
implementation. So, that is why we have a second class of quality of service, which does
not give you guaranteed quality of service or which does not ensure that whatever the
network service provider has promised to me in terms of service level agreement.

For a 100 percent times that will get executed, but what it tries to do? It tries its best to
meet the service requirements. So, it is like that, if your network is too congested you
cannot do anything in that case your packets will suffer, but if the network has a medium
load, then it will provide you the required quality of service. Again the scenario come
from the example of airport that security check scenario that if your airport is very much
loaded to with the millions of passengers at the peak time then the security guards also
cannot do anything.

718
So, what if you do you transfer some passengers from one queue to another queue it does
not matter much. But whenever the load is high, but not very high during that time, the
security officials they tries to provide certain quality of service, if they finds out that will
certain queue is growing longer, but in other queue there are remaining passengers. So,
they shift certain passengers from one queue to another queue and they tries to provide
you some level of quality of service based on the based on the best that they can do. So,
this kind of architecture we call it as a differentiated service architecture or DiffServ
architecture. So, for internet scale implementation, DiffServ architecture is more suitable
where you just try your best to provide the quality of service, but there is no guarantee
that 100 percent of the time it will met the desired quality of service. So, we will look
into this IntServ architecture and the DiffServ architecture in details.

(Refer Slide Time: 05:33)

So first start our journey with this integrated service architecture, to start with first let us
look the service architecture principles in the internet, we call it the internet service
architecture or ISA. So, this internet service architecture or ISA, it provides integrated
service QoS architecture over the internet. So, it has few steps like the admission control.
So, this admission control for quality of service you require reservation for the new
flows, for that we run something called the resource reservation protocol or RSVP, we
will look into this RSVP in little more details. Then you have the routing control. So, you
make the routing decision based on the quality of service parameters. So, you find out
that whether a particular router is loaded if a particular router is loaded then you rather

719
not route the packet to that router rather you route it to some alternate router. So, your
routing algorithm is also depending on the depends on the quality of service parameters.

(Refer Slide Time: 06:35)

Then have the different kind of queuing strategies that we have already discussed in the
last lecture, which takes account of different flow requirements. And finally, you have
described policy like the congestion avoidance algorithm to meet the quality of required
quality of service like the random early detection algorithm that we have discussed
earlier.

(Refer Slide Time: 06:55)

720
So, this is this entire ISA architecture of ISA architecture that runs inside a router. So, if
you look into this ISA architecture you have these routing protocols, which are finding
out the routing parts and then you have the routing database and that is the routing part
which is running inside your router operating system, and then you have this quality of
service associated protocol.

So, this quality of service associated protocols, it has this admission control part, it has
this admission control protocol it ensures that the packet, which are which are going
inside the network the meets the required quality of service. Say for example, whenever
you are admitting a new flow in the network, then you need to ensure that the new flow
get service from the internet or that it gets the required service from the internet.

If you do not able to ensure that the required flow get the required services from the
internet, then you simply drop that particular flow. So, this particular thing possibly you
have observed when making a voice call, sometime you have heard that a nice voice
from a lady that all lines are busy please dial after some time. So, it is just like the
network is not allowing you to get admitted in the network because it does not have
sufficient amount of resources. So, that is the purpose of this admission control protocol.

Now, this admission control protocol get input from the reservation protocol. So, the
reservation protocol actually reserves the resources in individual routers, through the
RSVP protocol that we will look after a couple of slides. So, this RSVP protocol or the
resource reservation protocol, it ensures that the resource are getting reserved in
individual routers in the end to end path.

So, if you are not able to reserve any further resource, then the admission control will
deny your entry to the network. Then you have a management agent which manages
different functionalities of the quality of service like this traffic shaping, traffic policing
and all these aspects and then you have a traffic control database. So, this traffic control
database actually tells you that how your packets need to be treated by the network.

Now, let us come to the forwarding plane of the router. So, the forwarding plane
whenever, you are getting a new packet then first you have this classifier and the route
selection. So, this classifier and the route selection mechanism it will classify your
packets into one of the available traffic classes and then based on that, it will select the
route by looking into the routing database then comes your packet scheduler. So, this

721
packet scheduler it will get input from this route information as well as from the traffic
control database, that the how your packets need to be treated, and then it puts it in one
of the queues.

So, either in the best effort queuing or you can have multiple queuing for the quality of
service traffic. So, the queue is associated queuing. Then your scheduler is running,
which actually runs on this queues and transfer the packets based on one of the queuing
policies. So, that it is the entire ISA implementation inside a router that, actually
integrates the routing and quality of service together makes a integrated treatment over
the packets which are coming from the end user applications.

(Refer Slide Time: 10:42)

Now, let us first look into the resource reservation protocol. So, this resource reservation
protocol or RSVP, is a network control protocol that allows data receiver to request a
special end to end quality of service for its data flow. So, you require certain kind of
special quality of service for your end to end flow, for that you apply this resource
reservation protocol. Remember that RSVP is a network control protocol and it is not a
routing protocol. It works with IP that is true, but it works in association with IP.

(Refer Slide Time: 11:17)

722
So, if you look into the earlier slide, we have the routing control protocol here, which
takes care of your routing and then your reservation protocol the RSVP is running here,
that takes care of this resource reservation and individual routers. So, it is not a routing
protocol, rather a QoS protocol which works in association with routing.

(Refer Slide Time: 11:41)

Well so it is designed to operate with current and future unicast and multicast routing
protocols.

723
(Refer Slide Time: 11:49)

So, this is the architecture for integrated service architecture and RSVP together. So, we
have just shown the instances of two different machines, the host machine and the router
machine. So, the first one is so, this is at the host machine, the module which runs inside
the host machine and these are the module which runs inside the router machine.

Now inside the host machine let us see the modules that we have. So, you have the
applications which are running there, that application talks with the classifier, that
classifies your packet what type of quality of service classes that packets belongs to. And
then you have a RSVP daemon that RSVP daemon actually runs in the host as well as in
all the intermediate routers. So, these RSVP daemons; so, you can see that these RSVP
daemons they talk with each other. So, you have an arrow connecting the individual
RSVP daemon. So these RSVP daemons talk with each other and the reserve the
resources for a particular flow inside every routers in the end to end path. So, it finds out
whether it is able to resource the reserve or it will be able to reserve the resource for a
particular flow. If it is able to reserve the resources, then it allows the flow through the
admission control mechanism otherwise it simply drops that particular flow. Now you
have that packet scheduler that works in cooperation with the classifier and the RSVP
daemon, that talks about that what type of resources have been reserved for you, and
accordingly the package scheduler schedule a packets into multiple queues.

724
Now again the similar thing happens here that you have the routing protocol daemon
which is running inside the routers. So, this routing protocol daemon in association with
RSVP daemon and the packet classifier, you decide the next stop which is coming from
the routing part and your corresponding class queue, which is coming from this RSVP
part RSVP and the classifier part and in your packet scheduler will actually schedule
your packet based on your next hop and class queue that is being determined. And then
the packet will be sent to the next router, and in every router this particular thing will
run. So, remember this important aspect of this RSVP daemon at both the host at all the
intermediate routers.

(Refer Slide Time: 14:15)

So, all the RSVP daemons and all the routers in the end to end path they need to
coordinate with each other. And that is why the implementing in this integrated service
architecture over the internet is a difficult thing, because you need a coordination among
all the routers which is difficult to achieve for large scale internet.

725
(Refer Slide Time: 14:39)

Well let us look into certain RSVP terminologies. So, quality of service is implemented
for a particular data flow by a mechanism that we call as a traffic control in RSVP; we
have the packet classifier that determines the quality of service level, and the packet
scheduler that link layer dependent mechanism to determine which particular packets are
forwarded. Now for each outgoing interface, the scheduler achieves the desired quality
of service.

So, if you look into a router perspective you can have multiple outgoing interfaces, like
eth 0, eth 1, eth 2, eth 3 and so on. So, these are the different outgoing interfaces for a
router, now for every individual outgoing interface I need to maintain these multiple
queues. Because you remember that these queues are specific to outgoing interface. So,
with this outgoing interface possibly another router this is connected. So, that is why for
every interface, you need to apply this queuing mechanism.

So, the routing algorithm will take tell you that in which outgoing interface the packet
need to be forwarded to and then in that particular outgoing interface you run the
queuing mechanism to serve the packets to serve all the packets, which need to be
forwarded to that particular interface.

726
(Refer Slide Time: 16:01)

Now this is the reservation procedure for RSVP. During the reservation setup, first we
send an RSVP QoS request which is passed to two local decision module. The decision
modules are the admission control module and the policy control module; now the
admission control module it determines whether the node has sufficient available
resources to supply for the requested resources.

If you have sufficient amount of resources, then you allow the flow to enter in the
network, otherwise you simply drop the flow. Then you have the policy control module.
This policy control module determines whether the user has administrative permission to
make the reservation.

Now that is an important aspect in the internet scale, say for example, you have not made
the specific service level agreement; in that case even if you are trying to send some
voice over IP packet, that voice over IP packets will be treated as a best effort packet not
as an high priority packet. So, that is why you need to make at the corresponding service
level agreement with the network service provider, before sending any quality of service
associated packet. So, this policy control actually comes from the service level
agreement, that talks about whether the user is actually have sufficient administrative
privilege to mark its packet as a high priority packet or not.

727
(Refer Slide Time: 17:23)

Now, if this both checks succeed then the parameters are set in the packet classifier, and
in the link layer interface to obtain the desired level of quality of service. If either of the
check fails like either your admission control check fails or the policy control check fails,
then the RSVP program returns an error notification to the application process that
generated that request, that you are not allowed to send this packet over the internet with
this quality of service which you are claiming.

(Refer Slide Time: 17:55)

728
Now, let us look into the reservation model in RSVP how RSVP does the reservation. So,
a RSVP request it consists of two part; one thing we call as the flowspec and another
thing we call as the filterspec. So, this pair is known as the flow descriptor. So, this
flowspec it specifies the desired level of quality of service. So, what type of quality of
service you are expecting from the end user?

And the filterspec together with the session specification defines the set of data packets
like this filter spec actually talks about that what type of queuing mechanism you want to
implement on your packet. Whether you want to go for priority queuing or a custom
queuing or a weighted fair queuing or whatever other queuing mechanisms that we have
to provide the internet quality of service.

(Refer Slide Time: 18:50)

So, this flowspec it is used to set the parameters in the packet scheduler, while as the
filterspec it is used to set the parameter in the packet classifier. So, based on the
filterspec you actually filter out the packets that is why the name filterspec. So, it is put
in the packet classifier to classify the packets, and then design that or put that packet
associated with different type of queues that you have to provide quality of service.

And the flowspec it is used to set the parameters in the packet scheduler that, what would
be the individual parameters to setting up the queues. Now this flowspec it is a
reservation request it generally includes a service class and two sets of numeric
parameter. So, one is called the Rspec another one is called the Tspec. So, this Rspec

729
defines the desired quality of service and the Tspec defines the data flow that which
particular packets of a flow you are going to consider.

(Refer Slide Time: 19:48)

So, here is a flow spec structure. So, you can see that it contains multiple parameters like
this token rate, token bucket size, the peak bandwidth, latency.

(Refer Slide Time: 19:57)

So this token rate, token bucket size they are kind of are belongs to the Rspec that talks
about the scheduler parameters whereas, the peak bandwidth, latency, delay variation, all
these things they talk about flow specific parameters the maximum Sdu size, minimum

730
policy size. So, they belongs to the Tspec bit of this flow spec. So, this flow specifies all
these numeric values, which actually determines your corresponding service level
agreement. So, based on the flow spec you determined that what level of quality of
service you want to provide to a particular user, then you control or you configure the
intermediate routing queues based on these particular parameters.

Whereas, in case of filterspec you are actually marking the packet classifier or you are
configuring the packet classifier, to say that well this particular user, may generate VoIP
traffic, video on demand traffic and the best effort traffic as per its service level
agreement that the traffic classifier needs to take care of.

(Refer Slide Time: 21:15)

So, the problems which are associated RSVP there are major two problems that I have
already pointed out: that the RSVP daemon needs to maintain per flow states at
intermediate routers. Because the RSVP daemon needs to maintain per flow states at
intermediate routers it is a heavy process. So use of this per flow state and per flow
processing, it raises the scalability concerns over a large network. And that is why from
the integrated service architecture we move towards the differentiated service
architecture or DiffServ architecture.

731
(Refer Slide Time: 21:46)

So, this differentiated service architecture or the DiffServ architecture it is a coarse


grained, class based mechanism for traffic management. It has a packet classifier which
uses a six bit differentiated service coat point field or the DSCP field. So, this DSCP field
which indicates that in which particular traffic class it belongs to. So, remember in case
of your integrated service architecture, the packet classifier or the classifier classes are
not fixed or predetermined, it can be user based or it can vary from user to user and that
is why we are using filterspec to inform the classifier that what different type of packet
classes can belong to a particular user.

But in case of differentiated service architecture, we do not have that level of flexibility.
We do not have this kind of user specific quality of services that, rather network wide we
have some fixed classes of services; and those fixed classes of services are determined
by this DSCP field. So, DSCP field is included inside the eight bit differentiated service
field the DS field inside the IP header.

So, in the IP header itself we will find out this DS field which contains the DSCP field
and that DSCP field, determines the fixed traffic classes that the differentiated service
architecture can support. So, that is the difference a major difference between the
integrated service architecture and the differentiated service architecture and that is why
this kind of filterspec model it is not required in case of DiffServ architecture.

732
Because your traffic classes are fixed and that is why your classifier has a fixed
behaviour, rather than a user specific behaviour. In case of your integrated service
architecture you had this user specific behaviour, and that is why you had the
requirement of the filterspec to configure the traffic classifier. Now, DiffServ aware
routers implement something called a per hop behaviour. So, this per hop behaviour
defines the packet forwarding properties associated with that class of traffic.

So, how the packets will be forwarded for DiffServ aware routers; now DiffServ
recommends standardised set of traffic classes that I have mentioned it has standardized
and fixed set of traffic classes. Now, a group of routers that implement a common
administratively defined DiffServ policies they are referred to as a DiffServ domain. So,
we will implement differentiated service architecture over a DiffServ domain.

(Refer Slide Time: 24:19)

Now, this is the architecture of DiffServ.

733
(Refer Slide Time: 24:21)

You have multiple DiffServ domains DiffServ 1, domain DiffServ domain 1, DiffServ
domain 2 and DiffServ domain 3, now whenever you are transferring a packet from a
source to a destination it need to go through these three DiffServ domains. Now when it
needs to go through these three DiffServ domain, what we do that? We will look into
these intermediate routers or the edge routers. So, the idea of this differentiated service
architecture is something like this, that whenever you are entering a packet to one
DiffServ domain, what you try to do you try to make an estimation about what is the end
to end quality of service requirement, and how much quality of service it has already
obtained.

Now remember this individual DiffServ domains can be like different service providers,
which are there in the internet. So, whenever. So, it may happen that this is a local ISP
this is say a tier 1 ISP, and this is again a local ISP. Now, whenever the packet is going
through this tier 1 ISP, that this DiffServ domain actually looks into that what is my end
to end service level agreement. And how much serviced a packet from these sources
already received; say for at this point say my end to end delay need to be 30 millisecond,
that is written inside the service level agreement and what we see here that when the
packet reaches here, it has already received 20 milliseconds of delay. From the source to
DS 1; that means, from this DS 2 to DS 3 and final destination you have to transfer the
packet within 10 millisecond, to meet the required service level agreement. Now based

734
on this differentiated service architecture actually takes the decision about how to treat
the packet for this particular flow.

To do this it actually have a coordination among other DiffServ domain remember that
unlike other integrated service architecture the things that, we have done we required a
coordination among all the routers, here we do not required a coordination among all the
routers we just required a coordination among all the DiffServ domains, and that is done
by this bandwidth broker ok.

(Refer Slide Time: 26:54)

So, the bandwidth broker is an agent that has some knowledge of an organizations
priorities and policies, and allocates quality of service resources with respect to those
policies as per the definition of bandwidth broker given in RFC 2638. Now in order to
achieve an end to end allocation of resources across separate domains, the bandwidth
broker managing a domain will have to communicate with its adjacent peers.

735
(Refer Slide Time: 27:22)

So, here in the earlier picture this bandwidth broker running at the DS 2 it need to
communicate with the bandwidth broker DS 1 and bandwidth broker DS 3, to determine
that what level of quality of service can be given to a particular flow.

(Refer Slide Time: 27:37)

Have to communicate with this the adjacent peers, which allows end to end services to
be constructed out of purely bilateral agreement. So, remember that it is a kind of pure
bilateral agreement. So, you can and why we call it as a best effort service and not a
guaranteed service, again coming back to the previous picture.

736
(Refer Slide Time: 27:57)

That it may happen that this particular service domain or this particular local ISP, it does
not have a pairing relationship with this tier 1 ISP. So, it does not have any agreement
with DS 2 in terms of this quality of service in that case, it will not be able to provide
that end to end quality of service. So, now we are giving the flexibility at the ISP levels
that individual ISPs can ensure the pairing with or quality of service associated pairing
with the neighbours and can take the decision accordingly. So, that is the task of the
bandwidth broker, that sets up this kind of paring relationships.

(Refer Slide Time: 28:43)

737
So, the service level agreement; so, we have two type of agreement in DiffServ
architecture, one is called a service level agreement which is a set of parameters and their
values which together define the service order to a traffic stream by a DS domain. And
the traffic conditioning agreement is a set of parameters and their values which together
specify a set of classifier rules and traffic profile. So, this traffic condition agreement
actually is an agreement which says you that see I have this fixed set of classes and your
packet will belong to one of these fixed set of classes. So, tell me that in which fixed set
of classes you want to purchase. So, if you say that I want to purchase class 1 you have
to pay more money, if you say that I want to purchase class 2 service, you have to pay
little less money and so on. So that we call as the traffic conditioning agreement and the
service conditioning agreement or the service level agreement is that well I am
purchasing that class 1 my traffic is in class 1. But in class 1 traffic you should give little
more priority to my traffic, because I am going to use a VoIP services. So, it is just like
multi class of VoIP services. One is ensuring a perfect QoS, another one is ensuring some
compromised QoS.

(Refer Slide Time: 29:54)

Now in a DS domain, the boundary nodes or the border nodes, they interconnects the
current DS domain to other DS domain or non capability DS domain, we call them as the
boundary nodes or the edge nodes. The classification and conditioning process of a
boundary node in a DS domain it is responsible for mapping packets to a forwarding
class.

738
Supported in a network and ensuring that the traffic from a customer confirms to their
service level agreement. So that are done by the classification and the conditioning
process, which is running in a boundary node.

(Refer Slide Time: 30:28)

Now, the traffic conditioning it is a set of control functions, that is applied to a classified
packets stream in order to enforce traffic conditioning agreements like, how your packet
need to be treated which are made between the customers and the service provider. So it
has four components – meter, marker, shaper and dropper. Now a meter is used to
measure the classified traffic stream against the traffic profile, that means you need, a
meter is basically used to estimate that how much quality of service you have already got
and what is the level of quality of service that you have to give to whenever you are
going to the next DS domain. And the state of the meter may then be used to enable a
marking; that means, classifying your packet in one of the service classes, shaping or
dropping the action.

739
(Refer Slide Time: 31:15)

So, here is the idea. So you have a classifier. From that classifier, it is coming to the
marker, now the marker make an estimate say your packet is a from the source it is going
to one DS domain then another DS domain then the third DS domain and finally, the
destination. Now when the packet is reaching to say this boundary node say B1, it runs
its meter this meter module to find out that if you have a end to end 30 millisecond of
delay requirement, what is the amount of delay the packet has already achieved, say at
the packet has already achieved, 10 millisecond delay.

Now it needs to find out that well the packet has already achieved 10 milliseconds of
delay. So, I have to transfer the packet within 20 millisecond. Now let us look into this
packet status in compared to other packets which are already in my interface queue, if
you can find out that well the other packets need to be transferred we did not say average
delay of 30 millisecond, but this packet need to be transferred within 20 millisecond then
we increase the priority of that packet.

But if you see that the other packets need to be transferred in 5 millisecond and this
packet need to be transferred into 30 millisecond then you reduce its priority. So, that
way the priority is dynamically assigned by the marker and that priority assignment is
done by this marker module. And accordingly you include the traffic shaper or dropper
which will shape your traffic or drop your traffic or apply certain kind of scheduling
policy to ensure the quality of service requirements.

740
(Refer Slide Time: 32:53)

So, this classification and marking, they are the per hop behaviours; so, we have four
different type of per hop behaviours, the default per hop is to provide best effort service
by expedited forwarding or EF PHB to which is to give priority to the low loss low
latency traffic. Assured forwarding per hop behaviour it gives assuring to delivery under
prescribed condition like you require some fixed amount of bandwidth for that particular
application, then you go for assured forwarding which can be implemented with the help
of a custom queueing.

The expedited forwarding on the other hand can be implemented inside the priority
queuing. So, you can apply a priority queue for this, and the custom queue for this. And
you can have certain class based selector per hop behaviour which maintains backward
compatibility with the IP precedence field. So, something like you can use weighted fair
queuing to ensure the fairness.

741
(Refer Slide Time: 33:53)

These are the working steps of a DS domain the source or the users it make a contact
with contract with the ISP for a specific service level agreement. The source sends a
request message to the first hop router, then the first hop router sends the request to the
bandwidth broker, which send backs either accept or reject based on whether the
bandwidth can be whether the SLA can be ensured, in delivering the packet. If it is
accepted then either the source or the fist hop router will mark the DSCP field, and start
sending the packet.

And edge routers they at every DS domain they check compliance with the SLA and
does the policing. The excess packets are either discarded or marked as low priority to
comply with a SLA because the excess packets are marked as low priority that is why
you say it is not a guaranteed QoS rather a expected QoS or the best effort QoS. Now the
core router it will just look at to the DSCP and decides the corresponding per hop
behaviour.

742
(Refer Slide Time: 34:48)

Now, here are certain links that you can look further to understand in details the
differentiated service and the integrated service architecture. So, these two topics are
little advanced topic which are not there in your reference book that we have mentioned
earlier so, that is why you have given two links. So, you can browse through these two
links to find out the details. So, this is all about the quality of service in the internet, and
I hope that by this time you have a nice idea about what quality of service means and
how to apply quality of service over a internet.

And you can go through this Cisco documentation that I have shared to understand more
about this quality of service and how different types of quality of service are actually
implemented in such Cisco routers. Indeed the process is a bit complex and there are
multiple modules which work all together to support this. So, I try to give you a very
brief overview or a bird’s eye view of this entire quality of service to give you an
understanding about this topic.

So thank you all for attending this class.

743
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 36
IP Routing - Introduction ( Routing Table )

Hello, so today we will continue our discussion on Computer Networks and Internet
Protocols. Today we will be starting or starting our couple of lectures on IP Routing. So,
already you have seen that how a application layer in our OSI or TCP/IP model works.
You have already looked into several transport layer protocols and also the basics of IP
layer protocols.

So, IP as such is IP layer or it is also known as the network layer is primarily responsible
for forwarding packet from one network to another right. So, it is a if we look at the
internet which is a network of networks. So, the IP layer is primarily responsible for
connecting the two, two or two or more different network and so and so things.

Now, one major aspects of this particular forwarding thing that, how the packet will be
forwarded across the global internet, right. So, internet as such we have seen a having
truly speaking that a millions of systems, thousands of routers and so and so forth right.
So, how a packet from one to another it will be getting forward, like if you from your
system if you are typing www dot iitkgp ac dot in, then the IITKGP page gets displayed
on your screen. So, how your request comes up to this IITKGP web server and then
IITKGP web server replies back to your systems right. So, if you are requesting from a
far network so how it will go on hopping to through this router.

So, if we imagine a overall internet or not imagine if we look at the overall inter internet.
So, if there are several networks and there are a router switch connects these networks
right. So, routers are responsible for for forwarding packets from one network to another
network and type of things. So, if there are multiple hops are required the router should
be responsible for doing that right.

So, today or from coming couple of lectures, we’ll be discussing or different forwarding
mechanisms. How the packets are getting forwarded from one network to another
network to another networks till then the destination host is reached right. So, if we look

744
at we will be primarily looking at following things IP addresses and address allocation
already you have gone through that we will quickly brush up on the things.

(Refer Slide Time: 03:16)

And we will start looking at packet forwarding or routing or there are will say
forwarding table or routing table will be a little bit interchangeably using. The tables
which are looked at the in the router and there is another concept whenever we come into
play that is the longest prefix match sometime LPM forwarding right. So, longest prefix
match and we’ll be primarily referring this in the in whole of these lectures or series of
lectures will be primarily referring some of the books and reference note and difference
reference materials and of as mentioned there and as we have mentioned in our earlier
slides also right.

745
(Refer Slide Time: 04:05)

So, IP address is a already all of us or you know that it is typically when we as of now
we are talking about IPv4 all our dealing of this routing will be primarily based on IPv4.
So, it is a 32 bit address with every 8 bit dot, 8 bit dot, 8 bit dot, 8 bit right. And it
uniquely identifies a particular machine, logically provide a logical address to a
particular systems which is connected in the internet.

In other sense we can say that a two systems on the same on this network cannot have
two same IP address then it will not be able to identify those uniquely right, but there are
way out still we are having those type of things that will come slowly. But nevertheless
we think that this is the logical address which goes to the things. Later on in this
particular course we look at another type of addressing what we say physical or MAC
address, which comes with your network interface card right.

So, that is the address by which by the system is identified so, but this is logically able to
identify the systems. So, these IP address is typically provided by the system system
admin or in some cases are provided through some other mechanism like DHCP and type
of things right.

So, uniquely it identifies in interface on a host on a router there is a interface right. So,
where the thing where the network is connected represented by dotted quad notation
right, this is known fact. And in everything in the thing everything in the system or the is
represented by binary. So, if it is 14, 35, 158, 15 it is represented by like this right.

746
(Refer Slide Time: 06:08)

Now, if we look at internetworking so used to connect networks together not primarily


network. So, there are several networks which are connected together. So, we need say
way to address a network or group of host right. Like I say that I require IIT Kharagpur
as a network, in inside the IIT Kharagpur I may have different sub network like say,
center of educational technology, may have a network computer science and engineering
can be a network, administration of IIT Kharagpur can be network and like that right.
And so there are several networks and in other way we need a way to address this
network also right; that means, if I am going from one network to another I should be
able to know that address of the network.

As we have discussed at the previous lectures initial lectures like so, this network layer is
the is responsible for routing; that means, for forwarding packet from one network to
another right or we say that in other words these routers are having that layer 3 capability
or it can see packet up to layer 3 or network layer in TCP/IP model right. So, we have
physical layer, MAC layer and then ordered link layer and then the layer 3 and router can
look at the layer 3 capability.

So, it can look into the network to network communication right. So, here also we can
say this is a typical one LAN having some host, this is another LAN having another host
and there can be bunch of routers and we can say this is a something in the inter
networking or sometimes we say there is a wide area network. But nevertheless what we

747
require that different routers which allows me to connect there. There can be 3, 1 n
number of routers which allows to the connect to the network right and there can be
different other networks which are connected to the network.

So, the every router has a some interfaces right. Sometimes we represent by the serial
port of this router 1, 2, 3, 4, 1 slash like this type of representation we will see some of
those. But nevertheless that router has interfaces, every interfaces connects connect
allows it to connect to another router or another network in the things right.

(Refer Slide Time: 08:46)

So, the one major challenges in any system is the scalability right, like one way of
looking at this router is that the router knows router somewhere or other knows that if I
get a packet from say host a to host b to be forwarded a to b or c say a to b or c to d to be
forwarded. So, the router knows that if from here it is generated then where it should be
forwarded which router to be forwarded, then somewhere is to be forwarded and so and
so forth. That means, there should be somewhere a what we say a some sort of a lookup
table router looks at a table and see that this is the packet so forward these to the things
right.

The problem becomes that any system added or other since deleted from any of the
network needs to be again the now routing table needs to be updated across the all
network all, all routers across the world. Otherwise it will not be able to forward packets

748
right. So, there should be some mechanisms that we will see slowly that how to forward
these packets from one to other.

Now, if we holistically try to look at a router is primarily a it gets something from one
interface looks at the destination where it should go consult its some table or some
information. And say now you go to that to this particular through this channel right, or
in other sense if I try to make an analogy like I want to go from here to say Nasik and
then try to go a major corner I ask that traffic fellow. Now, I want to go to these Nasik
this, then which way you go, he has some information that in order to go that it has to
follow this path. Then go and meet the at the next traffic person and who will redirect
etcetera. So, it has some informations which allows it to route it.

So, what we what in other sense what we say these are the router maintains a table which
is called Routing or sometimes Forwarding Table which allows to forward these things to
the destination right. And this how this table will be constructed how this table will be
maintained there is another challenge, but nevertheless having this table will be pretty
large considering even considering the number of networks and routers and in the our
internetworking.

And as we understand this is very dynamic because we do not have any control or that
there cannot be a overall centralized control that how man how many networks etcetera
there. And not only that there can be more systems coming in going out more network
being generated. So, it becomes a major challenge in the in routing the packets right. So,
every router needs to needs lot of information and to know how to direct packets towards
the host.

749
(Refer Slide Time: 11:54)

So, divide the network into host portion is the first thing what we have seen right. So, if I
if I have so have some hierarchal sort of things or I divide that it is a host portion and a
sorry network portion and by a host portion right. And that already you already you
know that there is a the net mask which allows that if I mask it and then so net mask is a
mask which followed by a it is also a 32 bit number or 32 bit address where it follows by
a series of 1 and then a series of 0. So, there cannot be in between 0 1 type of things
right. So, it is series of one followed by things it mask it and whatever it mask it out it is
the network address right.

So, like here what we say 24 bit address slash 24 representation. So, the first three octet
they represent that network or the 24 bit network and rest is the host of the thing right.
And if you try to look at something analogy with our postal mail system also we have
different category of the things right. We have say country, state, district, city, then
maybe a area, location and then the house address and type of things right.

So, if I want to mask that whatever is for West Bengal say West Bengal, India I can mask
it an segregate I can say Kharagpur, West Bengal, India segregate then IIT campus
Kharagpur and type of things and so and so forth. So, it depends on that how, so it is
there is some rough so I what we can say I can approach the problem in a hierarchical
way right.

750
(Refer Slide Time: 13:51)

So, I can make a hierarchy that given address so this is the network address and type of
things right. And this is typically a mask of 25 bit and if I mask it out and we get that IP
address that already you have seen right.

(Refer Slide Time: 14:06)

So, in other sense we have improved some sort of scalability like I can say that this is
identify that particular with respect to a network address. And now with the LAN 2 if this
was the way it was the table was maintained in this router. That this way incoming with
24 bit whoever is matching you will be coming here or going out.

751
(Refer Slide Time: 14:31)

So, in the LAN 2 if I add a new host so you does not require adding a new forwarding
entry into the table. So, it now does not address host by host, but address a network. So,
this network what we see is 5, 6, 7, 0 slash 24. So, it is a net network address is with 24
bit mask and if I add something like this I do not require that all these routing things
individual routers across the world need to be changed, still it is in the same network.

In other sense this way of representation allows me to identify a particular network


through a identifier right. So, I mask it and this network has this network address and
forward that. And then rest is the host address will be inside the thing right. Now, so this
is this way we can look at some way of addressing the scalability issues.

752
(Refer Slide Time: 15:40)

And then if you look at the IP address allocation again you have gone through that you
know those things, but just to again to brush up (Refer Time: 15:47). So, one is that we
have some fixed address allocation or we say classful addressing right like class A
address which starts with a 0 and star class B address 10 rest anything after that, class C
address 110. There are two other one is for multicast group another is a reserved for
future use right. These two other addressing schemes are there these are classful
addressing mechanisms or in this case we have a very large block of slash 8. The
network number of network is less whereas, the number of host are much larger whereas,
in class B it is slash 16.

So, it is somewhere it is something large number of networks are with first 16 bit
representation and rest are with the number of hosts. And 24 is where number of host in
these organizations are much less that 8 bit is there and there are two multicast things.
So, as we know that this type of addressing or which addressing you will choose based
on that what sort of requirement you are having at the at your organization level correct.

753
(Refer Slide Time: 17:10)

And then we have also seen that classless inter domain routing where instead of this
classful we represent by an IP mask right of any variable length again followed by 1s and
then 0s. Like here we say that one 12 dot 4 dot 0 dot 0 with a mask of slash 15 and can
be like this. So, that first 15 bit represent the address and the rest represent the host like
here what we see right. So, may not be the figure fitting properly, but first 15 bit and the
rest is on the host side.

(Refer Slide Time: 17:50)

754
And in other sense if we can see that if I get a this sort of things then I can go on dividing
them into different subnets right or sub networking. In other way we can have a better
manageability of the things in a hierarchical fashion right. So, prefixes are key to the
internet scalability challenge, address allocated in contiguous chunks prefixes, routing,
protocols and packet forwarding based on these prefixes. So, the while we route we route
between these addresses. So, I can have different hierarchy of this sort of mechanisms
right and this is the and I can manage IP in a the whole IP things in a better way.

Not only that our I can manage the routing information or the routing table or the
forwarding table in the router in a much efficient way right. Otherwise I need to have all
the things into the things like think of again not may not be very strong analogy with the
postal, but think of that I have to keep every post office need to keep individual address
of rest of the world or even rest of India right. So, if I want to send a message to x y z at
somewhere Nasik then I need to know that where to send. Instead I divided that I if I am
sending something to IIT Kharagpur, so, it is a state of West Bengal, then district a
particular district, then particular city, then particular area of that city and then the thing.
So, I divide into different stuff. So, similarly here also we have that type of we can divide
them into this sort of things. These are already you have you have studied in your IP
address allocation etcetera, but we can utilize this phenomena for our routing.

(Refer Slide Time: 19:59)

755
So, we can have aggregation of the things like if there are these different networks. Then
I can have a aggregated network so I have 2 201 dot 00, 22, 24, 24, 23, type of things.
Then I can have a aggregated network of 201 dot 10 dot 00 slash 21 right. So, routers in
the rest of the internet needs to know to reach only 2 naught 1 dot 10 dot 00 slash 21 rest
are handled at the lower level at the at the inside the inside that particular domain.

So, the provider can now direct the IP packets to the appropriate customer ok. So, if the
provider has these are the customers right routers only need to know this higher level IP
only right. This can have different so this if this is a some sort of a IP ISP provider. So,
its customer’s things are handled like this right.

(Refer Slide Time: 21:07)

So, but there are challenges in aggregations if there is scenario of dual homing or multi
homing right like say IIT Kharagpur takes a internet connection from provider 1, another
connection from provider 2, another connection from provider 3. Then that particular
network has different multi homing things. Then it then I cannot identify this overall
aggregation by a simplified thing so I need to work on some other things. So, there are
challenges, but nevertheless there is a there is a way to aggregate this sort of IP
addresses. And then my load on this routing information or routing table can be reduced.

756
(Refer Slide Time: 21:55)

So, as we are discussing the scalability through hierarchy is one of the way we handle.
So, the hierarchical addressing critical for scalable systems don’t require everyone to
know everyone else for that matter because it is only the hierarchical and the in router
needs to know or the intermediate router rest of the things reduces amount of updating
when something changes right. So, if something changes it reduces the amount of
updating in the things right. Like as again try to put on the analogy if the number of
quarters in IIT Kharagpur increases the address need not to be to be published to whole
rest of the world right.

It is only the IIT KGP post office needs to know and update it and all the packets comes
to its and it gets displayed or type of things. And if there is a and there are non uniform
hierarchy useful for heterogeneous network of different sizes. So, either it can be
uniform non uniform initially class based addressing was far too coarse because the
addressing what we have a classful type of addressing. So, CIDR helps it in that, but it
brings its own challenges in handling those that we will see.

757
(Refer Slide Time: 23:13)

So, we can have a block of addresses the separation of control prefix assigned to a
particular institution, address assigned addresses assigned by the institution to a host like
IIT Kharagpur it may have this is the network address and this is your host portion. How
you address the host portion; is basically determined by the institute network
administration right or the institute network policy there how the things will be there. For
the rest of the world the network IP IIT Kharagpur network is like this right. So, it helps
and who assigned prefixes in a at the top level.

There is a consortium or association call or internet corporation for assigned names and
number ICANN allocates large address blocks to regional internet registries. So, registry
which maintains the IP blocks regional internet registry like ARIN. We have the
American registry for internet numbers, allocates address blocks to their regions,
allocated internet service providers. And there are ISP’s allocated address blocks to their
customers who may be in turn allocate their to the custom customers and so and so forth.

758
(Refer Slide Time: 24:40)

So, there are several address registries and there are several address registries which
maintains like who is in registry dot UNIX in the Indian context. There are domain wide
pages we will show you some of the things where if you give the address who is the
owner etcetera it displays the things.

(Refer Slide Time: 25:02)

Now, definitely whether it is 32 bit addresses is enough or not that is a serious question
with huge number of devices or network connected devices in place. This is a major
challenge and we have IPv6 and so and so forth, already you know a overview of the

759
things. So, there is a there are several long term solution of IPv6 and short term we can
have private addressing scheme right this IP addresses private addresses we are not route
non routable addresses like 10 dot star dot star dot star this type of addresses are non
routable. So, within the thing so I can have some mechanisms called network address
translator which translate to a public IP and goes and type of things. There are there are
way to dynamically allocate addresses that you know that DHCP type of things. So,
those are solutions which are available on the IPv4.

(Refer Slide Time: 26:59)

So, there are several other challenges in the IP related that how much address space for
geographic region. Address space portability whether you carry over the address space
keeping the address registries up to dates there are several challenges there are what we
say so called quote unquote hard problems which are people are looking a work it.

760
(Refer Slide Time: 26:25)

Now, if we with this context if we try to look at that packet forwarding. So, what we try
to say that each router or layer 3 enabled devices which connect networks has some
informations or forwarding or routing table which maps destination address. So, router
what it is getting a address for the destination, like if I say www dot iiitkgp dot ac dot in
from this particular machine or IIT www nptel dot in, nptel dot ac dot in from this
machine it goes to the nearest router and it looks the router gets a destination as nptel dot
ac dot in.

And it tries to find out that where this IP is there either the information should be victim
or it should know that what should be my next hop right. Nevertheless it takes up it looks
as a lookup table or what we say forwarding table or routing table and sees that what is
the next hop. So, the router in other sense has to maintain this table, like anything it gets
in one interface check the table and send that appropriate interface right. If it is not in
that table so there is a concept of default route if it is not finding on the table by default it
will deduct to that particular interface right.

So, upon receiving inspects the destination IP address in the header, index into the table,
determine the outgoing interface forward the packet to the interface right. And they are in
some situation it can change the some update the header that will come later right. The
next router in the path repeats the thing so it goes on hopping, hopping, hopping,
hopping like that right. So, it checks and go to the hop.

761
(Refer Slide Time: 28:13)

Like here it get say get say if the router forwards a as per IP match destination incoming
packets forward the table entry determine the outgoing interface. So, it goes on
forwarding the table one after another right.

(Refer Slide Time: 28:28)

Here slash 24 is the IP yeah is the mask so; that means, it case that first 24 base is the
network. So, if gets if it gets a packet like this 1 dot 3 dot 24 it forwards out here this or
it gives that 5 dot 6 dot 7 dot 0 slash 24 that if the this is the network address is forward
here right.

762
(Refer Slide Time: 28:58)

Now, I can have separate entry for class full type of address, each router had an entry per
class full prefixes, a mixture of A, B, C addresses; depends on the first couple of bits on
the destination as we have seen in the class full addresses. So, identify the mask
automatically from the address like if it is bit is 0 the mask slash 8, 10 mask is slash 16
and 110 the mask is slash 24 right. Look at the forwarding table of the match and then it
goes to on the onto the things right.

(Refer Slide Time: 29:36)

763
Now, CIDR complicates this right because now it has any type of mask right. So, CIDR
allows efficient use of the limited address space that is absolutely fine the address space
is not wasted or I should say efficiently used, but makes the packet forwarding much
complicated right. Forwarding the forwarding table can have many matches like 201 dot
10 dot 00 slash 21, 2010 dot 6 dot 0 dot 23 can have more than one matches. So, where it
will forward so that is a challenge. So, the policy it is followed is the your longest prefix
match. So, where the longest prefix is matched there it is forwarded right.

So, like here in this case it needs to be forwarded 201 dot 6 dot 0 because that is the
longest prefix which match whereas, others can have a much less prefix that is this is the
longest prefix which matches right. So, that that way it takes care of the thing right.

(Refer Slide Time: 30:47)

So, forwarding table in IP router so map each IP prefix to the next hop or links,
destination based forwarding, packets has a destination address right. So, when I am I am
sending a packet the packet has a destination address. So, when I am saying www dot
iitknptel dot ac dot in so a www dot ac dot in has a after DNS resolution IP which is the
destination IP for my packet. The router identifies the longest matching prefix and some
algorithms should have to be look up on the things right.

So, routing and forwarding table so I have that destination addresses and it goes on to the
lookup tables. Now, it is what it does it does say maximum prefix match. So, though this
up to 1201 dot 10 and these are both are matching, but the maximum prefix match says

764
that the other destination this needs to be forwarded out to the 10 dot 201 dot 10 dot 6
dot 0 right and which is connected to serial 0 or some particular interface of the router
outgoing interface of the router.

(Refer Slide Time: 32:05)

So, now that is the longest prefix match algorithm is maybe as or a simple or
complicated there is a major challenge because that it is have major time. So, the router
may have a huge number of entries like the scan and forwarding table one entry at a time
may take a huge time into the thing. So, that that it requires some better algorithm to
handle this like there can be huge entries like 200000, 200000, 300000 entries into the
overall entries.

And looking at in a linear time will take a huge time whereas, the packets are being
pumped into the router maybe every nanosecond right. So, it is huge number of things
need to be processed. So, we need to have a better algorithm to find out this how this
longest prefix match can be done so that is a major challenge. So, these days it is
hardware it is handled to the hardware.

765
(Refer Slide Time: 33:00)

So, one very traditional way of or looking at it is this Patricia Tree; where it is in this
case it is a binary, where you have 0 and 1 and type of thing. So, one bit for each level of
tree some nodes correspond to be varied prefixes which I have next hop interfaced on the
in a table. So, wherever the match goes it goes on, but in some cases it may not be very
efficient because, the tree can be skewed and large number of entries can be there and
type of things.

(Refer Slide Time: 33:39)

766
That will be can have a some faster look up by having instead of binary k-ary type of tree
where things can be there much faster lookups. And, these days or we you there are use
of special hardware like content addressable memories cams also looks up at the key
rather than the flat type of addressing in looking at the things right. So, these are there
are efficient technologies look to look at, but the basic philosophy it is need to such that
longest prefix match right where it needs to be forwarded.

(Refer Slide Time: 34:14)

Now, where do the forwarding tables come from. So, routers have forwarding tables may
map prefix to the outgoing links. Then how does this forwarding table are when it will
come? Either it can have a some sort of a static entry and type of things right. So, it says
that map so and so to this particular serial port, but this is may not be adaptable right, to
failures new devices added new devices taken out. Then you need to intervene right and
in some cases there are issues of load balancing right.

So, there are they are then the concept of routing protocols come into play. That how
these packets how do you update this appropriately, how do you applied this efficiently
this forwarding tables or the routing tables so that packets are forwarded. So, these are
called Routing Protocols. We will look into this routing protocols in our subsequent
lectures and the protocols which are being routed through these particular things what we
say it is a routed protocol right. So, we are primarily interested in this routing protocols
is how these tables are will be generated so that the packets can be forwarded correct.

767
(Refer Slide Time: 35:35)

And packet forwarded by the forwarding packets, forwarded by there is a type of


forwarded by the end devices or the host like. So, at what we are having at our end is the
Ethernet link. This machine has some RJ 45 connection to the cable to the next things.
So, PC with Ethernet links, laptops with wireless links, does not need to run a routing
protocols. So, right it forward to that particular local or the next hop whatever the
gateway is defined into the things right.

So, packet to the external host to a particular gateway, where this gateway is defined it is
defined in my own TCP IP properties or the network setup. And how this information is
learnt that where the get add and where to forward; that is either it is statically it has
learned, my admin system administrator I told that you configure like this or there can be
a DHCP type or dynamic host configuration protocol that which allows me to
dynamically configure this protocol (Refer Time: 36:39).

768
(Refer Slide Time: 36:40)

And finally, how this packet is delivered at the end host; so, at the end finally, we will
see in subsequently that whenever say router forwarding to a router, router forwarding to
a particular host, or whatever it does there should be a resolution to the MAC address
right. So, finally, it should find out that what is the next hop MAC address and deliver
the things, for that we require a protocol called ARP address resolution protocol

So, there are some address called MAC address as many of you know that is the
hardware address. It comes with the network interface and in order to resolve these from
IP to MAC we require a address resolution protocol. So, mapping MAC address to and
from IP address or ARP and RARP reverse ARP type of things so we have this type of a
addressing scheme.

769
(Refer Slide Time: 37:37)

So, finally, what we look at that IP addresses and different allocation quickly already you
have known and seen that packet forwarding based on the IP prefixes right. So, looking
at that routing routers how it forwards and what we look at this long longest prefix match
when there are more than one matching coming up that where the longest prefix match is
there. So, with this we conclude our today’s discussion. We will continue these routing IP
routing mechanisms in our subsequent lectures.

Thank you.

770
Computer Networks and Internet Protocol
Prof. Sowmya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 37
IP Routing - I (Intra - domain routing)

Hello. So, we will continue our discussion on IP Routing in our Computer Networks and
Internet Protocol course. So, last day or in the last lecture I should say, we discussed
about this IP address and allocation and how the routing come into play. So, today we
will be little more going deep into the things. We will be having some basic introduction
to this inter Intra Domain Routing and in the subsequent lecture we will be going to more
detail about the routing protocols right.

(Refer Slide Time: 00:54)

So, when we talk about routing just to have a quick recap of the things or something
already you know. So, one of the major feature or one of the major aspect in
internetworking or our communication between 2 network 2 device connected on the
network is to forwarding, right, moving packets between ports right. So, in this case we
are looking at the network port. So, it can be from the host one end one host to other,
intermediate host to router, router to router, router to host and anything. So, how things
can move.

771
So, it may be on a single hop distance. It may be on a multi hop distance. So, it can be
directly connected, or it can be connected over a large network. So, look up destination
address in the forwarding table. So, as you remember in the last lecture we discussed
about the routers basically maintains a routing table. So, that means if it gets a packet for
a particular destination it says that it forwards a packet to a particular path or particular
so, to say port or next destination or like that, right.

So, it has a routing table which has all ideally all the destination possible destinations
and what should be its next hop or what should be the path to be forwarded, right. Or if it
is in the in, let us in the we will see that one in subsequent lectures when we talk about
layer 2 and type of things. Find out the find out port or output port and MAC address
right, what is the port and MAC address pair right. Finally, what we will what we know
that it finds a logical path; that is, at the IP level. Finally, in order to packet in order to
forward the packet, we need to get that hardware address or the MAC address of the
destinations.

So, that is done by this some address resolution protocol, we will come to that. So,
routing is a process of populating. If you look at that what is other way of looking, one is
forwarding another is the routing protocol, right. So, one of that that it is a process of
populating the forwarding table or the routing table, right? So, again I repeat. So, router
is a layer (Refer Time: 03:21) 3 device which has a lookup table or routing table or
forwarding table interchangeably we are using. And if a input packet comes to for some
destination it concerns the routing table that where it need to be forwarded, it forwards it.

Now, overall inter network is a large network and that is dynamic and so and so forth.
So, in other sense the router one of the objective is to maintain this routing table. How
this routing table will be updated so that, any packet comes it gets that correct path to be
forwarded, right.

So, the router exchanges; so, in order to update the routing table, the router should
exchange messages about the network they can reach, right. So, a if a router 1 is
connected to the router 2 and router 6, 7, 8, so, these routers exchange messages who
they are network they are connected, and the other things gets updated. So, find what is
my objective thing? Find the optimal route for every destination.

772
So, given a destination or given a destination finding the optimal route in the for every
destination. Like, if we try to look at the analogy finding the if I am going visiting a
place, so, one of the objective is that find the optimal route to visit that, to reach that
particular destination. So, optimal route maybe the shortest distance, I may look for less
congested route. I may have some other criteria. Like, I want to travel through a route
which is safer and type of things right. Nevertheless, based on my criteria I want to find
out that what is the optimal route from this source to the destination or for that particular
router to the destination, which way I should proceed.

(Refer Slide Time: 05:17)

Now, if we look at, so, routing algorithms; so, it is getting some local forwarding tables
are there. If these are the some for our discussions say, these are the different header
values then these are the links which will be forwarded right. If it is 0100 to 3, 0101 to 2,
0111 to 2 and so and so forth and I have that. So, given a header value if this one, it
concerns this table and forward it to 2.

So, one is this objective of the forwarding the packet is one of the work of this particular
router. Another, this table needs to be updated for this router, right and every router had
their corresponding table and is goes on forwarding the things. So, what we try to argue
if somewhere or other, if these tables are maintains properly or they are able to update
themselves in a proper in a regular fashion then, the packets can be routed from

773
anywhere in the internet to any destination, right, any source to any destination through
this different router.

One thing we should keep in mind in when we will talk about internetworking these are
some sort of a, so called distributed system. And most of the cases they are loosely
coupled or quote unquote autonomous system, right or several autonomous system
though they are at domain control, will come in this subsequently in this. So, in other
sense I do not have a control that what that other router will do. It if it is the router is in
my domain then I have some control. But, most of the cases if it is in the other domain I
do not have any control. So, that is some sort of a message exchanging are going on and
then and this routing table is getting updated. If these routing tables are updated, then we
go on hopping the things.

(Refer Slide Time: 07:15)

So, one of the issue which come into play is the stability, right. So, stable routers are
often preferred over rapidly changing ones. Or that in other sense, the routers where the
routing table is stable right. So, that the exchanges are much faster etcetera. If the routing
change because, based on the routing table or this lookup table, these packets are routed.
So, if it is very dynamic it is unstable then the whole thing is unstable. So, that is one
important aspect of the things, right. And there are several reasons. One may, is this
manageability will be better right, hard to debug a problem if it is a transient right. So, if
it is a if I if it is very dynamic and something at the when it is updating getting changed

774
etcetera, there will be difficult to problem to manage this overall process. And if it is a
large network then it is a or scale of internet, it is a very difficult thing.

Second reason is that higher layer optimizations like TCP RTT estimation like, as you
have if you remember when this in this particular course we discussed about this TCP
and round trip delay and type of things. And there will be challenges there. So, imagine
alters. Suppose it is alternating every 500 millisecond or 50 millisecond or 5 millisecond
routes and then how things will be there.

So, I need to, so, more I look for the stability then, I am less on the optimality, right. So,
if it is optimal things means, at that time I want to find out a solution which is the
optimal solution. And for that, I may need to be more dynamic or in other sense we are
basically fighting between stability and optimality, right. I, if suppose ideally if nothing
is changing then, it is a most stable. Say, for hours together nothing is changing. But, you
may not get a optimal thing. But, if I allow it to change every now and then when there is
a change then, it is more optimal. But, then the stability is hampered and that may cause
different other issues.

So, there should be some way of looking means need to be optimized and things. And
that is why when we talk about performance analysis of the network and several other
matrices then, we talk we try to look at that what amount of the stability, optimality and
etcetera we are looking for.

(Refer Slide Time: 09:48)

775
So, what we see? So, we have routing algorithms. So routing algorithms primarily what
it does? It basically allow me to maintain this routing tables right, individually at every
routers and now the routers becomes independently once it gets a packet and goes out
and so and so forth. So, there can be global or some sort of a centralized taking a call, a
taking the global consideration or it can be decentralized right. In global, all routers have
the complete topology. So if I had the whole topology of the whole global scenario then I
can make a optimize scenario right, but it may be possible over a small network, but it
may not be possible on a large network. Whereas, in decentralized on the other hand,
only know the neighbors and share information from them right.

So, I only know the neighbor. So, if the router RI, know it is only neighbor JKLM and it
shares information about the thing. Similarly, another router RJ takes the things and
going on, so it is a decentralized person. So, I am not looking at the whole world or the
whole network and taking a call, but more taking a call taking at the at a only the local
neighbors.

So, that is one, so we have a option of intra, that is 2 way of routing will be intra domain
and inter domain routing. So, inter domain all routers under the same administrative
control, when we say intra domain, it is under the same administrative control. It may be
large network; like in IIT Kharagpur, we have say around 50 odd networks under, but
under the control of IIT Kharagpur itself.

Whereas, inter domain which is decentralized, scale to internet, so huge amount of


network and etcetera which are to the scale scale of internet. So, these are inter-domain,
so these are the broad category of the things. We will come back to those things shortly.
So, we have 2 type of broadly routing, one is inter domain and one is intra domain. Intra
domain is somewhat all routers under the single administrative control like, IIT
Kharagpur network or any such networks or whereas inter domain is decentralized, so
like scale of internet and type of things.

Now, as we understand these 2 aspects has 2 routing and phenomena has different type of
consideration so right. Once you have everything under control you have a way of
looking at the problem or the routing algorithms and if you have that it is a decentralized
and not under a single administration we have to do. So, today we will be looking at

776
some basics of inter domain, rather again, the in subsequent 1 or 2 lectures we will be
looking at the intra domain and then we will talk about inter domain routing right.

(Refer Slide Time: 12:51)

So, before that we take up few couple of issues to show that we understand that what is
the challenges right, one is the issue of optimality right.

So, I can look the whole network or the in the portion of the network under consideration
as a graph. So, nodes are router and links are your edges and then the edges has can have
variable weight based on different considerations, it can be the conjestion level and or
length of the distance and a different type of consideration we can have right. So, assign
cost to each edge based on latency, bandwidth, utilization, queue length etcetera etcetera,
right, so this can be the cost to edges.

Now, our problem is finding the lowest cost path between the two nodes. So, based on a
my our, my metric or our metric under consideration I want to find out the least cost path
between node a and node b or node source node and the destination node. So, each node
individually computes the cost.

Now, if each routers had the capability to compute the cost and in a distributed fashion
and then I find out the overall cost of looking at the things right, this is now what I
looking at is a optimal solution but, it may not be possible to always get a optimal
solution, so we can go for suboptimal solution. In some cases, we will see that a concept

777
of default route is there. If I do not found a right route, then I may have a default path to
forward the packets.

(Refer Slide Time: 14:41)

Other issues which are definitely come into play is the scaling issue, like how it scale,
how the algorithm scale. So, each router must be able to forward based on any
destination IP address. So our bottom line is that whatever is the destination IP address
the router should be able to forward. So, given the address it needs to know the next hop
consulting the routing table or the forwarding table. So, it has to know that where it
should go next.

So, one of the naive approach maybe have a entry for each addresses right, one that I can
have entry for each addresses but however, that will be a usually there can be huge
number of entries there right the to the scale of 10 to the power 8, 10 to the power 9 type
of entries, if you consider the all systems etcetera across the across the domain right. So,
it will be huge number of address, then that is that may not be practically feasible.

So, one solution may be entry covers a range of addresses right. So, I have a things
which covers a range of addresses, like out IIT Kharagpur router takes care of the rest of
the 20,000 odd systems within the campus right, systems in the sense systems, devices
etcetera network enabled devices within each domain right but, for the external world it
looks at only 1 router or maybe 1 or 2 routers which are looking at the things right.

778
So, that may be so I do some sort of a address aggregation on the things. So, one is that
we can’t do this sort of things if the address are assigned randomly right like, ethernet
address or hardware address which comes from the manufacture we look at when in our
subsequent lectures. So, we cannot do something which is randomly assigned right.
Address aggregation is a important aspect which we are looking at address allocations
should be based on network structure. So, I can aggregate addresses provided that is the
in the network structure.

Now, if you look at some a type of analogy when we look at our normal postal addresses
etcetera, we are able to club them together because, there is a sense of inherent
aggregation, if it is a randomly things then making things very difficult like, if the house
number 1, 2, 3, 4, 5, 6 etcetera are closely in a particular locality then sending the
particular forwarding that letters or sending letters with the postman is easy. But, after 1
if it is 101, then 49, then 216, then it is very difficult to pack them together or things. So,
that it is that, otherwise what we require is that some sort of a that addressing mechanism
itself favor this aggregation. So, that may be one of the requirement of the means, one of
the way of looking at it. So, aggregation is important.

Now, let us come back to our basic problem. So, what we have seen these are some of
the things which we try to address that scalability, optimality, stability and of the several
routing protocols and if we look at the other way this, again come back.

(Refer Slide Time: 17:57)

779
So, what we have that we can have a way of direct delivery say, 2 systems are connected
by a cable and then I directly deliver one packet to another right, or I can have indirect
and delivery system right or I can have multiple things.

So, I have in this case a router which forwards the things etcetera and there can be
multiple where the routing come into play.

(Refer Slide Time: 18:21)

So, one route method that if I want to I can have a lookup table like, that if I want to go
to a particular host, this is the series of things I need to do router 1, router 2, then host B
right. So, it is explicitly specified that where things are there so, this route method is
explicitly specified that, this is the route by which you. Other way I can only say that it is
on the next hop, I only specify the next hop, the next hop takes care of that where it
should go right, that in the routing table of A, in order to go to host B in this for host A,
the it says that in order to go to B, you need to go to router 1. Router 1 says in order to go
to host B, that is the router 2 is the destination or the next hop, I should say next hop,
routing R2 says that it is connected with this particular network, so we can directly there
is no next hop, you can go directly go to the things.

Now, you see this is the next hop-based things so, individual routers R1 and R2 they
maintain that routing table, that given a destination where it should be pushed right so,
that is next hop-based thing.

780
(Refer Slide Time: 19:40)

Then, we can have host-specific versus network-specific, last class if you remember, we
are looking at that it is router is primarily between networks to network, not meant for
host to host right it is not like that, cannot be done but, it is mainly for network to
network.

So, if it is in the particular router a host is on the host specific method, if it is destination
is A then, R1 is the next hop B is R1 C R1 and D, R1, so for all things are there and for
routing table for host A is based on the network specific thing that, in order to reach
because, A B C are all connected to this network N2 so, it has a one thing if it is a
network, that in order to reach N2, that R1 is the next router right.

So, this network definition so, instead of taking individual host I take, we consider here
the network where the host are like and then I forward the packet on the based of the
network right.

781
(Refer Slide Time: 20:57)

So, there is a concept of default route. If I cannot find something where to be forwarded,
then where should I forward? So, there is a default route like, in order to go to network
N2, push it to R1. In order for any other network, push it to R2 right, so, this is a default
route. So, there is a concept of default route if it is if it cannot find that where the routing
table things are there, it will put it to the default route.

(Refer Slide Time: 21:25)

Now, if we look at the basic modules or very fundamental structure of the a particular
router - so once it is received a packet you need to extract the destination address from

782
the IP address. So, these are routers are as I, as we discussed earlier that these are layer 3
switch which has enabled up to network layer. So, it opens up to the network layer and
extract the destination address and the next-hop destination address and the next-hop
address and the interface. So, it extract the destination address, search the particular
routing table or the forwarding table and find out the next hop address and the interface
number, like it has to go to that particular address and to the interface number right and
what happens when I want to push the packet to the things, I need to know the MAC
address or the hardware address of the of the next hop. For that I require a ARP protocol,
so that we will discuss later on. So, ARP protocol, so that I know that what is the next
address and push it the things. So, in other sense I have some sort of a net mask, network
address, next hop address and the interface of the router where it need to be pushed.

(Refer Slide Time: 22:46)

Like here what we are having, there are several network like starting point, 180 70 65
slash 25 here 201 4 dot 16 dot 0 and it is connected with different interfaces of this
particular router right. So, it connected to the different phases of this router and there can
be a default route, may one of this interface right.

So, these are this is a connection for 201 dot 4 dot 16 dot 2 slash 22, 180 70 slash 25 and
so and so forth and there can be other router, sorry other router connected to this type of
interface.

783
(Refer Slide Time: 23:35)

Now, if I see for router R1, if we look at if it is a slash 26 type of net mask with this
network address then, the next hop is m2 right ok.

So, if you look at so, slash if the net mask is slash 25 and the network address is 180 70
65 128 then, the next hop is m0 right, similarly, so and so forth. So, slash 24 201 dot 4
dot 22 dot 0, it is m3 right so, this is this is the address that it goes to this network right
201 4 22 0, the next is slash 25 in the network, it should have been m3 out here there is a
type here, not type that m3 came up into the this particular interface.

So, in other sense the routing table of this what it says when it is this net mask so, when
it is gets a packet it checks with this net mask, if the address matches, it push it to that
particular things right. So, I get a get a input packet from somewhere then, I extract that
particular destination IP, do a masking, if the address matches with these network
addresses, just put it push it to their interface. If it does not matches then, it push it to this
default interface right.

784
(Refer Slide Time: 25:19)

Like, some example forwarding process if the packet arrives at R1 in which the
destination address is 180 70 65 140, right.

So, if it is there so, it does at slash 26 because, as you remember so, you on the longest
prefix first right. So, 26, 25, 24, 22 so, first it does a it has 26 applied, the result is 180 70
65 128, you can apply those this type of mask that that means, 26 1 followed by their
zeros and apply to this that the value will get that these values and this does not match
with the corresponding address right, then it goes to the next slash 25 and it gives a value
of 180 70 65 128 and it matches with the this one, the second entry of the thing.

So, it push it to the m0 right. It matches with the corresponding and the packet is
interface m0 passed to the ARP for further processing. Now, what m0 interface, in order
to go to this m0, what it has do, you need to find out the hardware address of that
particular interface so, it does a ARP resolution, address resolution protocol right. So, at
the ARP typically changes a map say, IP address to a hardware address so, if it goes for a
ARP request, it returns that what is the hardware address of that particular device, so that
packet the frame at the layer 2 level can be forwarded.

So, your so, ARP things will be discussing later so, we need not immediately bother
about the ARP. But see, if a packet comes first it follows these things in the in this order
right, as we know that the we want the longest prefix match, so, 26, 25; first 26, then 25,
24, 22, if does not match go to this default right.

785
(Refer Slide Time: 27:16)

So, say another example. So the forwarding process if the packet arrives at R1 with 201
dot 4 dot 22 35, again do with a 26, is come up with a result 10 2 1 dot 4 dot 22, it does
not match with the corresponding, there is no corresponding this, It then goes for the next
slash 25 and does not match with the row next entry, does a third one in the 22 which
matches with the corresponding right and then it goes to the this one destination, that it
goes to the particular m3 and the at this particular resolution again will be done right.

So, what we see here that given a packet and given this type of net masking and looking
at this I can basically forward the packet to the particular, to that particular destination
interface and there is a address resolution; that means, I need to know the hardware
address to forward the packet of the frame at the layer 2. So for that as, resolution is
required. But the primary routing reason is taken care by this thing right.

786
(Refer Slide Time: 28:29)

So, what we see there is there may be a need of address aggregation right, like in this
case a organization 1, 2, 3, 4 may be taking service of a ISP and have different type of
network addresses right. So, I instead of having all those entries I can have a particular
network address and then I can have a next hop type of things.

So, I can so, in this particular thing I can have a entry like slash 26 if this network
address is this, next hop is m0, m1, m2, m3 and m4. Whereas, in the routing table 2, I
identify that all those things as a single network as a slash 24 and it push it to the m0. In
other sense, for this rest of the word or these routers R2, this is aggregated as the as a
single network as with a mask of slash 24, 140 24 7 dot 0 slash 24 and any packet
coming with that it will be forwarded to this packet right.

So, this is the way of looking at the things. So, these address aggregations helps us in
clubbing these two, all this together for the rest of the so, you see for the entry of the R2
becomes much simplified right. So, if instead of these 4 organization, in 400
organizations such like this things that will be it will be heavy, a huge load on this type
of router and the processing time will be much higher because, it need to go to this
scanning these things.

787
(Refer Slide Time: 30:23)

So, we come as a there is a concept called autonomous systems, like correspond to the
administrative domain, internet is not a single network, it is there are several autonomous
systems reflect organization network so, there are different autonomous systems which
have some authoritative control or the administrative control of the network, like in this
case, in your city likes Stanford a large company or IIT Kharagpur and type of things can
act as an autonomous system. So, goal is autonomous systems want to choose their own
local routing.

So, within the autonomous system the say IIT Kharagpur whatever the internal intra IIT
KGP routing will be there it can choose. ASes wants to set up policies about non-local
routing so, whatever for the non-local routing, for the external it can set up a policy. Each
AS autonomous system is assigned a unique 16-bit number, like this is a scenario of
autonomous systems.

788
(Refer Slide Time: 31:16)

So, we will be going little bit on the that how these routing structures are there, there are
backbone routers and other type of things but, nevertheless these are the different
autonomous system, very loosely if you would like to see and these are different
networks, they have a bunch of routers and type of things and they can, they have they
can communicate between each other.

So, more you we say this built in the ASes or what we look at is a some mostly as a
policy-based routing, whether within the autonomous system there is the local or intra,
the autonomous system individual autonomous system has the authority or total control
over the network and decide on the routing.

789
(Refer Slide Time: 32:02)

And there are different type of AS traffic, local traffic-packets with source and
destination in the local AS, transit traffic passes through the AS, stub AS-connected to
one single autonomous systems so, that is the type of stub, a router stub AS. Multihomed
AS-connected to multiple autonomous systems, carries no transit traffic right. So, it is
connected to the multiple autonomous system and push it to the respective. Transit
autonomous system connects to multiple AS and carries transit traffic right. So, that is
the multihomed where it is not carrying the transit traffic but, connected to the things and
there is a transit AS.

(Refer Slide Time: 32:42)

790
So, finally, we come to that intra domain routing with a, within an AS so, single
administrative control: optimality is important, within the thing that optimality is
important factor, contrast with inter-AS where policy dominates whereas, we will see
that in our next subsequent not in the next lecture, subsequent lecture that inter routing
protocol BGP where we will look at that policy-based routing or the inter-AS and
predominant intra domain routing algorithms.

(Refer Slide Time: 33:10)

One is distance vector, requires only local state, less overheads, smaller footprint, it is
sometimes difficult to debug, can suffer from loops, we will look at it. There is another
thing called link state, have a global view of the network. What we are talking about the
intra routing, simpler to debug, requires global state, that overall state of the network.

791
(Refer Slide Time: 33:38)

So, if we look at the routing protocols, so, we have intra domain and inter domain.
Intradomain is distance vector and link state, inter domain is path vector, link state is RIP
and OSPF and path vector is BGP. We will discuss those things in little detail.

(Refer Slide Time: 33:55)

And just to have a view of this distance vector routing, so, every in a distance vector,
each node shares its routing table with its immediate neighbor in a periodical periodical
in a periodical manner at every time interval say every 30 millisecond or so or based on
the things and when there is a change.

792
So, whenever or and when there is a change, if there is a change it will change or it will
go on sharing the things on a in a beaconing the things right and based on the things,
other things decides, like if I say A, A has a direct connection to B where 5 is there, A has
a connection to C where 2 is there, 3 is there so and so forth right, whereas A do not have
any connection to E, where it has go to C via C and like this. So, it goes on updating the
thing similarly, so for D, it is a only connected to A, it has different paths to look at the
things so, if we want to go to B, it has to go via A and the cost for, to go to D to B the
cost is 3 plus 5, 8 right.

So, there can be different type of paths. We will look at that what are the different types
nevertheless if you see, every router is having its routing table, that if one on to go to
these are these networks where it should fall. There could have been another entry here
that is default, if it is something which is not known where it should forward to right.

(Refer Slide Time: 35:31)

So, if we initialize at the initialization at the initial step for A, where nothing is known
say A starts up so, for A to A 0, A to 5 because, these are connected but, A to E, A doesn’t
know where E is so, it is infinity.

So, when gets A, but, it C knows where E is with 4. So, next time it gets the beacon or
the miss update from the C, C is router update then, it updates it with the things. How
these update process will go on, we will discuss in our subsequent lecture. So, this way it
goes on doing that. So, we will be discussing more detail on taking into these inter

793
domain routing looking at different RIP, OSPF or distance vector and link state routing in
our subsequent talk. So, let us stop here and with that basic understanding of what is
routing, what are inter domain and inter domain, intra, inter domain routing and in the
subsequent lecture we will we will discuss in detail those things.

Thank you.

794
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 38
IP Routing-II (Intra-domain-Distence Vector, Link state)

Hello, welcome to this course. We will continue our discussion on Computer Networks
and Internet Protocols. So, we are discussing on routing protocols right as we discussed
over this lectures. So, one of the primary objective of this overall network is route a
packet from one source one node to another node in the internet right. So, and it may go
on over several routers right. So, there are two things which is important: one is that
what is being routed right, the packet which is being routed.

Another is that how this routing is possible right, how this routing happens. So, in other
sense if we see, if you recollect that what we have seen that every router or in
intermediate or in the internet routers every routers maintain a routing table. So, what it
says, that if the packet is for this particular destination then follow this particular
interface of the router right.

So, in other sense what we see that our routing protocols primarily aims at updating this
routing table or sometimes called forwarding table. So, if I get a get a packet with so,
such destination, then I need to forward to this particular network; that is my objective.
As we are referring to the analogy, like if I have a road network with different crossings,
which acts as a forwarder or routers. Then, the person or the traffic person in the crossing
may help you that you say that, if I want to go to that particular destination which path I
need to follow or what should be my next hop to follow right.

So, this is this is the thing will do. So, what it needs to do that every this router or the
traffic man needs to be updated or maintain a table or lookup table a forwarding table by
which, if say if we looks that this is my destination, this should be the network right. So,
the protocol across this overall inter networking with helps in doing this forwarding or
routing of packets are routing protocols.

Now, we will see subsequently there is a concept of autonomous systems. So that means,
it is a good group of network or a portion of the whole network along with hosts and the

795
necessary things like their connectivity protocols and so on and so forth. It constitute a
autonomous systems autonomous system. We will we will look into those things and
these autonomous systems usually under one organizational or administrative control.
Like IIT Kharagpur along with several networks, routers, hosts, protocols running,
connectivity defined etcetera for can form a autonomous system.

That means, it is inside the things it maintains as a autonomous system. So, overall inter
networking or a overall internet is of this type of autonomous systems or popularly
known as AS. So, every AS has a unique number right so that it is identified. Now, you
see so, some of the packets need to be routed within the AS, some of the packets need to
be routed outside the AS right. Suppose, you are said sending some source to destination.
So, destination can be within that AS only or the source and source and the destination
can be different AS.

So, for that we require something what we say intra domain routing sort of thing or inter
domain route of things right, which is localized and which is more globalized right. So,
conceptually you may say that the same algorithm may work across the thing absolutely
no problem, but there are issues of scalability, there are issues of time complexity
etcetera. So, based on managing a small network is much easier than managing the
whole internet and type of things.

Secondly, that internet works most of the things works on a cooperating basis. You may
not have control over whole internet working as such. So, you cannot you may not run
the whole thing at a surfaces right. So, what will, what we have started from the last
class, we will be continuing that we look at the intra domain routing right. Primarily, we
today we would like to look at the intra domain routing which has two specific primary
category of distance vector and link state type of protocol right.

796
(Refer Slide Time: 05:11)

So, as we discussed if we look at the dynamic routing protocol. So, that is another
concept of static routing; that means static routes as specified, but if we look at the
dynamic routing protocols. So, we have intra domain or inter domain and inter domain
has two things, that two group of protocols. One is distance vector, another is link state
protocol.

One a very popular protocol in distance vector is the RIP Routing Information Protocol
or the in the Link state is the OSPF protocol for the in the link state whereas, in the inter
domain we have a concept of Path vector routing. And, one of the very that major
protocol will which predominates is the BGP or Border Gateway Protocol right. So, this
way we segregate, we today’s talk or today’s discussion will be primarily hovering
around distance vector and the link state protocol right.

797
(Refer Slide Time: 06:19)

So, just to quick recap. So, if we have a routing protocol one can be a static route that the
static route uses programmed definitions representing paths through the network. That
means, already programmed or already defined routes or it can be a dynamic routes.
Dynamic route algorithms allowed router to automatically discover and maintain the
awareness of the paths through the network right. The difference between these protocols
is the way they discover and calculate the routes to the destination. So, everybody’s
objective is to update the routing table to a individual router, such that the packets are
forwarded optimally.

The different routing protocols which they differ is primarily that in what sort of how
they discover these routes. How they calculate the new routes etcetera. Why this is
required? The, what we see that the internet is a dynamic phenomenon. The packet that
there are means routes being added or deleted in dynamically right. And secondly, this is
not under a single administrative control overall right. So, you need to have update you
need to update individual or a router needs to update its routing table dynamically based
on that how what frequency and other objectives are there.

So, to in order to maintain a appropriate routing things. Again, though there are
predominantly distance vector and link state at the predominant protocol. There are sorry
there are three distance vector link state as the inter domain. And, path vector protocol is
the inter domain whereas, there is another protocol called hybrid. It is not a new

798
protocol, but mix of this sort of things that also people use. But, that is mostly used in
some sort of a proprietary or more regulated scenario.

(Refer Slide Time: 08:23)

So, we will see that distance vector each router in the internode maintains a distance or
cost from itself to its neighbor. So, it is more localized like a router only look at the look
or maintains and share the information about the, its neighbors along with the cost. This
or sometimes we call that distance of the things. The path represented by the smallest
cost become the preferred path to reach the destination right.

So, if there are more than one path for the destination the minimum cost path will be
taken these information is maintained in a distance vector table right. The table is
periodically advertised to each neighbor and each router processes this advertisement to
determine the best paths. So, what happens that every router has a localized information
about his neighbor and the cost and it goes on advertising right. And, the neighbors
listens and go on updating the things.

So, there is a period of advertisement that is how periodically it is done, one maybe one
is every 30 seconds and so. And, along with that there can be thing that, if there is any
change the it will be advertised. Based on this input and that already packet available to
it already the table available to it the a particular router updates the routing table. And, in
way it is some sort of a this sort of whispering goes on into the whole internet or whole I
to say autonomous system or and then it goes on updating right.

799
Whereas, in link state each router advertises a list of all directly connected network and
associated cost of the link. Or, it tries to look at the whole network or the portion of the
network in the autonomous systems. And, it advertises the what is the link state it says
right. This is performed through exchange of link state advertisements or popularly
known as LSAs - LSA with other routers in the network. Using these advertisement each
router creates a database detailing the current network topology, the topology database in
each router is same.

So, in other sense the every router advertises the what way the networking overall
network state or the picture is there to the rest and it goes on updating and, at any point
of time ideally the routers have the same picture of the network under its under its
domain or under its where in the region it is there. Like in the AS or the area in the AS,
where it is there it has the whole picture. Based on the thing it calculates the how to go to
the destinations. So, one is more localized only with the neighbor, here it has a global
picture of the things.

(Refer Slide Time: 11:25)

And, in case of a path vector it somewhat somewhere in some of the literature say it is
somewhat similar to distance vector, but not exactly. But, there is a thing instead in case
in path vector we have destination, distance to the destination, and the that what is the
path to reach the destinations right. So, it is not the which is the next networks, but what
is the path in the rest of the to reach the destination.

800
Or later we will see that we need to talk about BGP, BGP and all those things then you
will see that the it says that this that the ordered set of autonomous systems which the
router need to pass to reach to that particular destination, if it is a inter domain routing.
And finally, the hybrid protocol this protocol attempt to combine the positive attributes
of both distance vector and link state. So, networks using hybrid protocol tend to cover
more converge more quickly and so and so forth. But, most of the cases it has be it has
been seen that in order to maintain these both this type of things you require some more I
should say hardware or resource support.

And, in most of the cases if you have a more controlled environment or what we say
proprietary environment that is this may be much useful. But, but in number of cases we
do have those type of things. So, this can be followed. So, these protocols potentially
reduce the cost of link state updates and distance vector advertisement and try to have a
optimized path along the things.

(Refer Slide Time: 13:11)

Now, so if we have a is typically a scenario like this where there are different networks
connected by different routers A B C D like that.

801
(Refer Slide Time: 13:23)

And then so, if we look at the distance vector what we have discussed so, A says that
periodically says the knowledge about the about the whole network to B E F. So,
whatever it has in having the knowledge its send is to B E F to its neighbor. Similarly, in
case of B periodically send my knowledge about the whole network to A and C.

So, whatever it is having the knowledge about the whole network it share with its
neighbor. So, some sort of a whispering with its neighbor right. It goes on doing that and
in order to do that it attempts to converge right.

(Refer Slide Time: 14:05)

802
Look at another example like in a distance vector each node share its routing table; that
means, the knowledge about the network with its in immediate neighbors periodically
and when there is a change. So, it is either it will be a periodically; that means, every say
time period t and when there is a change. So, if there is a change, then it also exchange
the thing, like A B C D etcetera.

So, A have the knowledge that from A to A the cost is 0, A to B is 5, A to C is 2, A this is


the first table is the A’s table right, A to D is 3 and A to E is 6. Now, A to E is 6 via C. So,
the next stop is C. This blank means the next stop is the immediate either itself or its
immediate neighbor. Similarly, if you see the cost of D you can deduce that A directly to
A as 3, but to B it has to go via A.

But, to so, it next stop is A then B, but it could have been A C B also based on the
costing. Like from for C it has to go via A and then C, similarly for E it has to go A then
C then A. So, A to D to A is 3, but for going to A to E is via C is 6. So, overall costing is
9.

(Refer Slide Time: 15:51)

So, initially so, if we look at initially, what is happening? Initially, if you look at A for A
it what is see that to itself is 0 A’s table, to B is 5 because, that is directly connected. To C
is 2, to B is 3 and to E is infinity, because it know does not have any information about E
that is not directly connected.

803
So, this when the router say time t equal to 0, it has these are the instances. Similarly, for
B is like this, for B is something like this, C for C is something like this, D is only it is
connected to A. So, D knows that to reach itself is 0, reaching to A is 3, it is directly
connected. But however, going to any other network or any other routers it is the infinity.

(Refer Slide Time: 16:53)

Now, when it advertise say we look at the A’s table right. So, A receives A instance also
C from C what it is receive, it to for C to go to A is 2 B 4 C 0 D infinity E 4 because, it
does not have any knowledge about the D initially right. So, A receives say information
from C, similarly it receives information from B also right at periodic information right.

Now, on receiving say we consider only one that C, subsequently it will come same type
of activity will go for what it this is from B. Now, on receiving it compares that so, in for
if it goes via C reaching A will be 4. That means, it says that A to C is 2, C to A is 2 right
4, but wherever it has a better hosting thing like A to A is 0 it is having. So, it updates is
A 0 with no hop. See in order to reach B C says that it has a thing called 4.

So, what it what it say is that in order to reach A to C is 2 and C to B is 4. So, in order via
C if it goes, reaching B is 6. It has a better advantage out here reaching B is 6, it
maintains at 5 right. Similarly, going to C via C it has 2 and now here also 2 so, it keeps
that. For D, C do not does not have any information because C is not having any
information. So, but A already having that reaching C is the it maintains that. For E, C

804
says that via C that it is a there is it can go by 6 whereas, A’s initial table says it was the
infinity. So, it updates as the thing.

So, the C is so, the A’s table, A’s routing table after receiving the information from C it
becomes like this right. Now, similarly it will receive the information from B also. So,
that updated table can be compared with the B, it can be before or after. Nevertheless,
what you what we see it finally converges to the things. But, if it is very dynamic or in
some typical cases there may be situations where you may end up in, what we say non
desirable states right which you do not want to be there right.

So, what I encourage those who are learning this thing in for the first time or not very
much accustomed with this try to find out these tables yourself right. What will be the
updated table for B from the initially or E and how it goes on right. It is easy if you do it
we I also tried that all references along with the things you can consult those books and
type of things.

(Refer Slide Time: 20:15)

Now, there may be some problems right. Like let us see that there is one is two node
instability problem right. Why, what is happening? Now, see if this is the network or
portion of the network right, let us consider this is the our networking consideration. So,
A for A table reaching X was 2 and it is directly connected alright. Reaching B for B in
stable reaching X was 6 and it is via A and nevertheless it is other things are there. So,

805
dot dot dot that means, it has other information we have only, we are only considering
these three nodes.

Now, after failure that means, there is a link failure between A and X. So, what A updates
that reaching X via A is infinity right. So, there is no connection. However, still there is a
B is still get yet to get the update from the thing right. So, if it A receives a update from
B during that time. So, what it does? It sees that though there is no path for 2 X directly,
but there is a it seems a there is a path from A to via B. So, it updates so, A to B is 4 and
B by virtue of these says that in order to reach X it is still having that 6 entry right.

So, what it does? It goes on X to it says that it you can reach X via B by 4 plus 6 10
right. And, though only looking at the three nodes may be little, you may be little
confused that why what is the big problem. But, if you look at the whole internetworking
situation or a large network so, this can very much happen based on than when you are
receiving this beaconing or the messages etcetera.

Now, subsequently A B updates through A and find that it is 10 plus 4, 14 and goes on.
So, long they do not end up in a infinity; that means, non reachability finally, it goes on
the things. So, these goes on a two node level instability. So, this is a typical situation
which may arise in this sort of scenarios.

(Refer Slide Time: 22:45)

806
There can be a option of a problem of what we say three node instability right. So, there
are three node A B C, A is same thing A is connected to X via with a link of 2. Then what
we see after A sends the route to B and C, but the packet to C is lost right. So, what is
that there is a failure out here, A gets to infinity and A updates the thing. So, B also gets
the infinity, but somehow the packet to C is lost you know.

So, C its still keep that X 5 A right. So, and based on that in the next round getting the
advertisement from C, the other tries to update. B updates as 8 right, getting a update
from the B, A finds that there is a path to X via B right with a 8 plus 4 12 and it goes on
increasing like this right.

So, this is another problem of three node level instability right. So, there are issues which
need to be addressed when we look at the this sort of link state type of scenarios. Sorry,
this distance vector type of scenario. So, these are what we are discussing about distance
vector routing, where it whispers to the neighbors.

(Refer Slide Time: 24:25)

Now, a another routing protocol where which take which keep the inter first of all intra
domain routing protocol, which keeps the track of the which keeps the track or which
keep the state of the whole network is link state routing right. So, the basic philosophy is
a link state is a description of a interface of a router; that means, IP address may be
subnet mask, network type and so on and so forth and is connectivity to the neighboring

807
routers. Or in other sense I so, we can look at that it keeps a network graph in a sense
right.

The collection of these links link states form a link state database. The routing algorithms
use this principle of link state to determine the network topology. So, in other sense the
every router keep track of the topology of the whole network right. So, link state
approach to determine network topology, if we look at; each router identifies all routing
devices on the directly connected network right that is easy.

So, whatever the it is directly connected. Easy router advertises a list of directly
connected network links and is associated cost links; through a exchange of link state
advertisements or LSAs right with other network right. So, it has a each router advised
the LSAs. Why in this advertisement each router creates a database detailing the current
network topology. So, by looking at this advertisement or receiving this or using this
advertisement, it makes the network topology.

The network topology in each router is typically or ideally should be same right, each
router should be same. Each router uses the information in the topology database to
compute the most desirable routes to the each destination. So, in other sense it goes on
advertising these link states that whatever the connectivity information is there. So, each
router gives the information and make the network topology of its own.

And, they using this database, link state database or the topology it constitute or it finds
out that what is the optimal path or optimal route to the destination network right. And,
this information is used to update the routing table finally, it updates the routing table
and it goes on that, if this is the destination this is the route and this is the interface to be
used of the router. So, that is the routing table update because, when the packet comes it
gets stored and forwarded based on the routing table.

808
(Refer Slide Time: 27:33)

So, in the same way if we look at that same type of network. So, what it says that I send
information about my neighbors to every router. I send information about my neighbors
service so, everybody sends information and other things and every individual nodes that
the router constitute this. Or update its link state database and realize the network
topology and find the best path based on this topology.

(Refer Slide Time: 28:07)

So, similarly like what you are seeing the link state things. So, individual router has this
sort of instances of the network right, at a particular time. And, then a they take a call

809
based on this topology. Find out the best possible path and update this routing table
which is used by the packet forwarding.

(Refer Slide Time: 28:35)

So, same thing link state knowledge as states of the links that how that connectivity and
type of things are there. These are the different link state knowledge of the individual
routers.

(Refer Slide Time: 28:51)

And, then it can use some sort of spot algorithm, the popular algorithm like extra
algorithm can be used. So, like the this already we know that how this algorithm was.

810
Now, once for this algorithm to work and find out the that optimal path or the shortest
path, we need to have the whole instance of the network. So, said route to the local node
and move it to the tentative things.

And, this is the, and if we have the tentative list is empty then stop. So, long then as is
not empty, it goes on iterate like this; like among the node in the tentative list move the
one which is the shortest path to the permanent list. Add each unprocessed node in the
last move node to tentative list, if not already present. If the neighbor is in the tentative
list with in the tentative list means larger cumulative cost, replace with new one right.

(Refer Slide Time: 29:55)

So, this is the standard way of looking at it and if we construct that shortest path tree per
say. So, the tree will look like this one right. Initially, the topology is like that initially the
say the route to A and move to tentative list; move A to permanently list and add C these.
Then, if move C to the permanent list because, it is the least path from the A and so and
so forth.

And, finally, we end up in the position 6, where our tentative your list is empty and as the
algo says it stops. So, it finds out the overall 3 and this can be used for updating the
routing table or the service forwarding the packets to the next destination or rather next
hop to reach the destination.

811
(Refer Slide Time: 30:51)

So, in doing so, if we see the routing table of A’s routing table. So, no reaching node A is
called 0, B is 5, C is 2, D is 3 and E is 6 via C right. So, this is the table which is being
constructed from the, from using those information. And this the updated table can be
used for forwarding the packets.

(Refer Slide Time: 31:23)

So, if we try to summarize this link states. So, share knowledge about the neighbor
neighborhood, share with every other router, share sharing when there is a change right.
So, one of the popular link step of routing protocol is the OSPF: Open Shortest Path

812
First, which uses is in state protocol to update table. And, OSPF if you see that it is a in a
we will see later on. It is the popular protocol or inter domain routing protocol, which is
used in as for intra domain routing in the in within the AS or a with in the areas in the AS
right.

So, this follows the link state routing. So, what we I have seen that the broad way of how
this distance vector and link state works. And, the popular protocol for your distance
vector is RIP and whereas, this in case of a link state it is OSPF. So, with this let us
conclude our lecture. We will be continuing our discussion with this intra domain and
subsequently inter domain in (Refer Time: 32:45) subsequent lectures of this particular
course.

Thank you.

813
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 39
IP Routing-III (Autonomous System (AS), Path Vector Routing)

Hello. So, we will be this we will be discussing on routing protocols, we will be rather
continuing our discussion on routing protocol in our course of computer networks and
internet protocols. So, as we discussed that routing is a layer 3 phenomena, which
connects networks, right and if the device is at least layer 3 enable. So, and also we know
that every router maintains a routing table or sometimes called forwarding tables which
is sort of a lookup table, by which any packet receive coming to that router look at that
table and then get forwarded to the next hop.

And as the overall internet is dynamic not maintained, so to say with a single
administrative authority. So, this routing table are need to be updated so that the overall
knowledge of the network, how need to be where the paths are need to be is known to the
things. Now one beauty of the thing is that, that this routing protocols which helps in
updating these routing tables updates the tables individually; that means, router a or
router x has this table x which is updated and independent of the other things right.

So, it is only concerned about this the updating this table in such a way so, it gives it
helps in providing the best possible route so, that is the basic objective. So, the routing
protocols which is employed or deployed is basically in every router is basically to
update the table with other co lateral informations. And also we have seen there is a
concept of autonomous systems; that means, the whole internet divided into several
autonomous systems, with a autonomous system identifier; where there are 2 type of
things one routing within the autonomous system and another across the autonomous
system. So, in a sense we have intra domain routing and inter domain routing type of
things.

As we understand that this whenever you have a more administrative control and a over a
particular network and the resources you have a better way of manageability, but when
you have a in a very large network, then you have to follow some sort of a some sort of a
what we say collaborative approach right.

814
Secondly there can be lot of other issues which come into play. It is not only finding the
shortest path or the optimal path; it may so happen that I need to look at some policies.
Like I can say, that I want to forward this packet, but I do not want to travel through this
network right or I must travel through this network or these are the networks which I
which are more friendly networks which my packet need to be travel etcetera, right.
Other than other metric like congestion list time, RTT and a lot of other things, I can
have some sort of a policy defined on the on the particular while pushing the packet
across the network right.

So, today we will see the basic concept or basic components of autonomous system and
or AS and the basic philosophy of the path vector routing or which the popular routing
protocol BGP employs right. So, it is most of looking at the autonomous systems and the
path vector routing is the thing along with definitely the BGP will come into play. So,
just to repeat the same picture, we have broadly 2 things, intra domain and inter domain.
And this path vector is a inter domain routing; that means, across the domain or across
the autonomous systems type of things.

(Refer Slide Time: 04:35)

Now, what is a autonomous system? So, autonomous system or a, AS can be looked as a


logical portion of a large IP network, right. So, it is a definitely, there are physical router
etcetera, but it is a logically a large IP network. And AS normally consists of an inter
network within an organizations; that means, it is somewhat under one administrative

815
control or one administrative what we say policy right. It is administered by a single
management authority and AS can connect to other autonomous systems, managed by
the same organization or public or private and so and so forth right.

So, let us repeat so it is a so what we are saying that this whole internet, I take a group of
things which are logically maintained by a organization or a administrative authority, and
it can or it definitely it help to communicate with other autonomous systems; which are
may be of the same organizations, may be of other organizations may be public may be
private and type of things, right. So, what in a sense what we have like the figure shows
that we have several such autonomous systems acquired the things.

And autonomous systems identify is identified by the by a unique number, what we get
from the international regulatory or authority. And so that we every autonomous system
as a unified is a unique number to identify. Now within the autonomous systems there
are routing are done by through inter domain right, intra domain right, within the domain
routing and typically OSPF, RIP are the popular things to be routed.

So, in this case we have you see we have 4 autonomous systems. There is a designated
router called border router, autonomous border router; which keeps the informations of
all all the, of the network within the autonomous systems. So, in other sense, it gets
updated by the OSPF or RIP protocol inter domain routing protocols which updates the
things, right. If this in turns helps in these routers helps in finding the path between one
autonomous system to another autonomous system.

So, we try to emphasize there is a concept of path between one autonomous system to
another in autonomous system; that means, when the packet is routed it, it try to find out
that in order to reach the destination which are the set of up ordered set of autonomous
system need to be covered, all right. And this gives us we will see this gives us a lot of
flexibility in policy based routing right. I can say that I do not want to touch that
autonomous system or I want to go through this autonomous system provided there are
connectivity’s available and so and so forth.

Now, these autonomous systems need goes on updating their information using these
border routers right. So, if we look at the routing protocols at the autonomous systems as
we have discussed.

816
(Refer Slide Time: 08:19)

So, 2 sets of routing protocols are used to determine the routing paths within the AS. One
is to determine the routing paths within the AS; others are used to interconnect a set of
autonomous systems right.

So, one is within the AS; that means, the routing which will be done within the AS, as we
are saying these are these autonomous systems individually are with one organization or
one administrative control; that means, what sort of routing has to be done is based on
that the total discretion of that particular organization which may be influenced by the
type of organization or type of traffic flow it is having and a nature of the organizations,
or nature of the network they want to envisage and type of things.

It is nothing to do with the other autonomous system. Only the autonomous system looks
at the informations by these border routers etcetera. And secondly, what we like to have
the others are like the protocols which are used to interconnect a set of autonomous
systems. So, I need a protocol which allows us to connect to the other autonomous
systems. So, interior gateway protocol IGPs, interior gateway protocols allows routers to
exchange information within the AS right.

So, examples are open shortest path first or OSPF and routing information protocol or
RIP. So, these are the popular protocols which we all already we have seen. So, these are
2 popular protocol; one is based on distance vector, another is based on a link state
protocol right. There is other set of protocols which are based on routing across the

817
autonomous system or what we say inter domain routing, and those are exterior gateway
protocol. So, allow exchange of a summary information between the autonomous
systems. The example one best example is the border gateway protocol or BGP.

So, that means, the border router of every autonomous system have a summarized
information of the whole autonomous systems. Now this summarized information are
being exchanged with the other border routers right. So, based on this, but this
information they exchanged they find out the path between the source which is generated
from one autonomous system and destination, which is at the other and some other
autonomous systems and how the things will follow.

(Refer Slide Time: 11:12)

So, there is a concept of area in autonomous system. So, in so, one what we have seen?
The inter networking is divided into several autonomous systems. Given a autonomous
systems, it is divided into different areas. So, area is a collection of routers network and
host within an autonomous system. Each area has a area identification number or area ID
right. So, an AS can be divided into different areas. All network inside the area must be
connected right. So, the all the network within the area should be connected; that means,
area is a connected network scenario; where there are routers networks host etcetera.

So, routers inside an area flood with the flood the area with routing information. So, so
what we see? That the whole internetwork autonomous, autonomous into different area
routers within the area basically share information or flood information inside that areas.

818
So all, so there is a special router called border area routers summarize the information
about the areas and send it to other areas, right. So, there are border area router. So, every
router every area often particular operator of autonomous systems as a border area
routers, we summarize the information about the about that particular area. One of the
area or sometimes referred to as area 0 is the backbone area. Special area inside
autonomous system, all areas in AS must be connected to this backbone area. The
backbone acts as a primary area other as secondary.

So, in a autonomous system what we see, that there is a area called backbone area or at
times the area with identity ID is 0, which basically takes care or summarizes the
information of the all the areas of the autonomous systems, and all areas must be
connected to the backbone area, and backbone area acts as a primary area and other areas
as secondary right. Routers within the backbone area are called backbone routers. A
backbone router can also be a area border router, right.

So, as backbone is also area. So, area border router can be a backbone router. So, this
backbone router acts as the information hub for the whole autonomous system. This
connecting to the backbone does not mean that the area the routers in the area cannot
connect to the routers in the other area. For that matter it also does not mean, that a
router in particular autonomous system cannot connect to a routers in the other
autonomous system. It is more of a information summarizations which comes into play
right.

If I want to get information and try to find a routing path across of the inter domain
routing. So, from to whom I should concentrate right. So, these are the constituents of
information things, but that does not restrict that a particular area router to connect to a
particular another area router of another area, or even the area a router in a autonomous
system in area router of the autonomous system connected to another router of another
autonomous systems and the type of things, right.

So, that is more of a network connectivity which we may not a which we cannot dictate
per say right. So, those connectivity’s are there, but the overall summarization or
custodian of a informations we require this type of backbone routers.

819
(Refer Slide Time: 15:13)

So, if we try to see say there are area 1, area 2 and a backbone of area 0 and there are
different different routers. So, area border routers, and there are backbone routers, one
router in this particular backbone is designated as AS boundary routers, right.

We shares or informations or based on the policy of the autonomous systems with the
other autonomous systems right. So, we have this sort of structure. So, there is so, I just
to repeat there is a area 0 or backbone router, we have area 1 area 2 dot dot dot area N.
And there are area border routers, which allows to connect to these backbone routers and
in the backbone area or area 0 there is a AS boundary router designated router which
summarize keeps the summarized information and share with the other autonomous
systems based on the standard and the policy of the autonomous system right.

So, this is the overall structure wise right.

820
(Refer Slide Time: 16:34)

Now, if we look at that path vector routing right. So, in path vector routing, routing table
contains destination address, next route and the path to reach the destination, right.
Unlike if you look at OSPF and RIP or distance vector and link state, in this case, we
have the destination address, next router to be hit and the path to reach the destination.

Now, this path is a ordered set or ordered list of autonomous systems that the packet need
to travel through, right. So, the path is defined as a ordered set of routers or autonomous
systems that the packet needs to travel through. The path vector messages so, there are
different what we say what need to say the different characteristics or different
components of the things, one is path vector messages. AS routers that participant in the
path vector advertise the reachability of the networks in their autonomous systems or
ASes to the neighbors autonomous auto neighbor autonomous boundary routers using
this messages right.

Two autonomous boundary routers connected to the same network are neighbors right.
So, if it is on the same network or it is connected by the networks, they are neighbor and
this path vector messages are the message which are exchanged between the things. So,
as we see that that has there should be some format, not only that this your autonomous
system this boundary routers and border routers, need to be updated by the OSPF or RIP,
that means, distance either this way or this your distance vector or link state protocol

821
again using some messaging right there should be a structure to do that by which it
updates right.

So, each router that receives a path vector verifies the advertised path is in the agreement
with defined policy or not. So, once a router receives a path vector, it checks that whether
it is a agreement with the with the defined policies right. So, it is policy based routing,
right also supports policy based routing. You know, that means, it says that whether in it
is policy it is allowed or not. Suppose it is say that you cannot cause AS 13 right. If the
path says that AS 13, that is not a feasible path for this or acceptable path based on the
policy for this particular router.

So, there is a problem because there is a issue of loop right. If there are different
autonomous systems, there are several autonomous systems, every autonomous system
such boundary routers or backbone router, boundary routers are updating the paths; that
means, a set of or a ordered set of AS numbers now in doing so, it may so happen that
there can generate a loop based on that the routing algorithms etcetera type of things are
following like in BGP and type of things, it may end up in a loop.

So, how to identify a loop? If there is a repetition of the AS like if I give AS 1, AS 2, AS


6, AS 9, AS 12, AS 13, again AS 6, AS 49 etcetera. So, there is a loop into the path. If
there is a loop it identifies and discard the thing. So, when a router receives a message, if
there is a loop or if you can identify the loop it ignored the thing. There is a there is a
way of policy based routing, or policy routing as we are discussing, policy routing can be
implemented a in path vector routing, that I can always say that with path if say a
particular AS need not to be crossed or need not to be in my path of forward in for
forwarding my particular packets of a AS of a AS then it can checks, and if it is there it
can discard that particular path.

Also when we talk about paths so, it comes with attributes right. How do you it is not
only the AS along with the attributes. So, there are 2 broad attributes, one is the well-
known attributes. So, there are a few attributes which are well known attributes, and
there are few attributes which are optional attribute; which can be followed or not, right.
Well known attributes like I can have a origin of the particular message and type of
things and be a well-known attribute.

822
So, well known attribute should be recognized by these routers; that is, inter domain
routers right, popularly that or in other sense that BGP routers. So, if we look at the well-
known attributes, some of the attributes are mandatory and some of the attribute are disc
discretionary. So, this is different set of attributes helps in defining that particular path
right. So, not only that it may so happen that some of the attributes need to be updated
when there is a update to the other routers right.

And so, those if some so; that means, there is a mandatory to update that particular
attributes to the next router. So, using this attribute, we can more finely defined the paths
along which the packet will move.

(Refer Slide Time: 22:24)

So, one of the popular protocol or the ‘the’ protocol you can say there is a BGP protocol,
or border gateway protocol based on the path vector routing distance vector protocol not
preferred as the inter AS routing, right.

So, it is exterior routing protocol so that we distance vector or even link state protocols
are not very popularized. So, it assumes all routers have a common distance metric to
that router routing preferences; that means, while we do a distance vector, I take care that
the whatever the cost or the distance metric we are using, this is agreed upon metric,
everybody is doing like that. So, if routers have different meaning of a metric, it may not
be possible to create a stable loop free things, right.

823
So, in distance vector the distances are caused what we think that all are same. So, a
given AS may have different priorities from another as or based on the matrix gives no
information about the as that will be visited, right. So, it is no information about the AS,
there is no summarized information about the AS. So, that is not preferred even in case
of a link state protocol that is different metric. Flooding is not realistic in such a large
inter networking scenario.

So, it will it have a lot of bandwidth and finally, the convergence will be a major
problem. Every router if it wants to keep a keep a track of the whole network topology
on it is things ideally fine, but it is not physically or even theoretically it means
practically feasible right.

Because it is not possible to converge on the whole network and take a call based on the
things. So, there will be a huge traffic problem, even the router may not be able to handle
such a network and do run a algorithms or with his own resources to do that. So, this is
also not realistic for practical implementation of a in case of a inter domain routing,
right.

In path vector there is no such ideally matrix. So, you have a sequence of sequence of
paths which is looked into. So, information about which network can be reached by a
given router or AS can to be crossed is the only thing right. And it is somewhat differ
from this distant vector algo by in the sense the path vector approach does not include
distance or cost estimation right. It is more of the path which sequentially is given and
based on the attributes and other.

List all the AS visited to reach to be visited to reach the destination network. So, it
basically gives a ordered set of list. So, it is not ideally it goes on calculating the distance
etcetera right. So, this makes more sense in a large inter networking scenario.

824
(Refer Slide Time: 25:36)

And if we look at the BGP or this which is based on path vector, there are several
messaging. One is open; one is update, keep alive notification. So, open message is sends
to whenever we want to send a message or send a communication with the other BGP
protocol.

There is a important for update like means that BGP also can basically update; in a sense,
remove create a already advertised some path a particular router or border router can
update the things, right. And in case of a keep alive is basically saying that the router is
ready for receiving messages. So, it is sort of a beckoning a keep alive type of messages,
and there are if there are some erroneous or certain conditions which need to be alerted is
using the notification.

So, messages are typically send over TCP connection on port 179, function procedure
neighbor acquisition. So, when we do is a open message, acceptance through keep alive
messages. Neighbor reachability, periodic keep alive messages. Network reachability
using broadcast and update message right. So, each router maintains a database network
that can be reached right, plus the preferred route to this particular network right.

So, it can have a policy of the things. So, that means, using this 4 category of messages
BGP protocol tries or basically finds that the or in other sense update that routing table to
find out the paths right. So, that that particular RFC does not include or address that how
a router knows the address of another router and so and so forth. It is up to the network

825
administrator to have that type of things that how the router informations can be
collected that which are the how to get the router address and type of things.

(Refer Slide Time: 28:09)

Now, if we look at that what we are discussing; so, if it is that router N 1 for net network
N 1, a next router is R 1 for this AS. And the path is as to reach there is AS 14 AS 23, AS
67 right. So, this way it is defined. So, in order to reach N 2, the next order is now try to
try to directly a match with this figure. So, the table is example of network reachability
of the things right.

So, in order to reach N 1, this next router is R 1 and the path to be follows is 14 23 to 67,
in order to reach N 2 next router is R 5 when the path is followed to be so and so forth
and like this. So, what we see that by unlike other our link state or your distance vector,
here the ordered set of AS or AS IDs are given.

So, loop prevention in BGP checks the path before updating the database. If it is AS in
the path ignored the message right. So, there will be loop if it is the same AS is there in
the path. Policy routing if the path consists of AS against the policy of the current AS
message is discarded right. So, these are the messaging format where while updating
right. It is saying that in order to N 1 within the as R 1 and AS 1 is there; so, router 2 gets
the things right. And router 2 when it is advertising that in order to reach N 1, you next
router will be R 2 AS is AS 2 next AS is AS 1.

826
So, that means, from here anything goes 2 looking for N 1, it knows that the next router
will be R 2 right. And it has to travel by AS 2 and AS 3. Similarly, here if you see
anything goes to N 1, it next router is R 3 and it goes to a AS 3, AS 2 and AS 1 right. So,
the path is defined in this way.

(Refer Slide Time: 30:38)

And these are different formats of the BGP messages open, keep alive, update and
notification so that it can exchange information across different AS.

(Refer Slide Time: 30:53)

827
Similarly, for OSPF which is within the border area network; which we have already
discussed. So, that is within that particular particular within the AS. So, it uses the IP and
a has a value of the IP header, if you remember there is a 8-bit protocol field. Interior
routing protocols, its domain is also an autonomous system. Special router autonomous
system boundary routers, as we have discussed backbone routers responsible for
dissipate information across AS in the current system, divides the AS into areas, and
metric to be used minimum delay or RTT, maximum throughput and so and so forth.

(Refer Slide Time: 31:41)

And for OSPF which is based on link state advertisement is there.

828
(Refer Slide Time: 31:42)

And there are several messages. So, link state advertisement like, router link, network
link, summary link to the network, summary link to AS boundary router and external
link. So, these are the different category of link in the LSS and similarly LSA or OSPF
when it is within the router.

(Refer Slide Time: 32:07)

So, summary link it is summary link to the network.

829
Similarly, for external link it is a for the external network. And this is a summary link to
the AS boundary routers right. So, there are different summarization or information about
the about the autonomous systems are being pumped into the things.

(Refer Slide Time: 32:39)

And this is also that what are the different type of OSPF packets. And specially the link
state update we require that router link network links summary link to the network
summary link to AS, boundary routers which takes care of that summarization of the
whole autonomous systems and share with the things, and external links.

And this is the typical format of the OSPF packet.

830
(Refer Slide Time: 33:05)

Similarly, we have a link state advertisement or LSA summary, not that that formats or
the packet formats; that how it is how the different things the summary linked to network
format summary link to AS boundary external link format. So, these are defined formats.
What it tries to emphasize, so there is a standardized way of communication between the
with the messages, and it also helps in talking with several autonomous systems without
any - with standard messages without any hindrance.

So, with this we let us end our discussion today. In the next talk, we will discuss little
more into this BGP protocol to see that how this BGP protocol works and how this
overall routing is feasible.

Thank you.

831
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 40
IP Routing - IV (Border Gateway Protocol - BGP)

Hello, so we will continue our discussion on the course on Computer Networks and
Internet. As we are last few lectures we are discussing on IP Routing, so, today we will
continue that discussion. Today we will discuss on on BGP protocol border gateway
protocol. If you recollect that in the previous lectures or previous talks, we discussed on
two category of things right: one is interior routing protocols and another is exterior
routing protocols. So, the routing protocols, which are within the autonomous systems,
and the routing protocols, that is across autonomous systems right. So, BGP or the border
gateway protocol is this exterior this routing protocol, which helps in routing packets
across autonomous systems right.

So, just a quick slide that is a autonomous system. So, how we define? It is a logical
portion of a large IP network or the whole internet. And autonomous system normally
consist of an internetwork within an organization control. That means, it is under one
administrative control and it is administered by a single management authority like IIT
Kharagpur, can be a autonomous systems which is managed by the IIT Kharagpur
authority or the cell which is handling those thing.

832
(Refer Slide Time: 01:55)

And an autonomous system can collect connect to other autonomous systems managed
by the same organization or other organization public or private. In other sense our
whole network is divided into several autonomous systems, which consist of several
networks and there are routers or which takes care of the whole information of the
autonomous system that, we have seen that there are there is a backbone area router or
this backbone router which takes care of those type of things.

So, our basic objective is to how if a packet from a autonomous system here wants to
communicate to a autonomous system in some other place, so how it will be routed. So,
one is that there should be some internal routing protocol, which will take care of this
within the autonomous system and there are some, there are, there should be a protocol
which goes across these things. If you recollect, so we talked about a path vector
protocol which established a path between these different autonomous systems right. So,
it is a sequential set of autonomous systems like I say that the packet 1 should travel by
autonomous system 6, 8, 9, 10 or 6, 8, 9, 12 and so and so forth to reach the destination
autonomous system.

833
(Refer Slide Time: 03:24)

So, what we try to, what we are talking about is, routing protocol is one category is
interior gateway protocols IGPs, that is interior gateway protocol allows router to
exchange information within a autonomous system. Examples of these protocols are
OSPF and RIP predominantly used protocol is OSPF. Exterior gateway protocol EGPs
that is which are which follow a path vector protocol and it allows exchange of
information across autonomous system.

So, one of the popular or the protocol for this EGP or exterior gateway protocols is
border gateway protocol or BGP. So, today we will be as we are discussing is the basic
feature of BGP protocol.

834
(Refer Slide Time: 04:26)

So, BGP as we are discussing is a exterior gateway protocol right. It was originally
developed to provide loop-free method of exchanging information between autonomous
systems, so there should not be any loop right. BGP has since evolved to support
aggregation and summarization of the routing informations right. So, if you see that if we
look at the whole internet or network of networks, so there are in order to push this or
any forwarding any information from one system or one network to another, it has to hop
through several networks and autonomous systems right.

So, there should be some way of forwarding across autonomous systems where we try to
look at this BGP. So, BGP presently the popular version is BGP 4 is an IETF standard
protocol; that means, all BGP enabled devices also called BGP routers or BGP devices
follow a standard which allows it to route packets right.

835
(Refer Slide Time: 05:35)

So, if we look at the BGP components, so we see if this is the autonomous system AS1,
AS2, so, there are several thing one special device or things or router is called BGP
speaker we will come to that. There can be several networks inside the things. Inside the
autonomous system there are protocols called OSPF and RIP which can be within the
autonomous system, as each autonomous system under single administrative control so,
the administrator is free to choose which protocol to use right. And if you again recollect
what we talked about the autonomous system is again divided into different area, out of
that one area is or area 0 is the or the backbone area right. And there are other areas, so
that this backbone area or this backbone area router collects this information about these
whole autonomous systems.

So, it is those designated routers, which takes care of the whole information base of the
autonomous systems and it does not mean that that all this all traffic of the area should
go through the area border router or all traffic should go through that router, but, but it
what it means that it collects or it has the information about the whole autonomous
systems.

Now, the within across the autonomous system we have the protocol called EBGP or
between the within the autonomous systems we have this protocol called IBGP. We will
come to those things right.

836
(Refer Slide Time: 07:32)

So, let us look at some of the components. So, one thing what we have seen is the BGP
speaker. So, it is a router configured to support BGP. So, a device or a router which is
configured to support BGP is a what we say BGP speaker. There are BGP neighbors or
pairs, that a pair a pair of BGP speakers that exchange routing informations are called
pairs right.

So, there are there can be two type of neighbors, the neighbors within the autonomous
system and neighbor across the autonomous systems. There accordingly we have internal
neighbor or IBGP a pair of BGP speakers within the autonomous systems and we have
external neighbor or EBGP or a pair of BGP neighbors each in a different autonomous
systems right. So, if we again come back to this figure, so there is IBGP, this is the
internal and these are the two BGP speaker or two routers which there can be n number
of routers within this particular autonomous systems. So, these are IBGP and there these
are EBGP right.

So, a pair of neighbors each in a different days these neighbors typically share directly
typically share a directly connected network right. So, that is they are directly connected
network scenario. There is a concept of BGP session, a TCP session connecting 2 BGP
neighbors right. The season is used to exchange routing information and neighbors
monitor the state of session by sending keep alive messages. So, periodically send that

837
keep alive messages, so that monitor the state of the other sessions like. So, it is some
sort of a pinging and after every or beaconing at every at a regular interval.

There is a AS number for any autonomous systems, which is a 16 bit number uniquely
defined a particular autonomous system. So, it is a so you can see that with the 16 we can
have so, many number of AS, right. So, it is say two to the power 16 number of AS are
possible that is a quite a large number considering that the AS are having several router,
several network source inside the things. This is a terminology or there is a concept of
AS path list of number or numbers, AS number describing the route through the network
a BGP neighbor communicates the path to its peers right.

So that means, if I want to go from network say n 1 1 of AS 1 to network 6 2 of a n 6 2 of


say a 6 then, what are the path I need to follow right. So, I start with AS 1 to AS 3 to AS
4 to AS 6 or some other paths type of things. So, it is a set of or sequential set of AS
numbers, which allow this routing within the network.

(Refer Slide Time: 10:50)

Now, if we look at it, there are if we look at the BGP traffic there are typically two type
of traffic, one is local traffic, the traffic local to AS, either originates or terminates within
the AS right. So, it originates or terminates within the AS right, so it originates or
terminates within. Either the source or the destination resides in the AS. So, if the source
or destination is residing in the AS, then the traffic for that particular BGP session we say
that is a local traffic. Whereas, in a transit any transit that is not local traffic is transit

838
traffic. That means one goal of the BGP is to minimize the amount of transit traffic that
means it is neither originating nor terminating the AS, but it is passing through this AS
right.

So, in other sense, it is a traffic which is a load on that AS, so to say right. So, it is one of
the objective may minimize this type of transit traffic. So, there are a lot of transit traffic
means you overload the things right.

And if we look at the AS types, so BGP defines primarily 3 type of autonomous systems
right. One is stub. A stub AS is a single connection to another AS right. A stub AS can
carrying only local traffic because, it is a one connection to the AS, but there is no other
AS across that. That means, it is a stub connection so, that is only have local traffic there
is no transit traffic per say. There is a multi homed AS. There is a multi homed AS has
connections to 2 or more AS, ASes rather autonomous systems. However, a multi home
AS has been configured. So, that it does not forward traffic. So, a multi home AS can be
configured that, it does not transmit say what we say transit traffic, it may drop or block
and type of things.

There is a transit AS. A transit AS has connection of 2 or more autonomous systems like
multi homed AS but carries both local and transit traffic. The AS that impose policy
restriction on the types of transit traffic that will be forwarded right. So, autonomous
systems can be either multi homed AS or transit AS. So, primarily the autonomous
systems are multi homed or transit stub is a special case of those scenarios.

So, what we see that primarily two types of things are there, there is one is multi homed
and transit though there are more than one connection but in case of a multi homed you
may not allow transit traffic. And there is a stub type of things, where the where there is
no there is only local traffic either it originates or terminates.

And as we understand there can be policy as these are all path vector, so I can have
policy defined that which can be transit to the things and like that right. So, there can be
restriction on which sort of AS it should first type of thing that you allow it to transit the
traffic.

839
(Refer Slide Time: 14:20)

There are few more concepts one is that routing policy that is important the set of rules
constraining the flow of data packets through the network right. That is what we look at
the routing policy. So, lighting policy are not defined per say in BGP protocol rather,
they are used to configure a BGP device right.

In other sense the while I am configuring the BGP device, I embed that policy into that
the thing. For example, a BGP device can be configured, so that a multi home AS can
refuse to act as a transit right. So, that is a policy, that I will not allow. This is
accomplished by advertising only those networks, which are either trans terminating or
originating that AS right So, it is confined within that particular AS.

So, a multihome AS can perform transit AS routing for restricted set of agent
autonomous systems. It does this by advertising or by tailoring the routing advertisement
to send to the EBGP vapors. In other sense what it tries to say that, while advertising that
routing information to the other EBGP routers, so what it does? It does a tailoring of the
things. That means, it modifies the things in a such a way that, which is within its policy
paradigm.

Or an AS can optimize traffic to use specific AS path for certain category of traffic. Like
I say I get a traffic of streaming video or a particular type of traffic then, it says that it
should be channelized to a through a particular path. So, it can be configured or

840
channelized through a particular path. So, that that can be one such on such policy type
of things.

There is a concept of network layer reachability information. Network layer reachability


information also known as NLRI, so NLRI is used by BGP to advertise routes right. So,
it says that what is the network layer information; so it is consist of a set of network
represented by a tuple that is length and prefix like it says that tuple 14 202 like one
example represent that the CIDR route as this so and so forth right. So, it is network
layer reachability information; that means that which ports and or which domain of the
network you can access right. So, in this case that slash 14 is the thing.

Routes and paths with respect to BGP: a route associates a destination with a collection
of attributes describing the path to the destination. A destination specified by NLRI
format. The path is reported as a collection of path attributes this information advertised
by the update things. So, now how a route do I define, it is a defined by a set of AS. How
this AS is defined is by a set of path parameters right, and the destination of the things
where it will go because, when it when it goes through this BGP router it need to know
that where the destination is that is in that NLRI format. And it goes on these this it
basically takes this path attributes along with the things right. So, through which the a for
through which the which AS it will hops. And when that this advertisement is for this
advertisement, this update message format or the updates message protocol is used in the
BGP; we will come to that that what is update. Actually we discussed little bit of what
are the different type of BGP formats and that update is there any way we will discuss
again.

Now, so we have EBGP external BGP to communicate with the acrosses IBGP to
communicate within the AS. So, we have BGP, EBGP, IBGP communication. Finally, to
make this happen, so if you see it is not only external right, it once it enters it go on
hopping with the networks and go through some other router to the type of things right.
And this paths is also there are BGP with the for the external and there are OSPF or what
do I say that, internal protocols are IGP protocols are running that OSPF, RIP protocols
are running. So, there should be a proper coordination between them right. Otherwise,
the packet forwarding will be not will not be possible right.

841
(Refer Slide Time: 19:19)

So, BGP does not replace IGP operating within AS. So, it is not like that it replace OSPF
or RIP type of protocol right. Instead what we are saying coordinates or cooperates with
the IGP to establish communication between autonomous systems right. So, BGP within
AS is used to advertise the local IGP routes right. Within the AS it has to advertise the
local IGP routes because, within the AS that is the predominant right. These routes are
advertised to BGP peers in other AS right. So, this has to be known to the BGP peers in
the other AS.

(Refer Slide Time: 20:04)

842
So, what we look at the communication. So, roll of BGP and IGP: so, both BGP and IGP
that is border gateway protocol in that the internet gateway protocol. That is, OSPF and
RIP are used to carry out information carry information through an AS right, so
otherwise how the packet will be forwarded. Establishing TCP sessions between the two
pairs, before establishing BGP session the device verifies that BGP devices, the routing
information is available in each peer. So, it should be available in each peer BGP, EBGP
peers that these EBGP peers statically a typically share a directly connected network.

So, these in case of a EBGP peers as we discussed couple of slides back it typically share
a directly connected network. The routing information need to be exchanged by the BGP
packets between these peers is trivial right, it is directly connected thing. If for IGP IBGP
peers can be located anywhere within the AS. So, they do not need to be directly
connected. BGP relies on the IG IGP that is, the internal gateway protocols to locate a
peer. Packet forwarded between the IBGP peers uses a IBGP learned routes. So that
means, the what I what we mean to say that, OSPF or RIP protocols whatever, it is
learned that those are with those information are being used by this BGP.

So, full mesh BGP sessions within the AS like IBGP speakers assume that, a full mesh
BGP session has been established between the peers in the same AS right. So, it is a full
meshed BGP sessions. So, everybody knows or everybody connected to others. So, it is a
fully mesh connection. When a BGP speakers receives a router update, from a IBGP
peer, the receiving speaker uses the EBGP to propagate to update the external peers right.
Because, the receiving speaker assume full mesh IBGP sessions have been established, it
does not propagate the update to the other BGP peers.

So, as this is a full mesh, so the full mesh IBGP sessions have been establish it does not
propagate to the update to the other because, it knows that it the update has been taken
care by this full this particular way of connectivity.

843
(Refer Slide Time: 22:37)

So, the same thing what we were discussing; so if we have so there are there are several
BGP routers. So, there is a IBGP protocols which are connected across the thing. And
this when this protocol BGP this BGP device R6 connected to the a BGP R1 through
these IBGP updated to BGP R3 and goes like that and so and so forth right. So, that is the
way of connectivity.

(Refer Slide Time: 23:10)

Now, as we mentioned earlier, so what are the different BGP packet types right. So, one
is open, other is update, notification, keep alive. So, these are the typical four types of

844
packets with the BGPs. The open is that this message type establish a BGP session
between two peer nodes right. So, this is this is so establishing a BGP session between
two peer nodes that is the open. Update this message type transfer, routing information
between the BGP peers, so, there is a typo it should be BGP peers. So, this is this
message information that is update is basically, routing information from between the
BGP peers.

Notification this is when a error occurs in is detected. So, if there is any abnormal
situation, so it requires a notification of the thing. Keep alive, this determines if the peers
are reachable or not. So, it is some sort of a beckoning type of things which goes on
things. So, one is the open opening the season between the two BGP peers another is the
update, updating routing information across the BGP peers right. Another is what we so
there is again a typo it should be notification in this here it should be notification. So,
then another message is notification, this message is sent when a error occurs, your error
is detected. And then, other is a keep alive that is the beckoning say that the peers are
reachable or not to determine whether the peers are reachable or not, we have those
things.

(Refer Slide Time: 24:54)

Now, if we look at the different functionalities, one is opening and confirming BGP
connection is the functionality. Primarily after a TCP session has been established
between the two BGP peers, each router sends a open message to the neighbor to its

845
neighbor. That is the opening and confirming BGP connection as we mentioned earlier
that is establishing the connection. Another is maintaining BGP connection so on it is
open and thing is then next is maintaining the BGP connection. That BGP does not use
any transport layer keep alive to determine if the peers are reachable or not. Instead BGP
message are periodically exchanged between the peers right.

If no messages are received from the peer for duration specified by the whole time, the
whole time, the originating router assumed that an error has occurred right. When this
happens the error notification is sends to the things. So, it is go on beaconing between
the peers whenever, whenever it is not receiving within a particular time period, so it
goes on a it thinks that there is the BGP that the peer BGP device is not responding and
accordingly a error notification or error or a condition is generated and the information is
sent to the things.

Sending reachability information, reachability information is exchanged by the update


message right. As we seen that reachability informations is primarily finding that more
that is the routing information. If there is a information change in the information or
updating the reachability information it is exchanged between the peers in the update
message.

So, update message is used to advertise feasible routers to or withdraw infeasible routers.
So, both advertising the possible feasible routers, and withdrawing infeasible routers. So,
notification of error conditions, a BGP device can observe error can observe error
condition impacting the connection to a peer. So that means it is it may not be responding
or some other error situation arises. So, notification message has sent to the neighbor or
sent to the neighbor, when the conditions are detected. After the message is sent, the BGP
transport connection is closed. This means, all the resources for the BGP connection are
deallocated right. So that means, once the notification sends, the particular connection to
that particular BGP peer of the device is closed and the resource says, provisioned or
allocated for that things are released right.

So, the routing table entries associated with the remote peer are mark invalid finally,
other peers are notified. So, you see so once we see that the connection with one BGP
router or the peer device is there, this is notified and the connection is closed, all
resources are released. And now it has a new update right. So, it has to find a new path

846
and it is being advertised to the other or marked as invalid that particular path and it is
advertised to the other peers right. So, that is important.

(Refer Slide Time: 28:22)

So, there are other things like BGP selection, BGP is a path vector protocol as we
discussed. So, in a path vector, the path is expressed in terms of domains or
configurations transferred. So, path has to be defined how. So, path is defined a series of
ways within the properties and type of things or which domain it is hopping through. The
best path is obtained by comparing the number of domains of each feasible routes right.
So, one is that how many domains need to be hopped. There is no universal agreed upon
metric that can be used to evaluate the external path. So, that is important that is difficult
because, each AS has his own criteria of path evaluation right. So, there is no universal
metric because it is a large network right it say large networks of networks and these
there are several AS, so each AS has the own way of finding the optimal path. So, which
is based on the path attributes. So, there are several path attributes are used to describe
and evaluate a path, peers exchange path attributes along with other routing informations
So, when a BGP router advise a route, it can add or modify the path attributes before
advertising the route to a peer. So, once a BGP router receives a this update then, while
updating the things it can basically update the path attributes before transmitting it to the
peer.

847
The combination of attribute, are used to select the best path right. The combination of
attributes are used to select the best path of the things. That means, what we want to say
this your path is defined by these several AS which are in turn defined by the attribute set
of this AS right, or that particular path and which can be used this attributes values are
used to find the optimal path based on the particular by based on the policy of the that
given AS.

(Refer Slide Time: 30:39)

So, there are we also discussed in earlier thing, we will go quickly that is there are four
path attribute categories, as we have discussed in the path vector protocol. One is well
known mandatory the attribute must be recognized by all BGP implementation, is must
be same for every update message. This is a well known and mandatory well known
discretionary, that is the attribute must be recognized by all BGP implementation.
However, it is not required to send for every message. So, it is a discretion or
discretionary optional transitive that is, it is not required for every BGP implementation
to recognize this type of attribute right it is of optional. By a path with a unrecognized
optional transitive attribute is accepted and simply forwarded to the BGP peers. So, if it
is unrecognized optional attribute transitive attribute; that means, it is being transmitted
to the peer without doing any analysis or without taking any call on it right.

Optional non transitive if it is not required for every BGP implementation recognize this
type of attribute. These attributes can be ignored and not passed along with the things.

848
So, it is one is optional transitive, that means, it is optional, but it may not recognize, but
it can transmit. Another is optional in non transitive, if it is if it is not recognized or it can
be ignored and may not be transmitted to the other side.

(Refer Slide Time: 32:13)

And if we look at that a previous lecture or previous to previous lecture we discussed. So


what we see that this is the N1, R1, AS1 this is the particular reachability of the things.
So, in order from here if I want to see N1, R2, N1, R2, AS2, AS1 is the path and so and
so forth.

So, where from these R4 we see this is the AS3 AS2 and AS1 and then a next router is
router 3 and the destination network is N1. So, next router 3 then AS3 AS2 AS1 and then
you have the router. So, these are way the paths can be defined and for different network
what is the next router and paths can be defined.

849
(Refer Slide Time: 33:06)

So, 2 quick concept, one is the BGP aggregation, so a major improvement in BGP
version four for CIDR and route aggregation. So that means, the feature allows BGP
peers to consolidate multiple contiguous routing entries into a single advertisement and it
significantly enhances the scalability of the BGP to the large network. So, I can
contiguous routing advertisement in a single entry and in doing so, it basically helps in
scaling the things.

(Refer Slide Time: 33:43)

850
There is another concept called BGP configuration. So, BGP requires all speakers within
a single AS have fully meshed set of IBGP connections right.

So, if it is basically, this creates a problem in scalability. If there are a large number of
speakers within the AS making this connection and if it is dynamic then making and
breaking these connections become a major challenge. So, I can have different sub a sort
of things within the AS right or what we say that is a configurations of AS is there right.
So, a BGP configuration creates a set of autonomous systems that represent a single AS
right. So, AS1 can have different AS 1 1 2 type of things and two peers external to the
configuration. This removes the full mesh requirement and reduces the manageability.
Because, the full mesh requirement is now confined within that particular AS where, or
sub AS type of things or configuration is maintained.

So, in way in this way the manageability may be made much or scalability is facilitated.
So, what we see in try to what we discussed today is that, different feature of BGP
routing protocols, how it can be defined how path is defined and so and so forth. How, it
helps in sending a packet from a particular network, in a particular AS autonomous
system to a other AS in the autonomous systems right.

So, we will continue our discussion on this computer network and internet protocols in
the subsequent lecture. Slowly we will look at other layers other as we are following a,
top down approach now we will look at the other layers on the TCP/IP model.

With this let us conclude our discussion today.

Thank you.

851
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 41
IP Routers

Welcome back to the course on Computer Networks and Internet Protocols. So, till now
we have looked into the IP routing mechanism in details and we have looked into the IP
addressing format, how routing works and different type of routing protocols which are
implemented over the internet. So, today we will look into the device in details that
support routing.

(Refer Slide Time: 00:47)

So, we will basically look into the design of an IP Router that how an IP router looks
like, what are the different components inside an IP router and how you can design an
optimized IP router with the help of different hardware platform. And in the next couple
of classes, we will also go for a demonstration about IP router to show you a practical
router and its different components which are there inside it and how can you configure
it and how can you process different components which are there inside the router. So, let
us look into the design of a router in details.

852
(Refer Slide Time: 01:23)

So, if you look into the lifecycle of a router apparently it is very simple. So, the lifecycle
of a router is that you can represent it in the form of do repeat loop. So, you find a path to
a particular destination, then you forward, forward, forward, forward, forward multiple
packets to that destination again whenever a new destination comes you find out the path
and then forward, forward, forward, forward the packets to that destination until the
router gets powered off.

So, from this simple loop functionalities you can see that there are two basic
functionalities of an IP router. So, the functionalities are first finding a path and then
doing forwarding. Finding a path means you need to execute a routing protocol. As we
have looked into earlier there are multiple type of routing protocols the inter domain and
intra domain routing. In case of intra domain routing we have looked into there are
distance vector routing protocols, the link state routing protocols and in protocol format
the routing information protocol or OSPF protocol and for inter domain routing we have
the border gateway protocol or the BGP. Now, this routing protocols will help you to
execute this task to find out the path and then the actual forwarding comes and the actual
forwarding means, you have the routing table where you have this entire information.

So, once you have constructed the routing table and you have a packet incoming packet,
you look into the header part of the packet, find out the destination IP address, from the

853
destination IP address, you make a match with the routing table, find out the next top and
forward the packet to that next top.

So, that is the part of the forwarding engine. So, accordingly we actually have this 2
basic operations: construction of the routing table to finding out a path. This part of the
router we call it as a control plane of the router which actually controls the entire
forwarding mechanism and then do a routing match and forward the packet to a
dedicated interface that part we call as the data plane part of the router.

So, the control plane of the router it takes care of finding a path and the data plane of the
router it takes care of making a match with the routing table and then a forward the
packet to a interface which will transfer the packet to the next hop.

Now, in this entire architecture there is an interesting observation. The observation is


that, the functionality of the control plane it is kind of periodic; periodic in the sense like,
you will find out a path to a destination only when you will get a new packet where the
information is not available in the routing table. During that time you will execute a
routing protocol or in case of link state routing or OSPF type of routing protocol distance
vector routing protocol, you will periodically exchange the routing control messages and
from this periodic exchange of the routing control messages you will find out the path.

So this, the frequency of operations in the control plane, it is comparatively higher


compared to the frequency of operations which is there in the data plane or the
forwarding plane. Sometime in some book of reference the data plane is also termed as
the forwarding plane.

In case of data plane if you just think about a typical router which support say 100 Gbps
of data and the single packet is of size or if your say that the average packet size is 1 MB
and you have say the link speed of 100 Gbps, you can think of the number of packets the
data plane need to process per second. So, that is why the frequency of operations which
is there in the data plane, it is significantly higher compared to the frequency of
operations which is there in the control plane. And that is, that gives the interesting
design choice of developing our router hardware. So, let us go to the details of that.

854
(Refer Slide Time: 05:52)

Well. So, this entire evolution of the router architecture, it came from 5 different
generation starting from 1980s to today. So, the 5 generation of the router, so are just like
a standard computer which we have a computer with multiple interfaces. The 2nd
generation of the routers which came in early 1990s, they are delegate to interfaces. So
that means, you have a router architecture where you will have multiple such interfaces,
a dedicated device.

The 3rd generation of the routers which came in late 1990s, we have a distributed router
architecture. Then we have the 4th generation of router which came in early 2000; it is
distributed over multiple racks. So, the concept of rack stack is that this entire router. So,
you have say multiple interfaces say you have 32 interfaces, now say you require 120
different interfaces. So, you take 4 different such routers and put it into different racks
and have an interconnected router. And then in the 5th generation router which we are
using or which will say that the next generation router or many of the large scale data
centers have started using this type of routers, which are called software defined
networking routers.

855
(Refer Slide Time: 17:20)

Well, so, this is the basic architectural components of a router. You have a processor, a
general purpose processor which has a memory component and a CPU component. The
processor is connected to multiple interface card. So, this network interface cards are the
network interface card which are connected through a interconnection network inside
your router hardware.

So, this every individual interface card we are kind of IO interface, the network IO
interface. So, you have this RJ45 cable. So, you put this RJ45 cable in this interface card.
In case of wireless, they are transmitted wirelessly. So, you have a transmitter and a
receiver. So, that is the entire broad architectural component of a router.

856
(Refer Slide Time: 08:10)

So, the router hardware the processor is responsible for the control function, we call it as
a route processor. The control function means to run the routing program and then send
the data packets over the network and construct the routing table.

So, the processor is basically responsible for running those programs for constructing the
routing table based on the routing algorithm and the forwarding it is done at the interface
curve. Because here the interesting design choice is that as I mentioned earlier that your
control functionalities not so frequent whereas, your data functionalities are very
frequent and that is why the control functionalities we generally implement as a part of a
software whereas, the data functionalities they are implemented as a part of the
hardware.

So, in the network interface card this data plane functionalities that means, making a
match with the routing table find out the next hop and sending it to the next hop, this
entire path it is done with the help of a specialized hardware which is called Ternary
Content Addressable Memory or TCAM. So, with the help of this TCAM memory, we
apply, we make a hardware match with the routing table for a fast look up.

So, the route match need to be verified. The example that I have given that if you have a
100 Gbps line and if you have 1 Mbps packet size, so, that is why on average you have to
process a significant number of packets per second at every network interfaces.

857
(Refer Slide Time: 09:50)

So, that way we are dividing this entire routing functionalities in the data plane and the
control plane. The control plane is implemented as a part of the software which is
responsible for the routing table construction and the data plane is implemented in the
hardware which is responsible for implementing the forwarding engine.

(Refer Slide Time: 10:09)

So, this is a kind of structure structural component between the mapping of the original
hardware and your control plane. So, you have this interface processes which are

858
connected to a packet processor. This packet processor contains the forwarding engine to
make a match with the routing table and then find out the next stop.

So, this part is implemented in TCAM in the hardware and then you will have the route
processor which is a general purpose processor which implement routing engine; that
means, to finding out the path and then to finding out routing path based on the routing
specific routing algorithm that you have configured in the router and in constructing the
routing table. And this part constitutes your control plane and this part constitutes your
data plane in the router hardware.

(Refer Slide Time: 11:11)

Now, if you look into the physical infrastructure of a router, we normally use something
called a slotted chassis. So, this is a structure of a slotted chassis which are used to build
up large routers. So, here is a structure of a chassis. So, you have this multiple chassis.
So, individual interface card they are inserted inside these slots and then the route
processor it is also inserted in a slot.

And then we have this entire route architecture route which looks like something like
this. So, we will show a demo of this in the subsequent classes. So, this kind of a chassis
slotted chassis based architecture, it simplifies the repairs and updates of components
inside a router.

859
(Refer Slide Time: 12:05)

Now, let us look into the functional components of a router from the perspective of the
control and the data path. You have the routing function and in the data path you have the
IP forwarding as we have mentioned.

And in between you have the routing table. So, this routing functionalities they apply the
routing protocol, different kind of routing protocol based on your configuration, it may
be OSPF or RIP kind of routing protocol, routing information protocol or open slotted
passed first, which are kind of distance vector and a link state routing protocol. So, with
the along with this distance vector or link state routing protocol you can also have border
gateway protocol.

So, these routing protocols they execute periodically and construct the routing table.
Now this forwarding engine it makes our route lookup on this routing table and make up
our packet processing of the routing informations. So, the idea is something like this
whenever you are receiving a packet you look into the IP header, from the IP header you
extract the destination IP field, after extracting the destination IP field, then you make a
match with the routing table, find out the next hop interface and forward the packet to
that next hop interface. So, that is the entire process which is being executed in the data
path.

860
(Refer Slide Time: 13:33)

Now, the control plane in a router it is a special purpose computer which has the routing
functionalities. As I have mentioned it is implemented as a software that software we call
as a router operating system, router OS that supports the basic computing functionalities
to run a router along with the routing functionalities. Now, this routing protocols, they
are implemented inside a router OS. An example of a router OS is the Cisco IOS, Cisco
internet operating system which implements different kind of routing protocol as a part
of its operating system.

(Refer Slide Time: 14:08)

861
Now, the routing functions are basically there are 3 functionalities that you need to
execute inside the control plane of a router, the route calculation based on a routing
protocol, the maintenance of the routing table and the execution of the routing protocol.
Now, in commercial routers, these routing functions are handled by a single general
purpose processor which we call as the route processor that I have mentioned earlier.

(Refer Slide Time: 14:36)

Now, the data plane of a router that is the interesting part, it implement the forwarding
functionalities. So, it make a route lookup and forward the packet to the destination
interface. So, this functionality is similar to a layer 2 switch. So, you can use the switch
fabric. So, a switch fabric means it is a mapping from input ports to output ports; that
means, if a packet is a make input to a particular port in which output port it needs to be
forwarded to, so a switch fabric looks something like this.

862
(Refer Slide Time: 15:15)

So, a switch fabric means you have a set of input ports and from this input ports you
have you have a set of output ports. So, these are input ports and these are your output
ports. So, interestingly in router this input ports and output ports are same. So, the input
ports and output ports are basically the interfaces. So, this is I am naming the interfaces
accordingly this; I1, I2, I3, I4, I5, any of the interface can work as an input port as well
as an output port. Similarly, I1, I2, I3, I4, I5. So, a switch fabric it is a hardware
connection that make a connection from one port to all other output ports.

So, that way inside this fabric logic, so, this is this contains the fabric logic. So, this
fabric logic, a set of logic gates which actually forward the information which is fed to a
one input port to another output port. So, that is the functionality of the logic gates which
are there inside the switch fabrics. So, that way in a router, whenever a packet comes in
an input port from the destination address field, you make a route look up inside the
routing table and then decide which is your output port. Say for example, for a packet at
input port I1, if decide based on the routing table that the output port should be I4 then
this fabric logic will copy the data from this input port to the output port at I4.

OK. So it maintains also maintains the interface buffer to implement the store and
forward functionality. So, whenever you are getting the packets you are getting the
packets one after another. So at every interface you should have a buffer packet should

863
be temporarily inserted inside the buffer then one of the another they will be transmitted
over the link by the layer 2 at the data link layer.

(Refer Slide Time: 17:28)

Now, in IP forwarding we need to do a power packet processing of IP packets. Now, IP


forwarding is distributed. Distributed in the sense like, it is handled by individual
interface controller. So, this network interface they are kind of microcontroller. So, you
have a interface controller there. The interface controller handles the packet forwarding
which are coming to a single interface. So, for this packet forwarding we use the special
hardware devices which are the TCAM ternary content addressable memory which
makes a 1st mapping, 1st match between a table and the corresponding input.

864
(Refer Slide Time: 18:15)

So, the per packet processing the basic architectural components are something like that
you have a routing table, a copy of the routing table is put in every individual routers. So,
whenever you are putting a copy of the routing table at every individual routers,
whenever a packet comes this interface controller it makes a routing decision by looking
into this local routing table. So, this local routing table has a name it is called a
forwarding information base which will come after a couple of minutes. So, it makes a
routing decision, put the packet in a queue and then you have this switch fabric the fabric
logic which make a mapping from this input queue to the output queue.

So, this output queue is connected to the output interface through which the packet is
forwarded. Now, as I mentioned that every router interface can work as an input queue as
well as an output queue.

865
(Refer Slide Time: 19:10)

So, the interfaces they maintains a forwarding information base which is the local
routing table. This forwarding information base is a mapping from the input interface to
the output interface.

So, the forwarding information base is nothing but a replica of the routing table used at
the individual interfaces for making the forwarding decision. So, a copy of the routing
table it is put in every individual interfaces in the form of a forwarding information base.

(Refer Slide Time: 19:37)

866
So, this is a the idea that whenever you have a packet in event; a packet in event means a
packet is input to the system it is put into the input interface. In the input interface you
look into the forwarding information base your local cache of the routing table which is
implemented inside the hardware. After looking into this local cache, if there is a hit, that
means, the information is there in your FIB. So, you forward the packet, put the packet in
the output interface and execute a packet out event; that means, output the packet to the
link. Otherwise, if there is a FIB means; that means, the information is not there in the
forwarding information base. You look into the routing table, make a route lookup. The
route lookup procedure will interact with the routing protocol, get the routing
information and put it in the FIB.

(Refer Slide Time: 20:32)

So, the difference between RIB and FIB is that the routing information base is the
original software routing table which is a implemented in the software and maintained at
the control plane. And forwarding information base is the copy of the required routes
maintained at the interface of the TCAM hardware. Now, this RIB it is dynamic and
maintains the entire routing information, whereas, FIB updated whenever required.

867
(Refer Slide Time: 20:58)

So, here is an example. So, in the route controller you have this entire RIB. Now, in
individual interfaces like Eth0 and Eth1, you have a copy of this RIB. So, here in this
Eth0 you have the information about these 3 entries; these 3 entries means, this entry,
this entry and this entry, whereas here, you have the information about this entry and this
entry at Eth1. So, that way a part of the routing table is copied to the FIB, forwarding
interface information base at individual network interface whenever required.

(Refer Slide Time: 21:41)

868
Now, this RIB feeds the FIB. So, that means, you have this multiple routings algorithm,
every routing algorithm may have their own routing table. So, you have the BGP routing
table, you have the OSPF that contains the link state database, you have the static routes
which network program are inputs manually. So, all this information they feed the
routing information base and from the routing information base whenever required, the
information is copied to that TCAM hardware in the forwarding information base.

So, by interesting design choice in a router is that this entire control plane functionalities;
that means, this routing protocol along with the routing information base that is your
control functionalities that is implemented as a part of the software. Whereas, in the data
plane, you have the routing information in terms of forwarding table or the forwarding
information base which is implemented inside the TCAM hardware to make a fast
lookup of the information. So, this TCAM hardware, so, I am not going to the detail
logic design of the TCAM hardware.

So, if you are interested you can look into the design of the TCAM hardware. It is a
special type of hardware which makes first lookup of an information inside the table. So,
again repeating this entire procedure that whenever you are receiving a packet first you
extract the IP header, from the IP header you extract the destination IP address then you
use the TCAM hardware to make a match with the forwarding information base.

If the information is already there you then use the switch fabric to copy the packet from
the input interface to the output interface. If the information is not there in the FIB then
you need to make a software control at the routing information base to get the
information from the routing information base and update the FIB.

So, that way this entire routing procedure is implemented inside a router. So, that is a
brief introduction about the router functionalities. In the next class, we will look into a
demonstration of a practical router, of an ATPG router and we look into the different
component of it in a little details.

Thank you all for attending this class.

869
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 42
IP Routers Demo

Welcome back to the course on Computer Network and Internet Protocols.

(Refer Slide Time: 00:23)

So, in the last class, we were discussing about IP routers, we have discussed about the
different functionalities of the IP routers, and how a IP router look like.

870
(Refer Slide Time: 00:31)

So, specifically what we have seen that in a basic architectural components of a router,
we have two different components. We have the route processor at the top and that route
processor contains a memory and a CPU. And then we have a internal interconnection
network bus with which the individual interface cards are connected and that interface
card they work as the input-output for the routers.

(Refer Slide Time: 01:04)

So, in that continuation we have also seen that this entire router architecture is actually
divided into two part, the control part and the data path part. In the control part, we have

871
different routing functionalities which are being implemented. So, in the later classes we
will see different types of routing protocols which are used to populate the routing table,
you will see that there are routing protocols like distance vector routing, link state
routing, and in the internet scale you have a Border Gateway Protocol or BGP class of
routings which are used to populate this intermediate routing table.

So, in the router control part we have these routing functions or the routing protocols
which are implemented. And those routing functions or the routing protocol that we will
look in subsequent lectures in details. They helps us in constructing the routing table.
And then at the data path level, we do the per packet processing things. So, whenever
you have certain input packets with that input packets, you look into the packet header;
from the packet header you find out what is the destination IP address. Based on the
destination IP address, you need to make a match with the routing table find out what
should be your next hop and accordingly forward the packet to the next hop, so that was
the basic architecture of the data path.

And we have briefly mentioned that this data path is need to be very fast, because at per
second you have to possibly process some thousands or sometime a millions of packets if
you are in a high speed network. And, that is why this data path is normally implemented
in a hardware that we call as Ternary Content Addressable Memory or TCAM kind of
memory architecture. So, in general in a typical router, in the control path or the control
plane that is implemented as a part of the route software routing operating system which
is a internet scale operating system, we have mentioned that there are different kind of
internet operating system like a Cisco IOS. So, that particular software module
implements your routing functionalities, your routing protocol, that software
functionalities which need to be there to process a router and that construct the routing
table which is there.

Now, we have seen that the data path need to be implemented in a faster hardware, we
implement it in the TCAM type of memory architecture and the snapshot of this routing
table is bring to the TCAM hardware in the form of Forwarding Information Base or
FIB. So, that forwarding information base is basically looked up by the TCAM hardware
to forward the packet to the outgoing interface.

872
So, we have the intermediate switch fabric that takes the input, make a match with the
forwarding information base which is there in the TCAM hardware, and then it finds out
what should be your destination interface along with the next hop. And that information
is passed to the data link layer for doing further processing and the packet is put to the
outgoing interface.

(Refer Slide Time: 04:27)

Now, we will briefly look into the architecture of this ternary content addressable
memory or TCAM which is used to process your router. So, this TCAM is specifically a
specialized high speed memory which searches its entire content in a single clock cycle.
So, we call it ternary because it stores and query the data using three different inputs,
either it can be the 0 or an 1 or something called the x. So, that is a don’t care or wildcard
condition. So, that is why we name it as ternary content addressable memory because
everything is represent is either in 0, 1 or X that is the don’t care or wild card condition.

Now, this searching in a ternary content addressable memory, it is based on pattern


matching. So, one example is given here say for example, you want to find out 110x. So,
you want to make a match with 1 followed by a match with 1, followed by a match with
0; and the fourth bit you do not consider. So, both 1101 and 1100 will get matched with
this particular pattern.

873
(Refer Slide Time: 05:35)

So, if we compare between this content addressable memory and our normal random
access memory CAM and RAM, so this they are basically complimentary or they are
kind of works in a inverse principle. So, RAM is accessed via the address where the data
is stored. So, the operating system need to issue the address where the data is being
stored inside the RAM. And then it sends that particular address and fetch the data from
that particular address. So, RAM is basically accessible via this address; and it works in a
kind of sequential address principle and at the same time at the random access principle.
So, you can just pick up an address, go to that location, pick up the content from there.

On the other hand, CAM can be addressed by performing a query for the content itself.
So, in case of CAM, CAM you do not require the address rather it restricts the address
where the content is being found. So, here the search is based on the content itself not on
the address. So, in case of a RAM, we provide the address and the output is the
corresponding content at the data which is being stored at that address location. In the
case of CAM, it is just a reverse like you are providing the content there you are
searching the content there. If the content is found inside the CAM, then it will return
back with the corresponding address, so that way it is much faster than RAM and that is
why we use it for this network processing for implemented the forwarding information
based inside a router data path.

874
(Refer Slide Time: 07:23)

So, here is a basic architecture of TCAM with an example. So, this right side diagram
shows the different components of the TCAM hardware. So, we have different blocks
that is the individual memory location, where the contents are being stored. So, here the
in the top line the first block is storing as 1; the second block is storing as 0; the third
block is 1; and the fourth block is don’t care, so that is why because the fourth block is a
don’t care. So, you can have a match with either 0’s or 1’s.

Now, in a routing table, what we can do, we put the data in the format of prefix and mask
that we have seen earlier. Now, for the simplicity we just put here an example of the
prefix in a 3-bit format and the corresponding masks. So, we to say your prefix is 101,
and the mask is 3; that means, if something is if your destination IP has the first 3-bits or
the prefix has 101, then there will be a corresponding match. So, similarly we have a
prefix of 111 with a mask 3, prefix of 10 with the mask 2, prefix of 0 with the mask 0.

Now, if you remember in the route matching principle, it is like that if there is a match in
the first 3-bits that means, 101 and the remaining bits can be anything because this first
3-bits the prefix part it denotes your network IP and the remaining part denotes the host
IP. So, during the routing procedure, we make a match with the network IP, so that is
why we extract the network IP and make a match with that. So, in your 32-bit IP address
format, you just need to look into the network address part, you do not need to look into
the host address part for doing the routing.

875
The host address part is required to make the final forwarding at the last hop router when
it has received in the router where in the local area network where your machine is being
located. So, in the last hop router, you require the host address and in the previous case
you just look into the network IP and based on the network IP you make look up. So,
here your network IP contains the first 3 prefix bits. So, it is 101 followed by 3. Now, in
the TCAM format, if you just for the simplicity assume that my routing address is not 32
bits my routing address is router address or the IP address is a 4-bit IP address well actual
IP address is 32 bit, just for simplicity and for the explanation we are assuming that the
address is for 4 bit address field.

Now, if 3-bit denotes the prefix then in the TCAM format it will be 101X. So, the last bit
is the don’t care condition and this last bit is actually you are denoting your host IP.
Similarly for 111 and the mask tree in the TCAM format it will be 111 followed by X a
don’t care condition. For a prefix of 10 with mask 2, the first two bit will be 10 and the
remaining two bits will be XX. When the prefix is 0 as well as the mask 0 this entire part
belongs to the host part. We have a special meaning of this kind of addresses the TCAM
format will be XXXX.

Now, whenever the things will get matched here in this TCAM format the things have
been stored in this format here in the bottom, in the bottom most case we are storing
XXXX, on top of that we are storing 10XX, then we are storing 1111 111X. And then
finally, you are storing 101X, so that is my TCAM structure with these address format
and address space.

Now, say we are we want to search a word of 1011 here. Now, how this search will be
being done? So, we have this match lines this match line will trigger that which
particular blocks need to be activated. So, if these four blocks are getting activated,
during that time if you want a search word of 1011 that is a match with the last block
XXXX, because all are don’t care. So, whatever be the bits that will get accepted. Then
we make a matching with the next block it is 10XX.

Again we have a match because we have first 10, this 10 will get matched here, then the
two parts are XX. So, whatever we are providing here, here we are providing 11 that will
see a match. The third one 111x that is not a match because, the second bit is 0, so here it
is 1, so it is not a match. The fourth one is again a match. The fourth one is 1011, so 101

876
there is a match. And then last one is X - the don’t care. So, there is a match there. So, we
have a three match here. The first match is at address location say 00; the second match
is address location 10; and the third match is at address location 11.

Now, we have an encoder that will return my final address. So, if you remember that in
case of a routing whenever we do a routing match we take the longest prefix match. So,
if there are multiple matches, then we take the final output as the 1, where there is the
longest match. So, out of these four cases XX sorry the three cases where we have a
match XXXX, 11, 10XX, and 101X. The longest prefix in the last 101X, because here I
have a match with three different bits and I have only one don’t care. So, the maximum
match is here. So, this encoder will return that particular address where you have the
maximum match. So, the encoder circuit is to implement your longest prefix match
principle to return back the final address, so that way you will get the final address as 00
indicating that the content is there. And in that particular address location the you
whatever is there, whatever be the next information there that will be used to fetch the
interface information, and the next hop information and there the packet will be
forwarded. So, that is the idea of this TCAM hardware which makes the search based on
the content itself and not based on the RAM based on the RAM architecture which
makes the search based on the hardware. So, that is the idea of the TCAM.

(Refer Slide Time: 14:01)

877
Now, we will look into several IP and route commands. Before going to that, let me show
you that how a typical router looks like. So, here I have a two routers, which are there
and which are connected with particular switch. So, you can look into this architecture.

(Refer Slide Time: 14:31)

OK. So, this architecture, in this architecture what we have done here we have two router
boards. So, this is one router board, and this is the second router board. And both of these
router boards are connected to a layer two switch. So, this lower thing, this is a TP link
switch which is a layer two switch. So, these two router hardwares they are connected to
the switch via the wire.

Now, a particular router looks like this indeed this is a small prototype of a router. The
actual routers are even bigger than this one. So, here we have a four different chassis. So,
you can see that this is one chassis; the second chassis; the third chassis and the fourth
chassis. And every chassis has a four different interfaces. So, we have a 1, 2, 3 and 4
interfaces. And with these interfaces they are connected with these RJ 45 cable.

So, these RJ 45 cables are used to connect the wires with that router interface VT or
machine interface. So, these are the input-output interface which are there with each of
these input output interface we have these interface processor, and here I have this
TCAM hardware and finally, the route processor. So, this is the route processor that
contains the router software which is which need to be executed there and that router

878
software will help you to find out the routing protocol, run the routing protocol and do
the stuff.

Indeed this particular router is a something called as software define networking router.
In the next class onwards we will discuss about this concept of software define
networking router. The idea of the software define networking router is that route control
part the software part is not implemented or not kept inside the hardware rather you can
connect an external controller machine with this router, where the routing control
protocols will run. And that will actually generate the forwarding rules and those
forwarding rules will be implemented inside the TCAM hardware that is there inside the
router.

And then whenever some input packet is coming to one of these input interfaces, it will
make a match with that TCAM hardware, and make the forwarding to the outgoing
interface where it wants to forward. So, here we have all these different forwarding
interfaces. So, among all these different forwarding interfaces, here we have four
interfaces connected with every chassis. So, it is basically a 16 port router.

So, this one as it is a 16 port router. This one is another 16 port router. And both the 16
port routers are connected with this TP link switch, so which is a layer 2 switch. Now,
normally what we do in case of our typical network architecture, we have this routers
connected with the layer 2 switch and from the layer 2 switch again we are taking an
output which is finally, connected to the machines the desktops that we have.

So, that way the packets come to the switch from the switch it comes to the router and
then router takes the forwarding decision based on the routing protocol which is running
inside. And after taking the forwarding decision, it sends the packet to the outgoing
interface. So, this is the typical router which looks like this way. So, you have these
routing boards which are connected into multiple chassis that we have briefly discussed
in the last lecture. And finally, the input output interfaces through which the individual
machines are being connected; so, this is the typical look of a router. So, these entire
chassis we nicely put inside a box and mount it somewhere.

Now, let us come back to the slides where we were talking about different kind of IP and
route commands to see different type of different type of tools that you can use to look

879
into the IP related aspects of your machine, and at the same time the routing related
aspects and configure your router. So, let us have a brief discussion about that.

(Refer Slide Time: 19:11)

So, the first command that we would like to see is something called IP address show. So
if you in a Linux based machine if you give the comment as IP address show, so you can
see that it will show you all the interfaces that you have in your machine. So, in this
machine, I have three different interfaces; one logical interface which we call as the loop
back interface. So, if you remember that earlier during the socket programming, we were
specifying the host name as the local host, and that local host actually works on that loop
back address. So, a loop back address, there the data is not going to some outside
machine that means, it will work on the same machine.

So, on the same machine you have both the sender and the receiver. So, during that time,
you can utilize that loop back loop back interface. So, this loop back interfaces just to
look into whether the protocol stack of your machine is live or not; so, you can see that
the loop back address as an IP address 127 dot 0 dot 9 dot 1 slash 8. So, that is the loop
back IP address and the hardware address is all 0’s. So, then there are other parameters.

So, you have this inet 127 dot 0 dot 0 dot 1 is the IPv4 address of the loop back interface
and inet 6 is the IPv6 address of that loop back interface. Then the next interface that I
have is eth0 that is the Ethernet interface the wired interface which is connected with this
machine that has an link address. So, you can see that link slash ether the hardware

880
address or the MAC address is 48 colon 0 f colon cf colon db colon e 0 colon 9 d that is
the hardware address and the broadcast hardware address are all fs, that means, all 1’s.
And the IPv4 address of these machine is 10 dot 0 dot 0 dot 11 slash 24 broadcast
address is 10 dot 0 dot 0 dot 255, and this does not configure with the IPv6 address on
the IPv4 address has been provided.

Now, coming to this WLAN interface; the wireless LAN interface which is connected
with this machine. So, this wireless LAN interface has a link or the ethernet address the
hardware address as d 85 d e 210 ce 93, and broadcast address as all 1. Then it has a IPv4
address which is 10 dot 146 dot 58 dot 130 slash 17 that is the IPv4 address which is
assign to this WLAN 0 interface the wireless interface; and the broadcast address as 10
dot 146 dot 127 dot 255. And it also has a IPv6 address which is written in the next line
inet 6, inet 6, fe 80.

So, this is the IPv6 address for this machine, fe 80 colon colon colon colon. So, in IPv6
discussion will discuss what does it mean. Then c 8 c colon c e 5 b colon c e 6 5 a colon
7 c a 1 slash 64 and that is the IPv6 address of this. Now, all of this interface information
you can also see that there is a parameter call mtu. So, if you look into the loop back
case, in the loopback case, it is written as lo; then loop back up lower up then it is written
as mtu 65536.

So, this mtu is the maximum transmission unit that means, the maximum number of bits
that can be transmitted on that this particular interfaces in the form of a data packet. So,
your data packets size your link layer packet size should not exceed more than 65536 for
this loopback address, loopback interface. For the Ethernet interface, you can see it is
written as Ethernet no carrier BROADCAST MULTICAST UP then mtu 1500, so that
means, the mtu is 1500 bytes. So, you should not send more data than 1500 for a single
packet in the Ethernet interface. Similarly, for the WLAN interface the mtu is 1500. So,
you should not send the more than 1500 bytes of data in the wireless interface as well.
So, this is the individual interface information that we have.

881
(Refer Slide Time: 23:52)

Now, the next say command that we want to learn is ip link show. So, this command ip
link show it will show the similar kind of information, but it will show the link layer
property of the individual interfaces. So, it will show the individual link property. So, for
the loopback interface, you can see that the link or it supports mtu of 65536. It uses
qdisc, qdisc is a particular queuing protocol; then it does not have any queuing
interfaces. Its state is unknown, current state, the mode the link mode then whether some
group is defined or not then the qlen.

Then for the Ethernet interface, so actually in the loopback interface there is no such
default queue. So, your qlen is 1. So, whatever packet will come, it will immediately
send that packet. So, there is no queue which is associated with this link. Now, in the
Ethernet interface you can see that it has this individual support parameters followed by
a mtu of 1500; it uses qdisc and it uses the queue type of pfifo. So, this pfifo is the
priority pfifo queue with a first queuing state. It current state is down you have not
connected any Ethernet interface with this machine. So, the state is down its mode is
default group default and the qlen is 1000. So, you can store 1000 packets of mtu 1500
bytes inside the queue that it has. Similarly, for the WLAN, it supports BROADCAST
MULTICAST, it is currently up. So, the mtu is 1500 bytes; the qdisc supports the queue
type is mq the something called a management queue for the WLAN IEEE 802.11
network. So, this management queue is actually a four layer queue, it four different
quality of service classes, its current state is up. We are currently connected to this

882
wireless interface with this academic Wi-Fi router. So, this it is connected with these
academic. So, that is why currently it is up its mode is dormant, mode is dormant means
the every packet that you are currently sending to this particular machine it will be send
to this WLAN interface. The group is the default group. You have not defined any group
and a qlen is 1000 packet. So, you keep 1000 packets of maximum mtu 1500 inside the
management queue that you have. So, this is about the link layer information that you
can get from the comment.

(Refer Slide Time: 26:48)

Then we will see some detailed statistics of individual interfaces. So, for that we issue
the command as ip minus s address show. So, earlier we have seen ip address show. Now,
with that we are adding up this minus s option.

883
(Refer Slide Time: 27:07)

So, here you can see for the individual interfaces it gives the detail statistics. So, here the
for the loopback interface, the statistics is given, then the Ethernet 0 interface. So, the
loop back is not coming here.

(Refer Slide Time: 27:25)

Just so if I if I, just because of the resolution if I make it more.

884
(Refer Slide Time: 27:30)

So, here you can see if initially the loop back information, the statistics for the loop back
informations are coming. So, it says you about the total amount of received bytes, total
amount of received packets, so whether some error has been occurred or not, how many
packets are been dropped, how many overrun packets, how many mutlicast packets.
Similarly, for the transmit packets what is the total amount of bytes that are been
transmitted till now, till the interface was live, then the total number of packets, similarly
the error packets, the dropped packets, the carrier packets and the number of packets that
has experienced the collision. Similarly, for the Ethernet interfaces, you have the
Ethernet interfaces currently down we have not connected any Ethernet interface to this
machine, so that is why it is coming to be the receive and the transmit bytes all are
coming to be 0.

885
(Refer Slide Time: 28:24)

Now, for the WLAN you can see that it is having a amount of received bytes the amount
of received packets from the time the WLAN interface became up. Similarly, the
transmit bytes and the transmit packets, so that gives you a detailed statistics about the
link.

(Refer Slide Time: 28:40)

Now, we will see the route related things. So, let us make the command as route minus n.
So, this route minus n will show you the routing table which is there in this machine. So,
you can see that the routing table contain this parameters the destination IP followed by

886
the gateway, the net mask, certain flag bit a metric of a individual paths, some reference
bits some use bits, and the finally, interface where this particular destination is
connected.

So, for example, if I will take say the destination IP as 10 dot 118 dot 2 dot 149 for that
my default gateway is 10 dot 146 dot 0 dot 2 that is the next hop IP. And for that net
mask is 255 dot 255 dot 255 dot 255 then the default interface is wlan 0. So that means,
if you want to forward the packet to this particular IP, 10 dot 118 dot 2 dot 149 with a net
mask of 255 dot 255 dot 255 dot 255, your interface will be wlan 0. You have to send it
through wlan 0 interface, and your gateway will be 10 dot 146 dot 0 dot 2, so that means,
my routing table.

Now, say if I want to add the new routing entry to this route table, for that you can use
the command sudo ip route add, then you give the destination where you want to add up
in the routing table, say I want to add 172 dot 16 dot 2 dot 30 dot 2 this particular ip. And
say my interface is wlan 0 through which interface I want to connect it. So, dev eth 0, so
this dev eth0 so, what we are trying to do here, we are trying to add the new ip route in
this routing table. So, my destination is 172 dot 16 dot 30 dot 2 this particular IP address
I want to add. You can also provide the net mask in the form slash 24. If you are not
providing the net mask that means it will take the entire path the 32 bit as the net mask,
based on your IP you can provide that net mask. So, the default interface is eth0 and then
I am providing the gateway the gateway address will be via, so via say 10 dot 146 dot 0
dot 2. So, this will add the routing table.

Now, to add the routing table you require route access. So, it so, we have use this sudo
command here it ask for the route password. So, let me give the route password. So, ok,
so it says the network is unreachable ok. The network is unreachable message is coming
because we are trying to add it the default interface at eth0. Now, this eth0 interface is
down because this eth0 interface is currently down. So, it does not get add up. So, let us
now try to add it up in wlan interface. So, it gets added. So, now, if you make route
minus n command, you can see this entry is getting added here, 172 dot 16 dot 30 dot 2,
the last thing. So, let me just clear it and make it again ok.

887
(Refer Slide Time: 32:42)

So, the last entry you can see in this routing table it is 172 dot 16 dot 30 dot 2 the
gateway is 10 dot 146 dot 0 dot 2; the netmask we have not given. So, it has taken 255
dot 255 dot 255 dot 255 as the net mask and finally, the interface is wlan 0. Now, if you
ping this machine, you can see, so the machine is not getting pinged, so that machine is
not up. So, let us add.

(Refer Slide Time: 33:49)

So, now we have added another IP 172 dot 16 dot 30 dot 2 a machine which is currently
up; and the gateway I have given again as 10 dot 146 dot 0 dot 2 and a default net mask.

888
So, whenever I am pinging it, it is getting pinged. So, the machine is on and it is able to
deliver the packet to that particular IP address. Now, you can actually see that which
particular routing part it is following.

(Refer Slide Time: 34:18)

So, for that you can give the command as traceroute. So, if you make the command as
traceroute as say let us try with both the IP addresses that we have added here 172 dot 16
dot 30 dot 2, so it will try to find out the path for that machine. So, what you can see
from here, it has reached to the first hop that we have added. So, in the first hop it is 10
dot 146 dot 0 dot 3, the gateway address that we have given. After that gateway address
it is not finding any path to forward that machine, so because this particular machine is
currently down. So, the path is not there.

889
(Refer Slide Time: 35:05)

But on the other hand if you make a traceroute to 172 dot 16 dot 2 dot 30, so it will find
out the path, it has found out the first hop path. The first hop path at 10 dot 146 dot 0 dot
3; the second hop you can see is 10 dot 205 dot 1 dot 10; the third hop as also came 172
dot 16 dot 2 dot 13 and finally, the four hop is 172 dot 16 dot 2 dot 13. And here you can
see that it show the response time that, what was the average response time to find out
that individual hop.

So, it has followed these particular tree hops from this machine, it went to the gateway
that you have specified 10 dot 146 dot 0 dot 3. Then it has went to 10 dot 205 dot 1 dot
10, then it has move to 172 dot 16 dot 2 dot 13. And that was the final hop from where it
was able to reach 172 dot 16 dot 2 dot 13. Now, let us do one thing let us change the
gateway. So, in the route minus n we had added 172 dot 16 dot 30 dot 2, my gateway
was 10 dot 146 dot 0 dot 2. Now, let us delete this entry and also delete the entry. OK.

890
(Refer Slide Time: 37:15)

Now, instead of via 10 dot 146 dot 0 dot 2, let me put out some other address 10 dot 146
dot say 80 dot 219 ok. Now, you see that my last entry has changed from 172 dot 16 dot
2 dot 30 to 10 dot 146 dot 80 dot 219. Now, in this particular case if I try to ping this
machine ping 172 dot 16 dot 2 dot 30, it will not pinging. So, if you make a traceroute
here, 2 dot 16 dot 2 dot 30. Let see what happens. So, now, you see it is not able to
forward the packet, so all the hops are coming as star star star star.

(Refer Slide Time: 38:28)

891
So, that is why whatever default gateway we are entering here, so it is using that default
gateway to forward the packet to the final destination. So, that way you can actually - so
this entries produce the IP route that command which we are providing, they are the
default entries, default routing entries. We call it as the static routing entry. So, we are
including this static routing entries to dynamically configure or better to say statically
configure the routing table and accordingly things are getting forwarded.

So, what I suggest you is to play with this kind of tools and see what you are getting
while sending some packets or trying to ping some destination IP address. So, hope this
particular lecture gives you an idea about in a Linux based system, how you can play
with different kind of a IP related tools and see different statistics from your machine.
So, just try to explore that further.

Thank you all for attending this class.

892
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 43
Software Defined Networking – I (Basics)

Welcome back to the course on Computer Networks and Internet Protocols. So, till the
last class we have looked into the detailed design of IP routing mechanism and the
structure of IP router. Now we will go to a little advanced topic which we call as the
Software Defined Networking.

So, this concept of software defined networking is an recent and upcoming standard and
all the traditional routers are expected to be replaced by SDN enabled router. So, we will
briefly discuss about what is SDN? What is the utility of SDN? How SDN differs from a
traditional router architecture that we have discussed earlier.

And then we will look into certain topics in SDN that how we can program a router with
the concept of SDN technology. And how we are gradually migrating from a traditional
distributed router architecture to the SDN supported router architecture. So, the concept
of SDN is something like this.

(Refer Slide Time: 01:27)

893
A software defined networking architecture it is a network framework which involves in
separating a network’s control function from its data forwarding function, and
centralizing its intelligence, and abstracting its underlying architecture from applications
and services. So, that is the kind of formal definition of software defined networking.
Now the broad keywords inside these definitions are as follows, first of all we are trying
to separate out the control functionalities and the data functionalities inside a router.
What is mean by separating out the control functionalities and data functionalities?

So, in the last few lectures we have seen that well inside a router you have two different
levels of abstraction. You have the control plane which is implemented as a part of the
software which implements the routing functionalities and the construction of the routing
table and its management, and we have our data functionalities.

In the data functionalities your task is to forward a packet by looking into the destination
IP field in the IP header, and making a match with the routing table the local copy of the
routing table inside the interface that is the forwarding information base, and then
forward the packet to the outgoing interface. Now, these control functionalities and the
data functionalities traditionally they are implemented in a single router. Now whenever
you are implementing the control functionalities and the data functionalities in a single
router, then the complexity of the control functionality becomes higher. Why it becomes
higher?

Because now you have multiple routers with their control planes and those control planes
need to coordinate with each other to generate the global routing table, or to manage the
global routing table. And, these control need to be performed in a distributed way
because of its architectural limitation or the way we have designed this traditional router
architecture.

And with this distributed control architecture, first of all your routing protocol gets
problematic as we have seen that both distance vector and the link state routings have
significant limitation in terms of their scalability, distance vector routing cannot get
scalable because of this count to infinity problem, where as the link state routing protocol
that cannot get scalable. Because of its size of the link state packets or the size of the link
state information that you need to maintain if you implement it over a large network.

894
So, because of such limitations we have restricted this link state routing and the distance
vector routing within a local internet, or within a subnet. And from network to network
we have this border gateway protocol which implements the policy. Now this may
difficult for the network managers because, if there is a policy change then you need to
update every individual router. And, all the routing protocols in all the routers control
plane they need to get coordinated with each other to make an policy update at the
individual routers, and obviously, in a distributed architecture it will take time.

And because of this time requirement there can be inconsistencies across the routers and
these inconsistencies can get significant in a large network. So, that is why managing a
router, managing a subnet with some say 1000 routers is a very difficult task. And you
are deploying these routers not in a single day gradually you are expanding your network
and you do not know that what was the configuration of the earlier routers and you need
to make a match of the configuration from these two different routers. Then comes off
the compatibility among the vendors, it is not like that all the routers of an organization
they will come from Cisco, or even if they come from Cisco they will have the same
model as you make a gradual deployment that routers may come from different vendors.
The routers may have different models their configuration options may be different if
you just look into the Cisco IOS manual you will see that it is a some 5000 page
document. So, the management functionalities are very complex.

And with this distributed architecture, maintaining consistency across the configuration
of the routers at the control planes are different level did that become difficult and that is
why we gradually try to move from a distributed control plane architecture to a
centralized control plane architecture. And that is the basic motivation behind the design
of a software defined networking concept.

So, let us go to a little details about this SDN abstraction here the idea is that you
separate out these control planes from the routers and make a centralized control plane.
So, you take out the brains from the router. So, this control planes you can say that it
work like a brain of the router because, it makes the decisions and that TCAM hardware
just making a forwarding processing. So, you are taking this brains out of this individual
routers and putting a centralized, putting the brains in a centralized place which is your
entire route controller.

895
(Refer Slide Time: 07:19)

So, as you have looked earlier that the control plane and the data plane. The control plane
is the module which takes all the decisions; basically it is an instructor the routing
algorithms implemented in the control plane. And the data plane is the module which
carries out the tasks given by the control plane - the forwarding on the packets.

(Refer Slide Time: 07:40)

Now, the traditional networking devices they are proprietary. The vendors they decide
the software and the hardware. Both the control plane and the data plane and there is no
such standardization that there should be this kind of match. Every vendor apply their

896
own optimization. And because of that it is very difficult to purchase the hardware from
Cisco, and then take another operating system and load it on a Cisco router. Although,
there are certain routers which can support open source network IOS or router OS.

But they also have their own restrictions in terms of performance and manageability. But
for the commercial routers in general the hardware and the software both comes from the
same vendor and it is difficult for interoperability, managing interoperable.
Interoperability is possible, but managing interoperability among products from different
vendors as the kind of difficulty in a large network.

(Refer Slide Time: 08:47)

So, the idea is to separating out the control plane and the data plane. So, the idea is that
the vendor will only provide the hardware that is the data plane and we decide the
control plane by writing the custom logic that is the software.

So, the control plane will be decided by the application designer, or the network manager
or the network support team whereas, the data plane will only come from the vendors. So
that now the vendors they will just deliver a dumb switch it just have the TCAM, just has
the TCAM hardware along with the forwarding engine, the control logic is not there. We
will implement our control logic ourselves.

897
(Refer Slide Time: 09:30)

So, the vendors will only provide the hardware and we will decide the control plane by
writing custom logic. The advantage is that first of all the features are no longer limited
to what the vendor provides. You can always write your own network application as a
part of the controller.

Or the community development in our open source movement people can come together
and design a new network protocol and implement it on a control plane itself. And you
do not require a vendor support for that and it obviously, increases the product lifetime.

(Refer Slide Time: 10:13)

898
So, here is a brief idea about how does SDN work? So, compared to the traditional
network a software defined network has two type of devices. The controller which is the
brain of the network and the switches that is the hardware devices they are kind of dumb
switches that they do not have any logic in built inside them. So, the switches in SDN are
kind of blind switches. So, they do not have any built in features and that needs to be
instructed by the controller. So, the switches so here is an example of an SDN switch
zodiac effects switch which is a tiny SDN switch, it has 4 interfaces and TCAM
hardware.

So, this is the TCAM hardware and this is the microcontroller; microcontroller for the
switch. So, it just comes with this much of hardware and whatever routing logic that
would be there that will be instructed by the controller itself, and the controller can
comes from different open source standard. For SDN we have this protocol called
OpenFlow. OpenFlow is a open source standard for making controller to switch
communication and based on this OpenFlow standard, there are multiple open source
controllers which are available there is controller like Ryu, and many others SDN
controller like the old controller was something called POX which is a Python based
controller then NOX.

So, this kind of controller are there OpenDaylight then I can name a few other
controllers. So, there are different such open source controllers, whatever controller you
prefer you can use it in a standard computer. Now this entire brain can be put on a
standard computer. You do not require specialized hardware for that because route
processor is nothing but a general purpose processor. So, that is why you can put this
entire control logic on a single computer.

So, you can install this controller one of the controller Ryu, POX, NOX open daylight
anything whatever is your personal choice. You can install it on a personal computer and
from that personal computer you can make the things communicate with each other.

899
(Refer Slide Time: 12:36)

So, this is the architecture the we have a controller which is nothing but computer
general purpose computer that works like the brain of the inter network and then we can
have multiple switches. These switches are the kind of dumb policies. Controller actually
decide and teaches the switches how to forward a packet and then you can have multiple
hosts.

Now let us so this is a very simplified architecture. I am trying to explain you the basic
concept with this simplified architecture. So, let us look into an example that how the
entire thing works in an SDN environment. So, in a traditional networking environment
you do not have this controller. So, you only have this switch and the host, and the
switch has the entire routing logic. Now here the routing logic is taken out from the
switch an it is put on controller. Now note that you can have multiple switches which are
connected to this controller. Indeed all the switches in our organization they can be
connected to a single controller.

The controller will actually perform this routing logic in a centralized way, that way we
are actually avoiding the problems associated with a distributed routing logic and we are
also reducing the overhead which comes from the distributed routing protocols. And we
are putting this entire information in a controller which will dynamically teach the
switches about how to forward the packet. So, let us look into the example.

900
(Refer Slide Time: 14:17)

So, you want to forward a packet from h1 to h3, your source is h1 and the destination is
h3. So, the host forwards the packet to switch s1. Now whenever the packet comes to
switch s1, initially this switch does not have any information. It just have a TCAM
hardware, and switch fabric, so it does not know how to forward the packet.

So, what the switch does? The switch sent an packet in event to the controller; that
means, the switch informs the controller that I have received a packet. With this packet in
message, it sends the packet information, the packet metadata to the controller. And then
the controller actually decides that what to do with that packet and return back the
information to the switch in a packet out event. And till that time the packet is buffered at
s1, buffered at the switch.

901
(Refer Slide Time: 15:16)

Now, the controller sends the rule to the switch then this rule is installed in that TCAM
hardware of the switch. So, we’ll discuss the OpenFlow protocol in details in the next
class. During that time, I will show you that how we actually write the rules and how a
rule looks like. And this rule is actually a very simple thing the rule is just kind of match
action pair right. So, a switch rule is nothing but you have a match data and then action
data. So, the match data says that say if your destination IP is some 10 dot 2 slash 16
then you, your action is say forward, forward to say interface eth0 forward it to interface
eth0, so that can be a simple rule. So, this rule is now generated by the controller. So,
earlier this rule was actually inside the routing table. Now this rule is generated by the
controller and then the controller actually sends this to the switch and it is installed in the
TCAM hardware of the switch.

902
(Refer Slide Time: 16:39)

Now the switch has this rule; so, once the switch has this ruled in the switch forwards the
packet to extreme. Now the rule is already installed in the TCAM hardware of the
switch.

(Refer Slide Time: 16:45)

So, that is why for the subsequent packet you do not require to communicate with the
controller the communication in the controller is only required for one type. So, you
forward it to s1 and then send it back to h3 and that is the rule which is being installed in

903
s1. And for all the subsequent packet there would be a TCAM hit and the cache hit. So,
whenever there is a cache hit, you directly forward it to h3.

Now this is this entire SDN architecture and before going to the SDN architecture, let me
tell you the power of SDN. Now with the help of this dynamic configuration you can
actually support lots of new things along with a simple forwarding.

So, now with this match action pair kind of rules, with this match action pair kind of
rules, you can also implement a firewall. How you’ll implement a firewall? You can
implement the firewall is something like this say if your destination IP is 172 dot 16 dot
20 slash 24 then you drop the packet that can be a firewall rule which you can always
install inside s1, inside the switch inside the TCAM hardware of the switch.

So, that way you can design a wide class of rules. So, we will discuss in the next class
the different OpenFlow supported rules which are there in the OpenFlow standard. And
you can actually support a large pool of such rules to implement different kind of
network application at the controller. You can implement the firewall, you can implement
a NAT, you can implement a forwarding gateway, you can implement a packet gateway.
Even you can process because the controller is working at the application level, you can
also process at the level of virtual LAN, or at the level of even at the transport layer. You
can look into the port and based on the port you can decide what to do.

So, for example, if you just want to ensure that you should not send any packet to port
80. So, you can just write a rule like this say if your port is equal to 80, then you drop the
packet well. So, you can also write the rule in this way at the controller side. So, that way
you can implement the wide class of network application at the controller and it is not
limited only to forwarding and routing behavior.

So, ultimately most of the network functionalities you can map it to a forwarding
behavior. So, you are deciding how to forward a packet, or you are deciding whether at
all to forward the packet or not. So, all these things can be handled by a single controller
and that is having a centralized logic. Because it has a centralized logic, managing this
entire thing is very easy because, nowadays now you do not require this distributed
configuration of the control plane of individual routers. Just sitting on a single computer
which has a controller software installed, you can implement all these network
applications.

904
(Refer Slide Time: 20:06)

So, this is the board SDN architecture. At the infrastructure layer you have the
programmable switches, the different programmable switches which are the dumb
switches. But they can be programmed dynamically then you have a network controller
at the control layer. And finally, you are running you can run multiple applications on top
of this network controller you can implement a firewall, you can implement a custom
forwarding engine, you can implement a packet gateway, whatever application you want
to implement on top of this controller.

(Refer Slide Time: 20:42)

905
So, here is the difference between the traditional network and SDN. So, in case of a
traditional network you have the control plane and the data plane inside every individual
switches. And this control plane they will talk with each other, work in a distributed way
and on top of that you have the network applications which are running. And now
because these network applications say one network application is interacting with this
particular router, another network application is interacting with this router.

So, there can also be consistency problem not the configuration problem, it may happen
that this network application is having a conflict with the another network application,
and deciding that conflict in a distributed architecture is very difficult. But whenever we
are moving to a centralized SDN architecture, or logically centralized architecture, the
data planes are distributed well they just implement a forwarding logic, but the control
plane is centralized and all the application are actually talking with a single control
plane.

Now what you can do, this is another power of SDN that you can implement a compiler
kind of software here, or an interpreter or a compiler, or a compiler inside this control
plane which will generate the rules from individual programs. And then it will also check
whether two rules are having a conflicting behavior with each other or not. So, that way
you will be able to identify the conflicting rules or you will be able to also manually
check whether the rule is actually conforming to the network policy which you want to
build inside your network. So, that way this internet work management procedure
becomes simplified.

And it provides you a flexible and cost effective architecture to manage a large scale of
network. So, that is a brief introduction about software defined networking concept; in
the subsequent classes we’ll go to the little details about the software defined networking
concept. We look into the OpenFlow standard in detail. So, the OpenFlow standard is a
set of protocol or a set of messages which help you to communicate between control
controller, a centralized controller and a router, or SDN switch in SDN term we do not
call it as a router. Because now the routing functionalities are not implemented inside the
device we just call it as a SDN switch.

So or sometime it is called open switch. So, we just this OpenFlow controller, it designed
a set of messages to interact between the controller and a OpenFlow switches, or the

906
SDN switches. So, you look into the OpenFlow protocol in details as well as we look
into certain aspects of SDN in further details. So, thank you all for attending this class.

907
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 44
Software Defined Networking – II (OpenFlow)

Welcome back to the course on Computer Network and Internet Protocols. So, in the last
class, we were discussing about the concept of software defined networking and we have
looked into the basic architecture for the software defined networking and the broad
concepts around that. So today, we will gradually go towards an implementation
perspective of the software defined networking and the software component of it, where
the routers are the network devices or software controls.

So, we look into that what type of software or which software will actually control this
entire networking architecture. So, in this context, we will look into a specific open
source protocol implementation, which is called OpenFlow and in subsequent classes, we
look into a demonstration of SDN network by utilizing OpenFlow protocol stack.

(Refer Slide Time: 01:16)

So, let us go to the details of that. So, as you are discussing that traditionally, in the
network community, the innovation is a closed innovation. So, closed innovation means
in a single box, we have the individual components or individual networking
components, which should be there like here, if you just follow this diagram you have

908
the packet forwarding hardware, the network operating system and the different kind of
networking application everything is bounded on the single bounding box. So, this
contains the router hardware so, you can talk it as a router.

So, this contains the router hardware and inside the router, you have the hardware
component, which is implemented in TCAM or in traditional router, it is CAM. So, one
of this type of hardwares on top of that, we have the network operating system that
actually implements the different kind of networking protocols and routing control
protocols. And on the top of that we have different kind of applications like the firewall
application, the packet forwarding applications, which are there inside a router. Now
whenever you purchase a single router, this entire bounding box that comes from a
vendor and that is why, we call it as a closed innovation.

So, closed innovation basically says that well both the hardware as well as software
along with the applications which are associated with your network functionalities,
everything is coming from the same vendor as the same packets. As a result, the problem
comes in terms of first interoperability, the second is the network manageability. So, if
you purchase a Cisco router and a Netgear router or a HP router. In general, it is the
burden of the network operator to look into the individual configurations of the routers
and then configure them in such a way so that, these routers can talk with each other or
forward packets from one router to another router.

And these operating systems, they being the vendor specific like whenever, you are
purchasing a router from Cisco, the network operating system is coming from Cisco,
Cisco internet operating system, IOS or any other operating system, whenever you are
purchasing a router from Netgear, the operating system is coming from them.

So, because the operating system and the farmer are hardware dependent and it is vendor
specific and that is why, the configuration or handling the operating system for a network
administrator, who will actually give the input of the networking policy, for them this
entire architecture becomes difficult to handle. So, because of that we gradually move
from this kind of closed innovation network to a open innovation network.

909
(Refer Slide Time: 04:24)

So, the open innovation network basically talks about something like this, now, the
vendors will only supply the packet forwarding hardware, which at the dumb switches or
we call it as the open switches or blind switches. So, there are different terminologies,
which are being used in the networking community. So, you are getting this packet
forwarding hardwares from different vendors and then you have a central network wide
operating system, this network operating system, which is a open operating system.

So now, we are basically, segregating the hardware from the software or in routing
functionalities as we are discussing in the last class, we are separating out the data
functionalities or the data part functionalities from the control functionalities. So, the
data part part functionalities are still implemented inside the hardware inside this packet
forwarding engine, where you have this TCAM implementation. So, it is still in the
hardware side, but on the software side, you can choose your own software, which you
can utilize to configure all these hardwares all together and then on top of that you can
write your own network applications and the advantage is that now, you do not need to
bother about, whether your routers are coming from Cisco or from Netgear. You can
purchase the hardwares from any vendors in the world and then you can connect it in
your network and all these hardwares should be programmable with the help of this
network operating system. So, the only modification in the hardware side is that. Now
this hardwares the packet forwarding hardwares are programmable hardware.

910
So, these are programmable hardware, that means, with the help of this network
operating system, you can dynamically program the hardware so, that you can install the
forwarding rules or you can install the configurations dynamically, based on the network
operating system that you are using. So, the question comes that with this kind of SDN
architecture, where we are gradually moving from a closed innovation network to a open
innovation network, what are the requirements and how will you fulfill those
requirements?

(Refer Slide Time: 06:48)

So, the things come from here. So, this was the broad SDN architecture as we are
discussing. So, we have the infrastructure layer at the bottom. So, this infrastructure layer
have different kind of hardwares like, you have the servers, you can have the open
switches, you can have the top of rack switches, you can have edge routers or datacenter
gateways. Then, we have a control layer in between and that control layer has all the
control functionalities, which are inbuilt inside that. And on top of that, you have
different kind of networking application. The application layer, where you can write
down the network application like, the flow optimizer, the network topology viewer,
network management application, policy enforcement application, load balancer
network, automation network, bandwidth management, whatever application you can
think of and you can design on top of that.

911
So, this control layer, which works like a brain of this entire network, we are making it
logically centralized. So now, the architecture is that we have multiple hardware
components, which are there and all these hardware components are connected to a
central controller. And this controller actually contains the control layer. So, these
hardwares are connected over the network as they are there in the normal network. So,
because these are just a blanket hardware or this does not have any kind of software
inbuilt, we call it as the blind hardware or the open hardware and in case of normal
networking terminology rather than calling it as a router, we call it just like dumb switch.

So, this dumb switch does not have any knowledge about what to do. Neither layer 2
knowledge, non layer 3 knowledge and this controller, whenever you are programming
this controller, this controller will actually configure this dumb switches dynamically, put
the intelligence inside the switch. Now this controller has all these different kind of
module, which can be there like you can have a GUI module, the cluster module to form
a cluster, the layer 2, layer 3 module to implement the layer 2 and layer 3 functionalities
of the network protocol stack, the VPN module to create a virtual private network. The
quality of service module or access control list module to implement access control list
or quality of service, DHCP module to implement DHCP protocol and the plug-ins,
which he called normally as the southbound plug-ins to interact with the programmable
infrastructure layer.

So here, you have 2 different interfaces from the control layer. From the control layer
one interface that talk with the applications different kind of applications that, we call as
the northbound interface and then with the control layer to the infrastructure layer, we
require another interface, which is called a southbound in process. Now the task of the
northbound interface is to understand this individual application layer program, and these
application layers programs are implemented by utilizing your favorite programming
language. So, you can use Python, you can use Java accordingly, you have to choose the
controller.

So, for example, in a typical SDN network if you are familiar with Python, you can
choose the POX or Ryu kind of controller, if you are familiar with Java programming
language, if you want to implement your application using Java programming language,
you can use OpenDaylight controller with support Java programming language. So, you
can write down this application with your favorite programming language and the task of

912
this northbound interface is to understand, what is written inside the application, compile
the application to the corresponding network protocol. And then map it to one of these
modules, which are there inside the controller.

So, you can utilize this module to write your own program say for example with the help
of you can write a load balancer application, where you can utilize the layer 2, layer 3
forwarding module to forward the packet to a specific destination. Now this control layer
from these individual network functionalities, they have to convert it to the rules, the
rules that will be programmed to the router and whenever incoming packet comes that
rule will be executed.

So, from this individual network protocol to the rule conversion, that is done by the
southbound interface. So, we look into the details about, how these rules are being
implemented, and how you convert a particular protocol to a corresponding rules in the
SDN terminology or in the OpenFlow terminology.

(Refer Slide Time: 11:52)

So, what we require in summary? So, to talk between the network operating system and
the corresponding infrastructure, we require an open interface to the hardware.

So that you do not depend on the corresponding vendors to program your network we
require a open interface to the hardware for that. The second thing is that we require an
open API for the application development so, that any application developer can develop

913
a network application. And the third thing is that, we require an extensible operating
system to convert the programs to the routes. So, these applications they are nothing but
a program from that program, we need to map it to the corresponding rule, which will be
executed at that TCAM hardware of the packet forwarding engine, which is there inside
the switches.

(Refer Slide Time: 12:51)

Well. So, what is OpenFlow? So, OpenFlow is a protocol for controlling the forwarding
behavior of Ethernet switches in SDN network. Initially, this concept of OpenFlow was
released by clean slate program at Stanford and currently the specifications are
maintained by open networking forum. So, the interesting fact is here that now this,
entire networking architecture, they are becoming open, they are moving from a closed
community or from a vendor specific community to a open networking community,
where every vendors join altogether.

So, the vendors are building their hardwares and the community is building the open
source operating system and the interface to interact with the corresponding hardware.
So, this helps in 2 ways: first of all, it makes the innovation specific or it makes the
innovation rapid because now this entire software is open to the community, you can
design your own network protocol and test on a hardware for that, you do not need to
search for an hardware of where, you can implement your own protocol, you can
purchase any SDN supported switch, open switch. And then you can do your protocol

914
implementation on top of this open source operating system and the second advantage
comes from the network management perspective, where the network administrator, they
do not bother about reading the 1000 page manuals for from 3 different vendors.

So, they can just concentrate on a specific operating system and then try to write their
own rules on top of that specific network operating system.

(Refer Slide Time: 14:43)

So, in terms of SDN messaging interface as we are mentioning that from networking
operating system to the hardware, we have the southbound interface. Then from the
network operating system to the application, we have the northbound interface that
provides the programming API. And then this network operating system can be
implemented in any open source operating system, there are multiple standard industry,
specific operating systems, which are available nowadays.

You can explore that there are this ONOS operating system, which is very popular
nowadays. There is this Ryu controller, which is a lightweight controller currently many
industries, they are utilizing Ryu controller to write network programs and then other
controllers like Maestro or OpenDaylight.

915
(Refer Slide Time: 15:36)

So, as we are mentioning at the application layer site, you have a programming API in
your preferred programming language at the control layer, you have one of the network
controller ONOS, Maestro, Ryu or OpenDaylight and at the infrastructure layer. You
have this OpenFlow in supported hardware and this southbound interface is controlled by
this open interfacing with the hardware that is the OpenFlow specification that we are
talking right now.

(Refer Slide Time: 16:11)

916
Now, let us look into that how OpenFlow works? So, we have a switch, the entire switch
as we are discussing in the last class, we have the control path, which is implemented in
the software and the data path, which is implemented in the hardware or in small specific
TCAM type of hardware. Now at the control path, we are having a part of the network
operating system to interact the client version of the network operating system you can
talk it, if it is there in this software implementation in the switch that is a kind of very
minimal implementation of the control functionality just a client version of it.

So, that you can talk with the switches and then you have this OpenFlow protocol,
OpenFlow client, which is their inside the switch. So, you can call it as the client version
of the OpenFlow and then you have a OpenFlow controller, which is implemented in a
logical centralized machine and then this OpenFlow messaging API, which normally
uses SSL and a TCP kind of message, which talk with this OpenFlow controller. Now the
thing is that, at the software side inside switch, you have a very minimal implementation,
the client version of the implementation.

So, that you can just receive a message from the controller parse the message and then
configure the switch accordingly, remaining protocols the routing protocols; and all these
things that, you do not need to implement inside the switch anymore.

(Refer Slide Time: 17:56)

So here, is an example of OpenFlow. So, at the switch side you have this OpenFlow
client at the hardware layer, we are maintaining a simple TCAM table.

917
So, this TCAM table has multiple fields like source MAC, destination MAC, source IP,
destination IP, source port, TCP source port, for destiny disappeared estimation port and
the corresponding action that, you want to execute. Now a simple rule looks like this,
from the hardware layer side that, your source MAC is star; that means, it is a wild card
character. That means, you can accept any source MAC field, you can accept any
destination MAC, you can accept any source IP your destination IP should be 128 dot 9
dot 1 dot 10, the source TCP port and the destination TCP port can be anything and if
that is the case then, your corresponding action will be forward the packet to eth3.

So, this entire thing entire target forwarding behavior, we can write it as a match and
action pair. So, we have a rule we this entire rule, that has a component of match. So, we
have certain entries in the tables and then if there is a match then, you execute the
corresponding action. So here, this is one entry in the TCAM hardware table. So, you
whenever you are receiving a packet, you extract the headers at different layers extract,
the source MAC, destination MAC, source IP, destination IP, source TCP port,
destination TCP port, all these fields from the packet header and then make a match with
this rule. So, if there is a match with a specific rule, then you execute the corresponding
action.

So, the action is to forward it to eth3. So, it eth3 means this particular router, where you
want to forward the packet. So here, the message that I want to convey to you is that any
such network protocol or better to say most of the networking protocol, we can
implement in the form of a match action pair, where we will see some examples of that
as well.

918
(Refer Slide Time: 20:13)

So, there is a tremendous power of this entire OpenFlow protocol or OpenFlow


architecture. So, let us see one interesting use case of OpenFlow. So, assume that Bob
wants his own set of network rules to forward his packet.

So, we have a network controller here. So, this is the controller and these are the SDN
switches, which are the dumb switches as we have mentioned.

(Refer Slide Time: 20:56)

Now Bob wants his own forwarding application, say Bob wants to forward a packet from
this router.

919
Say router 1, I am naming the routers as router 1, router 2, router 3 and router 4. Now
bob wants to forward a packet from a machine, which is connected with router 1 to a
machine which is connected with router 4, this is the destination. And Bob wants that the
packets need to be forwarded from R 1 to R 2 to R 4.

(Refer Slide Time: 21:36)

Now, what Bob does? He basically write that this entire thing in a application program
inside the controller. So, the controller combines that program, compiles that program
and after compiling the program, the controller simply deploys Bob’s forwarding rule in
the required hardwares. So, whenever Bob want to forward the packet these forwarding
rules, which are there in the respective switches, they get executed and the packet gets
forwarded.

920
(Refer Slide Time: 21:53)

Now, when Alice wants our own set of network rules to forward a packet, Alice also
program the same controller, write her own application on top of the controller and then
the forwarding rules are installed in the routers on through which Alice wants to forward
the packet. Now here, you can see the interesting things that, all the routers do not need
to have all the rules. So, Bob wants to use this router 1, router 2 and router 3.

So this router or let us not use the term router, let us use the term open switch. So, Bob
wants to use these 3 switches. So, the rules are installed on that 3 switches and when
Alice wants to forward the packet, Alice wants the packet to be forwarded from R1 to R4
to R3. So, the rules are installed in those switches.

921
(Refer Slide Time: 22:57)

So, if we look into the OpenFlow flow table, the OpenFlow flow table has 4 different
component, you have the rule, the corresponding action, certain statistics about packets,
the execution of a particular rule and a priority value, which is associated with a rule.

So, the idea is something that. So, you have a rule. So, the rule is nothing but a set of
fields and that field basically, says that in which particular field of an IP packet or here
actually, in SDN you can look into MAC, IP, TCP, all the headers. So, in your packet
header which particular field to look into. Theoretically you can look into any field
inside the packet header. So, you can look into the packet header and our rule basically
specifies what should be or what is you are interested value for a specific field inside the
packet header? Like the switch port, VLAN ID, MAC source, MAC destination, Ethernet
type, IP source, IP destination, IP type of service for quality of service, TCP source port,
TCP destination port.

Now if there is a match with this rule; that means, with certain fields that, you are
specifying then, there can be a set of actions and the actions can be designed by you
based on your choice. So, the action can be forward the packets to 0 or more (Refer
Time: 24:27) ports in the switch encapsulate the packet and then forward the packet
modifies certain fields in the packet and in forward the packet, drop the packets, if you
want to implement the firewall rule or you can add up your own extension, whatever you
can think of. The statistics fields, it have it maintains certain statistics like the packet

922
counter, the byte counter, number of packets that have been matched with a particular
rule and so on. So, that it becomes easier for you to get the information from the network
and then there is a priority value associated, which is the priority of a corresponding rule.

So, in case of a OpenFlow, whenever you have a set of rules, if there is a match with
multiple rules then the high priority rule is executed in general.

(Refer Slide Time: 25:16)

Here are certain examples of OpenFlow tables; if you want to do a switching you have to
look into the MAC destination field. Because you have to look into the MAC destination
field, so you just make a match with the MAC destination, you can ignore other fields.
So, we put it as a star as a wildcard character, if there is a match with this particular
MAC address, you forward it to Ethernet 2, it behaves like a normal layer 2 switching
mechanism. If you want to implement a firewall, you look into that TCP destination port,
if TCP destination port is 22, then you drop the packet.

So, that is the corresponding firewall rule. So, you can design your own firewall rule like
that. So, look into certain fields in the packet header, if there is a match with those fields
of the packet header then you drop the packet.

923
(Refer Slide Time: 26:12)

Then forwarding, to forward a packet rather than looking into the MAC destination, you
look into the IP destination, if your IP belongs to this subnet (Refer Time: 26:22) 202 dot
2 dot star dot star, you forward the packet to Ethernet 2, you can make a flow switching,
which is interesting. That means, this flow switching with the help of flow switching,
you can make a convergence between the packet switching network and a circuit
switching network. So, the idea of the circuit switching network was to use specific path
for a specific flow.

Now, by looking into multiple fields in the packet header like the MAC source, MAC
destination, Ethernet type, IP source, IP destination, TCP source port, TCP destination
port by looking all these individual fields, you can actually uniquely identify a process to
process flow, because you are also associating the TCP source port and the destination
port. Now for that particular flow, you can make action that forward the packet for this
particular flow to this switch. So that means, you can make flow specific forwarding or
flow specific routing of the data. So, that is a huge power of SDN based network.

924
(Refer Slide Time: 27:27)

Then you can do the source routing, source routing, where if the packet is coming from a
specific source and it is destined to a specific destination then you use a specific part. So,
you put source IP, the destination IP, if the packet is coming from a subnet at 16 dot 2 dot
3 dot star and if the destination is 202 dot 2 dot star dot star, the action is forward the
packet to Ethernet 2. You can do the VLAN switching although, till now we have not
discussed about, what is VLAN, virtual LAN. Virtual LAN is basically given a packet a
set of packets. If you want to send a set of packets or a packet to a specific destination,
you can forward the packets into multiple ports of the switch, which constructs virtual
LAN.

So, later on we will look into the virtual LAN in details, but with the help of these
OpenFlow rules, you can specify the virtual LAN ID, the corresponding MAC
destination and the action is forwarding the packet to 2 different port eth 2 and eth 3; that
means, eth 2 and eth 3 are actually connected to virtual LAN 2. So, the packets will be
forwarded to those interface only.

925
(Refer Slide Time: 28:48)

Now these are the examples of some of the OpenFlow rules, you can design your own
OpenFlow rules and the corresponding action, the entire innovation is open. So, anyone
can contribute there, let us look into the messages, which are there in general OpenFlow
the messages, which is shared between the controller and corresponding switches. So,
this communication, as you are mentioning they are done via TCP. So once, you have
made a TCP connection between the client version of the switch and the controller, the
OpenFlow, hello messages are exchanged between the controller and the switch.

So, they negotiate the OpenFlow version, the higher version is used and this here, certain
parameters like what are the different configuration parameters you want to share? Then
the controller sends a OpenFlow featured equation message, the feature request message
to get the data part idea of the switch and determine, what features are supported by the
switch? Say for example, whether the suite supports QoS space forwarding or not. Now
based on the application program, you can send certain OpenFlow messages for switch
configurations to update the flow to increase to modify the flow entries or to install a
new flow entries.

926
(Refer Slide Time: 30:12)

There are some other messages like to check the connection aliveness, whether the
connection is alive or not, OpenFlow can send an echo request. An echo reply messages,
they can be sent from the controller to switch to check the aliveness of the switch or the
switch can send it to the controller to check the aliveness of the controller. Now to group
the flow entries, if you want to group multiple flow entries together, these groups are
configured by the controller to this group configuration messages that can be stored into
group tables inside switch. So, OpenFlow has the power that, you can combine multiple
rules all together and create a group of rules.

So, the messages are there to support that group creation. To get the statistic details from
the switch, you have this OpenFlow messages like flow stats, port stats, queue stats,
group stats, table stats, all these things that can be sent from the controller. So, that is
another advantage like from the controller, you can get the statistics from the switch and
you can look into the individual statistics that for a particular flow, how many packets
has been transferred? And based on that you can also configure the switch for restricting
the bandwidth for a particular flow; so, you have as a network administrator, you can get
a tremendous power to control your network.

Then, there are certain asynchronous OpenFlow messages like flow rule removal from a
switch, configuration apply fail error from the switch, port up down status from the
switch, whether a particular port is up or down etcetera, that can be sent from the switch

927
to update the controller. So, if a particular port from a switch is down, the switch can
send a message to a controller to let it know, that this particular port is now down; so that
the controller can design a fail safe mechanism for forwarding the packet.

(Refer Slide Time: 32:04)

So, this is the entire a brief introduction about OpenFlow. So now, what is happening?
The entire power is in the hand of network programmer or the network administrator, the
network administrator controls the entire controller write down his or her own program
in the controller and this OpenFlow helps configuring the switches.

Now, whenever you are receiving a packet, the packet has the payload and header, you
look into the header based on the header filled, you make a match with the corresponding
rule and then send the packet in the based on the action, which is there, which is
mentioned in the corresponding OpenFlow table. So, the rules in the OpenFlow table
inside the switch, they are implemented as a part of the TCAM hardware. So, TCAM is a
programmable memory, where you can dynamically program that particular hardware to
install the rules.

928
(Refer Slide Time: 33:16)

So, this is a very brief introduction of OpenFlow. We will go for certain demo of
OpenFlow in the next class. Before going to that, so I am just giving you certain pointers
that, you can explore yourself to look more details of this entire open innovation in the
networking community. This is a kind of advanced topic in network and you should learn
that because, people predict that our future network is going to be SDN controlled.

So, there is a link for open networking foundation, where you can find out the different
standards, different agendas which are there under the open networking foundation, the
OpenFlow specification the current version is stable version is 1.5.1. You can look into
the different messages, their messages type, their functionality, all these thing. The
ONOS, ONOS is an popular network controller, you can look into the ONOS details, it is
open source thing again, you can just install it in a single machine and start using it, there
is another SDN controller called Ryu, I suggest you to look into the Ryu controller as
well.

So, these are all open source tools, you are free to download them, free to use them. So,
explore them. That’s all about the course today.

Thank you all for attending the course. Happy learning.

929
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 45
Software Defined Networking – III ( Demo )

Welcome back to the course on Computer Network and Internet Protocols. So, in the last
classes we are discussing about this software defined networking concept. So, today we
will see then implementation of a Software Defined Architecture, Software Defined
Networking architecture and in our network emulator platform called mininet and we are
talking about these OpenFlow protocol. So, we will see that how you can utilize this
OpenFlow protocol on top of our mininet architecture to send or receive packets or to
emulate our network topology inside your computer. So, let us have our journey on this
mininet and OpenFlow controllers.

(Refer Slide Time: 00:59)

So, till now we have earlier looked into different socket programming aspects. So, you
can actually in mininet you can run all these different socket programming and see that
the packets are actually traversing in the network.

930
(Refer Slide Time: 01:15)

Now to capture the packets in the internet, we have a nice traffic analysis tool called
Wireshark. So, let me first show you a demo of this Wireshark and see how you can
actually capture the packets and analyze individual packets in the network.

(Refer Slide Time: 01:34)

So, here there is this Wireshark interface. So, let me just open it from the scratch, so that
the things become easier for you. So, we opened a Wireshark tool.

931
(Refer Slide Time: 01:54)

So, in that Wireshark tool, this is the Wireshark home screen ok. So, here you can see all
the interfaces which are there in this machine, where you will be able to capture the
packets. Now this particular machine it is connected to the wireless LAN.

(Refer Slide Time: 02:15)

Here you can see it is connected to this academic SSID to the Wi-Fi router. So, we use
this WLAN 0 interface, where it is receiving some packet; here you can see that there is a
small graph which is going on. So, it basically capture the packets which are there.

932
(Refer Slide Time: 02:40)

So, let us start capturing the packet in WLAN 0 interface. So, here it is capturing the
packets in WLAN 0 interface.

(Refer Slide Time: 02:48)

So, we will open some website. So, let us refresh this Google website or go to the Gmail
website, so that we can get certain packets. Now come back to the Wireshark, stop the
Wireshark interface and here you can see all the packet. So, you can see there are lots of
packets where the protocol field. So, here we have the protocol field the protocol field is
GBSP. So, this GBSP is something called GIGE vision protocol which is used in

933
TeamViewer kind of application which currently I am using for recording. So, it is
capturing lot lots of such packets GBSP kind of packet it should also capture certain TCP
packet.

(Refer Slide Time: 03:34)

So, here is some TCP packets you can see so here are the TCP packets. Now whenever
you are selecting one of these packets. So, let me choose one packet here.

(Refer Slide Time: 03:50)

934
So, the protocol it shows us TLS version 1.2 which is the transport layer security
encrypted TLS encrypted packet. So, the Google whenever it sends the packet over the
TCP protocol, it uses TLS to ensure the security at the transport layer.

(Refer Slide Time: 04:11)

Now, inside this packet if you look into this second window, this second window actually
gives you the packet details at the different layers. So, this is a nice way to visualize the 5
layers of the TCP/IP protocol stack. So, here let us start looking into again this top down
approach the way we are following the course.

So, where you can see that you have this SSL packet which is the encrypted data bits that
we have, after that we have these HTTP header. So, in that HTTP header we are
connecting to a proxy just contains the proxy information, because the packets that we
are sending from this machine, it is sent to HTTP proxy server, and from that HTTP
proxy server it is going to Google.

So, the packet which is sending to Google it is inside that secure socket layer that layer
which is the encrypted data. So, you can see that it contains this application data protocol
it says about HTTP over TLS. So, here it gives the application data the TLS version 1.2
the length, and the encrypted application data, so this is the encrypted part of the
application data. So, there are three different TLS record blocks. So, the entire data is
divided into three different TLS blocks and that contains the entire application data. Then
this HTTP extension which contains the proxy information, then we have the

935
transmission control protocol at the TCP port. So, you can see that the TCP details are
there. So, here my source port is 8080, the destination TCP port is 54768, the stream
index is something like 1, the single stream the segment lane it contains the TCP
sequence number that we have seen for the transmission control protocol, the next
sequence number, the acknowledgement number, and the header length, certain TCP
flags.

So, in the TCP header there were multiple flags. So, those flag bits are here the window
size the receiver advertised window size, and accordingly the calculated window size.
And the checksum field, the urgent pointer, then the TCP option field, and the sequence,
and the acknowledgement field.

(Refer Slide Time: 06:38)

Then you can look into the IP header. The next header is the IP header. Inside the IP
header you can see that the source address and the destination address. Now the source
address that I have 172 dot 16 dot 2 dot 30 that is the IP of the proxy address that we
have in our IIT Kharagpur network. And the destination address is 10 dot 146 dot 58 dot
130 that is the address of this machine.

936
(Refer Slide Time: 07:07)

So, if you if you just try to see the IP of this machine you can see that say so in the
ethernet address the loopback address well. So, here you can see that the WLAN address
is it is connected to the wireless LAN interface. So, the address is 10 dot 146 dot 50 dot
130 the address of this machine. So, here also the destination address is 10 dot 146 dot
58 dot 130 the address of this machine. So, the packet has been received from the HTTP
proxy that we have IIT, in IIT Kharagpur to this machine and the different field in the IP
header. So the IP header length the flag bits in the IP header, the fragmentation
information. Then the upper layer protocol, so it is using TCP protocol, then the source
destination, this IP layer header information.

937
(Refer Slide Time: 08:28)

Then you have this ethernet information. So, the ethernet information you can see from
here and finally, the link layer information.

(Refer Slide Time: 08:34)

So, the data link layer has two sub part the logical link control and the MAC. So, this
frame information that is coming from the MAC and this ethernet information coming
from the LLC. It contains the packet arrival time, the epoch time, the frame length and
different other fields which are there to indicate the link layer information. That way
using Wireshark you can actually look into different type of packets say for example, you

938
can see that this is a TCP SYN packets. So, it is marked as a SYN. So, if you look into
the TCP header for this packet, well yeah the TCP header.

(Refer Slide Time: 09:24)

So, if you look into the TCP header for that packet you can see that the SYN bit is set.
So, it is basically a SYN packet to initialize the TCP connection. So, you can see that a
SYN is so here you can see interestingly the TCP three way handshaking mechanism. So,
the SYN packet has been sent with sequence number 0 and certain window size, then
you can see a SYN ACK; then followed by another ACK. So, this three way handshaking
is happening here.

So, that way using this Wireshark tool you can actually capture all the packets which is
coming in your machine. And you can analyze them you can see what are the different
packets coming to your machine and how to process those packet look into different
header fields at a different layer of the protocol stack and explore it further ok. So, that is
brief idea about how you can do the packet analysis using Wireshark ok.

939
(Refer Slide Time: 10:29)

So, next we will look into that how you can emulate a computer network in a single
machine? So, that is the emulator platform which is again is a SDN based tool that we
are going to discuss in little details. So, in computer network the best way to learn a
computer network is experimenting it on the existing network so that is always.

So, if you run your own protocol if you say design a protocol implement it and make a
run on a on your network, so that is the best way to do. But the problem is that if this
kind of existing network it may not be available for everyone. So, to get access to an
existing network is a difficulty.

So, some time it may happen that you have a limited access to the network. For example,
we have certain limited access in IIT Kharagpur network you cannot run anything over
the IIT Kharagpur network. Because it is a public network and if you want to design your
private network or want to set up your private network it is expensive to make a setup of
your private network. So, that is why what we do? You try to emulate a network topology
in a computer.

So, there are multiple simulation platform which has been used historically to understand
the behavior of a computer network. But simulation platform has many limitation
because it is not using the exact protocol stack which is running inside your machine. So,
that is why many of the time a simulated network does not give you an ideal information

940
about how your protocol can perform in a real environment. But on the other hand the
emulated network has that capacity.

So, in a case of a emulated network the difference from the simulated network is that you
are not simulating in a hypothetical, or a virtual environment rather what you are doing?
You are utilizing the network protocol stack the implementation inside the kernel itself
the actual implementation which is going to run in a real network. And on that emulated
platform you are testing that how the performance of your network is going to be. So, the
advantage is that it is independent of the existing network and it can be set up as required
ok.

(Refer Slide Time: 12:38)

Now, here are the different parts or different components of computer networks in a
physical network. So, you have the routers, you have the switches, you have different
host and the server and you have the link.

941
(Refer Slide Time: 12:53)

Now, in a virtual domain, or an emulated domain whenever we are emulating it using


this mininet platform. So, we call mininet as a network inside the computer, a emulated
network inside the computer. So, these routers are implemented using called something
called a virtual namespace for legacy network or Open vSwitch for software different
given network.

So, Open vSwitch is a tool chain which provides switch implementation in an open
platform, open platform, or open source platform. You have that Open vSwitch
implementation and using Open vSwitch you can emulate a switch using the kernel
protocol stack which is there in your Linux operating system. Then a switch can again be
emulated using a Open vSwitch platform, host can be emulated using a virtual
namespace, a namespace is basically instance of the protocol stack which works like a
individual hosts.

So, you have this entire protocol stack implementation inside your computer. Now you
are creating a virtual instance of that protocol stack and emulating it at as an individual
host. So, this entire architecture you can just think of the way we do the operating system
level virtualization. So, I think that you have heard about this kind of virtual machine,
and the tools like virtual box.

So, in a tool like virtual box what we do? We do the operating system level
virtualization. So, you have this virtual box on top of you can have multiple vms which

942
are running, and inside every vm you can run one different operating system. So, one vm
can host a ubuntu operating system, another vm can host a say windows operating
system, a third vm can host a fedora operating system. And all this thing can run on top
of a host operating system.

In a similar way here we are emulating the network using this virtual namespace, and a
virtual switch concept where the network protocol stack implementation is there inside
your kernel. And we are creating a virtualized instance of that protocol stack. So,
whenever you are creating constructing a virtual host; that means, you are creating you
are taking a virtual instance of the entire TCP/IP protocol stack of the 5 layers and
considering it as a virtual namespace. So, the term namespace actually indicates a virtual
instance of this end to end protocol stack.

So, you are taking a virtual instance of that and considering it as an as an a individual
host. Now if we are going to implement a switch or a router then at the layer three of the
protocol stack you need to run the routing functionalities, or at layer two of the protocol
stack you have to run the switching functionalities, or layer two functionalities, so that
you can implement with the help of this Open vSwitch.

So, the Open vSwitch will adopt the virtual switching functionalities or the routing
functionalities on top of that namespace the protocol stack namespace. And then you can
emulate the links the physical links using virtual links.

(Refer Slide Time: 15:49)

943
Now, this is a kind of simple computer network in the physical domain you have one
host which is running say a browser like Firefox, it is connected to a network switch or a
router that is again connected to a HTTP server. So, using the browser you can browse
the data from the HTTP server.

(Refer Slide Time: 16:08)

Now, the same thing you can implement inside a single machine. So, here you have your
Linux kernel; in that Linux kernel you have this Open vSwitch kernel module which runs
the switching functionalities by taking a virtualized instance of that TCP/IP protocol
stack and then you have two different namespaces host namespaces. So, these two
different host name paces, again have a virtual instance of these 5 layers of the TCP/IP
protocol stack, and they are in the application site you are running a Firefox, then you
have a Linux kernel which has this virtual implementation of the protocol stack and then
the ethernet 0 which is a virtual link which is connected to this Open vSwitch kernel
module.

So, it is connected with this logical switch at the virtual switch and the other host name
space you have HTTP server running at the application and the remaining part of the
protocol stack along with the virtual link through this eth 0 which is being connected. So,
that way the physical network you can implement in a machine using this virtual instance
instances of the network.

944
(Refer Slide Time: 17:16)

So, now how you can create such kind of topologies in a network in a computer, we can
use the mininet tool I will show you a demo of that mininet tool, but before going to that
just showing you some simple comments inside the mininet tool.

So, this mininet tool you can this is a open source tool, you can install it from the mininet
website. So, from the mininet website you can even get the image under different kind of
operating system or you can also get the source, you can compile it from the source and
install it to your Linux based machine. So, in the mininet command if you type the
command like mn mn is corresponds to the mininet minus topo single 2 what it will do?
It will create a topology like this; it will have a single instance of the switch and two
different hosts.

So, if you make it mn minus minus topo, single 3, then you have a single switch with
three different hosts. If you make it as mn minus minus topo linear 3, it will create a
linear topology of the three switches and one host will connect with each of the switch.
So, this is the topology corresponds to that.

945
(Refer Slide Time: 18:27)

And then if you want to create say a complicated topology, so, here what we are doing
that we are creating a topology like this linear 2, 3 and this is a kind of SDN topology
that we are going to implement. In the last lecture we have discussed about this SDN
architecture we have the switches, and the switches are connected to a controller. So, that
thing we are going to emulate here using this SDN mininet networking platform.

So, what we are going to do, we are having this mn minus minus topo; linear 2, 3, linear
2, 3 means you have a linear topology of two switches which are being connected and
three host are connected with every individual switches, and then we have specifying
minus minus controller equal to remote. That means, we are having a controller which is
there in the remote machine and that controller is connected to the switches. Now in that
controller you have to load individual controller software.

So, in the last class we are discussing that there can be multiple such controller platforms
like Ryu like that porks like open daylight, like floodlight, there are different kind of
controllers you can pick up your favorite controllers and attach it with this virtual
controller that you are designed. And then with that virtual controller you can actually try
to do the experiments by setting up by writing your code inside the controller, by writing
your network application inside the controller and then running it over this kind of
emulated network. So, now let us go for a demo of this entire procedure.

946
(Refer Slide Time: 20:04)

So, what we are going to do is first we,

(Refer Slide Time: 20:09)

so, so, first we will run a mininet instance with we create a topology of a single switch
and three different host. So, let us do it pseudo mn minus minus topo. So, you have to
run it is in the pseudo instances, because it run as a Ryu you are going to access the
kernel protocol stack.

So, that is you require the root access, single comma 3 the way I have shown you earlier
like we have a single switch with three different hosts connected to that switch. Then

947
minus minus mac, minus minus controller remote, minus minus switch ovsk. So, here it
says that I am going to have a controller which is now going to connected with the
switch and those which are of type ovsk switches.

So, I have to give the root password oh sorry I have made a typo here it should be
controller ok. Now you can see here what has happened first whenever it is trying to add
the controller, it was not able to contact the remote controller at the local machine. So,
we are saying that we are going to run the controller in the local machine.

So, the controller normally runs in two different out of the two different port 6653 or
6633. So, it is searching for the controller, but currently we have not executed any
controller. So, it was not able to find the controller and it has added three different host
h1 h2 and h3 and added a switches called s1 and the links are h1 to s1, h2 to s1 and h3 to
s1 a kind of star topology. So, three hosts are connected to one switch.

So, it has configured the three hosts, started the controller, but the controller it was not
able to connect and one switch has been started. So, now, you got the mininet console
here, now from that mininet console if you try to say ping something. So, we make the
command as h1 ping h2.

So, whenever we write h1 ping h2; that means, from the virtual namespace of h1, the
protocol stack which is there the actual protocol stack which is there from there we are
going to execute the ping command and we are trying to ping the host h2. So, here if you
try to ping it you can see that it is not getting pinged.

948
(Refer Slide Time: 23:22)

So, it says that the destination host is unreachable.

(Refer Slide Time: 23:29)

Similarly, if you try to ping from say h2 ping h3, none of the machines will get pinged it
says destination host unreachable.

949
(Refer Slide Time: 23:46)

Now, let us run the controller. So, what will do under this mininet directory, we have we
are going to use the Ryu controller.

So, we are going to the directory Ryu and starting the controller. So, ovs vsctl. So, this
ovs vsctl command is used to start a controller and attach it with a corresponding ovs
switch set bridge, we are trying to set the controller in the bridge mode and it will be
connected with s1. So, s1 is going to work as a bridge mode with which the controller is
getting connected then protocols equal to OpenFlow 13.

So, we are specifying that we are going to use OpenFlow version 1.3 as my protocol
smrl. So, the password now we are going to start the controller. So, what we have done
here we have with this ovs vsctl command with this s1 which is working as the bridge
mode with that we have configured it with this OpenFlow version 1.3 protocol stack,
now we are going to run the switch run the controller. So, to run the controller we are
going to Ryu manager, going to run Ryu manager in the verbose mode.

So, that we can see what is going to happen here and the controller program that we are
going to run. So, on the controller you have to run certain applications. So, that
application will take care of configuring your switches that we have learned in the last
class, it will configure the switch and it will install the forwarding rules inside that
switch.

950
So, here we have written a python script, which is actually a default python script used
inside the Ryu controller and that python script actually works like application of a
forwarding manager. It helps you to forward the packet from one machine to another
machine. So, we are going to run that one, it is simple switch with version 13 dot py. So,
that is the python application which you have written or indeed it was a default
application in Ryu; once you install Ryu you can get that as well. So, that particular
application we are going to run here ok.

(Refer Slide Time: 26:33)

So, it has executed that one, and after that it has getting connected with the
corresponding switch now, let us try to run it; h1 ping h2.

951
(Refer Slide Time: 26:48)

Now you can see it is getting pinged and when it is getting pinged let us look into few
events which are happening here.

(Refer Slide Time: 27:03)

Here you can see there was some event which has been locked. So, this event you can
see certain packets are coming to the controller and based on that packet, it is
configuring the corresponding switches.

So, the controller events are being logged here.

952
(Refer Slide Time: 27:23)

And here it is getting pinged and we have an interesting observation here, if you look
into the response time of the switches. So, you can see that the first packet that was sent
it has a longer time. It it has taken a time of 4.84 milli second whereas, the remaining
ping packet it has took around 0.16 millisecond and 0.03 millisecond, 0.02 milliseconds
something like that, but the first one has taken certain more time why that is so?

If you remember in the last class that I have discussed, that how this entire controller
architecture is going to work for the first packet whenever it reaches to the switch, the
switch does not have any information about how to process that packet or how to
forward that packet. So, what the switch has done the switch will send or generate a
OpenFlow event, which will reach to the controller. So, the event we can see in the other
tab the OpenFlow event that have been generated.

So, this OpenFlow events will be generated and it will be sent to the corresponding
switch, and then that particular switch will send that event to the corresponding
controller, the Ryu controller application that we are running. So, that particular
application the switching application, it will generate the rules and configure the switch
with that particular rule and then the packet will get forwarded and during that in
between time, the packet will remain inside the buffer of the switch.

So, for the initial packet we see a certain longer delay for, but for the remaining packet
that delays are less.

953
(Refer Slide Time: 29:01)

Again if I run it, you can see that the delays is comparatively lesser. Only for the first
time it has took that initial longer time. Similarly now in this case if I run it in a different
case.

So, earlier I have done h1 ping h2, now say run it from the h2 host.

(Refer Slide Time: 29:25)

So, if we run the ping from h2 host to h3, again you can see that the first packet has took
some longer time to forward the things. So, that way you can actually run this entire

954
controller and the switches and emulate the topology by using this mininet emulator
network emulator platform.

(Refer Slide Time: 29:44)

Now, briefly and you can see here that all these events have again executed for different
nodes. Now let us look into the application that we had written in python. So, I will
quickly show you the application which is there.

(Refer Slide Time: 30:06)

So, inside the app directory you can see that there are multiple applications which are
there. So, you can actually play with these applications which are there and then will

955
start writing your own application using this python programming. So, simple switch 13
dot py ok.

(Refer Slide Time: 30:30)

So, here what we basically do? A simple switch thirteen class has been defined and
inside that, we are defining different functionalities. The initial the initial functionalities
the a switch feature handler which handle different features inside the switch and then
the interesting part is this add flow things.

(Refer Slide Time: 30:50)

956
So, this add flow will add a new rule corresponds to a new flow. So, what it will do. So,
this add flow it will call this packet in handler.

(Refer Slide Time: 31:07)

So, this packet in handler actually handle one OpenFlow packet. So, whenever our
packet in event occurs; that means, a packet is waiting at the switch and you have
received that packet in event at the controller side.

(Refer Slide Time: 31:23)

957
So, what we are actually doing. So, you can see that we are extracting the port; we are
extracting the packet parameters, the packet equal to packet message the data then the
ethernet header.

(Refer Slide Time: 31:35)

From the ethernet type, we are looking into the type and then we are taking the source
address and the destination address from the ethernet interface. We are looking into the
data part id and then generating the forwarding rule. So, here the forwarding rules are
generated.

So, we are learning the MAC address. So, here we are doing the forwarding. So, the
forwarding is dumped at the MAC address, in the later lecture you will learn how to how
you can use MAC address for do the forwarding. So, these forwarding rules are being
generated.

So, based on that we are generating the output port; so, where the packet will be
forwarded next. And accordingly the action has been defined and then we are installing a
new rule to in the switch.

958
(Refer Slide Time: 32:25)

So, these new rules or this with this with this add flow command in the data path, the
new rule is being installed inside the switch.

(Refer Slide Time: 32:34)

So, then we are making a packet out event.

So, this packet out event will actually send the information from the controller to the
switch and it will send that message to the data path from the data path. So, that way so,
it has it is own construct you have to learn that what are the different functions or

959
different classes which are being available in the mininet and accordingly try to learn this
program.

So, so, I will suggest you to explore this further to explore this code if you are familiar
with the python language, and start a, with playing with this kind of code. And if you are
not familiar with python language, do not worry there are other controller as well.

So, for example, there are this open daylight controller which is written in java, you can
try with those controller as well. So, you can choose your controller which is preferable
to you and start playing with that.

(Refer Slide Time: 33:32)

So, that is something we wanted to discuss in this particular class.

So, hope you got an idea about how to process these entire things and run a SDN
controller in your local machine. So, I will I will suggest you to play with this mininet
emulator platform and the different kind of protocol that you are learning execute it on
top of that.

So, you can even execute a socket programming from this individual host, just like we
have executed the ping application. You can run your socket programming application
and run it here. So, explore it further. So, hopefully you will get a nice understanding or
nice insight of this network protocol stack so thank you all for attending this class.

960
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 46
Data Link Layer-Overview

Hello. So, we will continue our discussion on Computer Networks and Internet Protocol.
Today we will be discussing on Data Link Layer rather will be having a series of lectures
discussed on data link layer. So, as we have seen that data link layer is the one of the
predominant layer in both ways OSI TCP/IP protocol stack, it is in the level 2 or layer 2
in the stack.

And as we are coming in a top down approach, so we have discussed on application


layer, then transport related transport layer, network layer then now the data link layer
and then we will go for the physical layer. In some of the literature or some of the
references you will find that data link layer and the physical layer added together
because, there are a lot of specially the IEEE 802 stack consider them together.

So, there is there are both way it is there. So, what we will see we will try to look one
after another, but no harm in looking them together also.

(Refer Slide Time: 01:26)

961
So, we will just come back to our that slides which we have seen much earlier at the
beginning of the lecture. So, if you look at the OSI protocol stack, these are the 7 layers
and if we refer to this data link layer, the transfer of unit information framing and error
checking or error and flow control is one of the major aspects. And down the below is
the physical layer which is basically transmission of the binary data through the medium.
So, this is our protocol stack.

(Refer Slide Time: 02:02)

So, and if we again if you recall, so if we see that they if 2 end systems a and b are
communicating, so a application say email application or HTTP (Refer Time: 02:15)
applications when it goes through, it goes through the stack and finally, push through this
physical and then goes to this is a layer 2 switch, there is a layer 3 switch or a router
again a layer 2 switch and go on.

There can multiple hops of the things finally, it is another application that if it is the
email, there are this email application going on, this peer applications talks to each other
or any applications going on peer applications over the network talks to applications
talks to each other.

Now, one as we know or we have already discussed that intermediate layers,


intermediate these devices are open up the layer or the packet up to which it is enabled
right. In other sense, this is the whole stack of things like applications data pay load goes
to the transport layer as a pay load then the with the header etcetera goes to the network

962
layer as a payload then, the data link layer physical layer and when it is going coming to
the layer two switch which understands of the data link layer it is it opens up to the data
link layer and see that where need to be forwarded, goes to the this one and go on so
long, it is not reaching the end system right. So, that allows us to achieve inter
operatibility right.

So, we can have intermediate switches and routers of different this is layer 3 capable
(Refer Time: 03:45) or layer 1 to layer 7 capable devices which open up the packets up to
this and check that where things to be which to be moved. Couple of things we want to
put into want to discuss or just to recap that when we look at a network layer, so it
divides the network right like, IIT Kharagpur is a network then say some other say IIT
Bhubaneshwar, IIT Delhi the other pre universities and type of things if we look at the
academic institution these are the different networks and type of things.

So, there is an router which goes on the things right. Also we have discussed about
autonomous systems and traffic moving from one autonomous system to other.
Nevertheless, if you see where if we want to send some data there should be a physical
connectivity; it can be wired, it can be wireless, it can be something line of sight or it can
be through satellite or something right, but there should be a medium by which the
transmission should be done right.

So, whatever you want to transmit, it need to come to the down level right. So, if we look
at that if we look at the last 3 layers, so if we look at the at the network layer it divides
the network or in other sense, as we have discussed it divides both the collision domain
and the broadcast domain right. The broadcast is not heard by the other side of the
network neither the collision things are there.

If you look at the layer 2, it basically in the same broadcast domain, but nevertheless
they divides the collision domain. So, it gives us a better efficiency. If we look at the
layer 1, then it is in the same collision domain and broadcast domain, so the efficiency is
much less. So, what we are trying to primarily focus on this couple of or series of
lectures is that what are the different things what we go to the layer 2 type of device.

So, just to again remind you that if a router is sending a packet to another router right,
the logically it is in the network they can it has to find out, but nevertheless finally, it has
to come to this layer 2, find out that layer two addressing scheme and go push to that

963
particular other interface of the router. So, even 2 layer 3 devices when you have to
communicate, it has to come down to layer 2, look for the layer 1 for the physical media
and get the things transmitted right.

So, it plays data link layer is inevitable as in some references we have told, we will be
again discussing those things. There is a protocol called address resolution protocol ARP
by which, I this is a intermediate protocol what we say that between a layer 2 and layer 3
which given a IP address it find out what is the layer 2 address or the MAC address at the
MAC address, so that it can be transferred to the next thing right.

(Refer Slide Time: 07:01)

So, if we look at the protocol stack, so this data link layer and physical layer sometimes
considered as a combined layer, where the predominant protocol is the Ethernet. There
are other protocols, but the predominant protocol here is the Ethernet protocol.

964
(Refer Slide Time: 07:26)

So, if we see that the data link layer. So, above it is the network layer, down is the
physical layer again I am repeating some of the configuration we take that data link and
physical layer together. And if we look at the data link layer little deep, so what you see
that it has 2 sub layers; one is MAC sub layer another is LLC sub layer, that is Medium
Access Control sub layer and Logical Link Control sub layer.

So, one sub layer that MAC is primarily for looking accessing the media that how the
access mechanism should be there and logical link control is more of the it defines the
service access point with the upper layer. In differentiating these 2 allows the thing that
there are different MAC mechanisms or protocols can be used for the for a given LLC
and type of things right. So, this is 2 aspects of the manageability.

965
(Refer Slide Time: 08:21)

So, like just to pictorically show you, so network layer, so this LLC sub layer and the
MAC sub layer right and this is the physical layer. So, they take care of that connectivity
with the upper layer and the down layer, means layer at the bottom of the things right.
So, again just to repeat, we have 2 applications which at it may be running at different
systems of the same systems for our consideration we say that over the network it is
running. And then these applications how they will transmitted will be through the
transport layer. So, transport layer identifies the process of the 2 things.

So, we require the IP address plus (Refer Time: 09:05) port, what we have discussed
while discussing on the socket forming a socket connections IP address and port. We
have then the network layer, which find out the logical connectivity with the help of the
IP address. We have that data link layer, which is a hop to hop connectivity right, that
every hop the next data link layer address need to be resolved or the MAC address need
to be resolved, packet need to be passed to the things like if I have a n number of routers
in my path then every router i to i plus 1, the address of the router i plus 1 need to be
resolved. Or find out that what is the MAC address or the layer 2 address or sometimes
known as the hardware address push this traffic to the next hop and it goes on the hop by
hop connectivities. Or as in commonly say, that it is within that local area network
connectivity, it is in the same broadcast domain, but the collision domain where is a
different collision domains.

966
(Refer Slide Time: 10:10)

Now, there are some of the issues, challenges, problems what we say like one is the
sharing the wire right. So, I can have 2 things to connect a host, one where connecting a
host like we will see that if I have two machines which wants to communicate, I may not
required so much, so much layers of network. I can have a wire which can physically
connect the resource and I can have a say swap of the trans receive things (Refer Time:
10:42) and it can be connected right. But if I have more host than the connection will be
somewhere like that right or it will be everybody is connected to everybody, this is
switch network this a type of thing.

So, whether I can how to share on a wire; that means, whether I can have a bus and then
go on connecting systems on the bus right. So, I have a sort of a backbone bus and then
connectivity on the thing. So, that is one issue.

967
(Refer Slide Time: 11:12)

Other issue usually what we find that when we talk to when we discuss that somebody
talks others listens right. So, listen before you speak or right it can be things.

(Refer Slide Time: 11:29)

But, it may so happen that if you do go on simultaneous speaking right. So, this is the
another challenge right. So, there will be collision and requirement we need to speak out
what we are talking again, so you have to speak out again and which results in
retransmission, if there is a retransmission then there is a loss of bandwidth right.

968
So, on a particular given time, you how much things you could have transferred, if you
are going on retransmitting that is effectively you are delaying or loosing or in effective
trans you are losing that right (Refer Time: 12:03). So, in other sense, if there are multi
party term which is which may be a case when we share a things like this right, when
there is a common bus you have number of systems then what we see then that may be a
scenario of collision right.

(Refer Slide Time: 12:25)

So, another issue, so there will be a issue of collision, another issue recipient of the
packet need to put an address on the packet. So, there should be an addressing scheme
right. If I want to transmit from here to here or this fellow transmitting to other fellow or
same fellow there should be addressing scheme to identify the identify the destination.

So, need to a address of the packet, so what should be the overall format and type of
things that is issue or there is a something to be resolved. How do you know that what
address you want to send it to right, I have a logical address right. I know that logically I
know that that thing which will be the physical address or which address I need to send
those things need to be I need to know right. So, that is this is other challenge.

969
(Refer Slide Time: 13:32)

So, if you look at the data link layer, they need to resolve these things. So, if we now
come to the medium access and medium access control, so MAC sub layer is primarily
used in broadcast and shared channel network. If I have a peer to peer network, it may
not have that much utility right because, if it is a point to point connectivity, then I do not
have that type of utility.

MAC protocol enables two station on nodes using a shared communication resource to
establish maintain and terminate connection right. So, it is a protocol which is when 2
nodes or 2 given 2 stations systems wants to communicate to each other they shared a
media and they want to communicate with each other and then MAC protocol should be
able to establish, maintain and terminate a connection.

So, it should have a way to connection establishment, maintenance and terminating.


Something analogy you will find in case of our connection oriented service in the
transport layer, where also we have this sort of a stuff that need to the connection
establishment then maintenance and termination. Also you might have seen or look at the
things where you look at the socket type of things, where these things are required.

Those are analogy, but there also we require a things to be communicated right, so things
are there. And there can be different type of scenarios, the predominant is the Ethernet
what we are using, it can be through cellular connectivity, even it can be through your

970
satellite connectivity right, so or any type of media which allows you to connect through
this through some media.

(Refer Slide Time: 15:24)

And if we look at the standard IEEE 802 is the predominant standard which are which
are used or which are practised these days over across the world. And if we look at so, if
we look at that OSI or TCP/IP layers per say if you look at the physical and data link
layer, so the OSI layer, then we have this MAC sub layer and LLC sub layer. And if we
have the standard, so Ethernet is the predominant standard here ignore 2.3 and that this is
this looked as a CSMA/CD or there are standard for 802.4 of token bus, 802.5 of token
ring or FDDI. So, there are different type of standard, but our again as our predominant
standard is CSMA/CD will be primarily looking little more deep into this type of in this
technology or in this particular protocol right.

So, this is the so what we have we have a standard to support this and any say network
device manufacturing following this standards will enable us to connect the devices
across the across each other. So, that is inter operatibility between devices from different
make or connecting at different layers etcetera are guaranteed or ensured by this use of
this standards right.

So, this is a important thing to know. Though these days token ring and token bus are not
so popular, so most predominant is the Ethernet protocol and we have from 10 mbps 100
mbps and Giga byte Ethernet at the Gbps level.

971
(Refer Slide Time: 17:31)

So, if we see that 802.2 is the primarily handled LLC, 802.3 is the CSMA/CD or the
predominant Ethernet protocol. 802.5 is the token ring and 802.11 series is primarily for
wireless lines or wireless connectivity right. So, rather in wireless domain we follow a
protocol of CSMA/CA will look into those things in our subsequent lectures.

(Refer Slide Time: 18:07)

So, if we look at the scope of the 802.802 standards it is if you look at it spans from this
data link layer to physical layer. So, those type of things, as we are discussing that LLC
as a the different what we say that service access point for different service access point

972
for the upper layer protocol. And it basically communicate with MAC layer, MAC layer
in turns communicates with the physical layer.

So, one sort of thing is that I want to know that which is the MAC layer of the there
should be addressing scheme for the MAC layer of the destination address and also there
should be some sort of a addressing. But say for this LLC to talk to the upper layers or in
other sense, there should be some sort of a service access point reference type of things.
So, these things are needed for while we have to communicate from one system to other
system at the data link layer.

(Refer Slide Time: 19:14)

So, if you want to see that 802 dot layers functionality, so at the physical layer portion
which will be discussing in sometime little later in this series of lectures. So, physical
layer is primarily concerned with encoding and decoding of the data. So, preamble
generation or removable as and when it is means as applicable right, so, based on where
transmitting or receiving and type of things.

Bit transmission and reception and transmission media and topology how things are there
that is the one of the these are some of the primarily functions of physical layer, which is
governed by the 802 standards. And in the logical layer control interface to the higher
level is one of the primary thing and flow and error control is another aspects of LLC
whereas, in the MAC these are these are assembly and dismantle into the frames right,

973
govern access to LAN transmission media that how that data to be there into the media
right.

So, these are the things which we require. As we are familiar with LAN card or network
adapter type of things, that primarily in a pc or laptop or whatever the your device is. So,
this network adapter card or LAN card or type this whatever we heard is primarily
enables this your functionalities of data link layer and some of the physical layer things.
Like, interface with the means (Refer Time: 21:06) physical layer it may be wire, it may
be wireless it may be bluetooth, zigbee (Refer Time: 21:11) or anything satellite
communication and so on so forth.

(Refer Slide Time: 21:15)

So, if we look at the LAN protocol, so 2 end stations, so end systems that communicate
via a shared LAN right. So, higher layer protocol above LLC provide end to end service
between the station right, these are the higher layer protocols. So, in case of a logical link
also we go through these LAN, but this is also end to end connectivity whereas, the
media access and the physical is basically utilize this LAN infrastructure or the
connectivity to communicate between each other. So, that is the whole of the thing.

974
(Refer Slide Time: 21:54)

So, if we look at the LLC, so it is a LLC layer for LANs is concerned with the
transmission of link level protocol data unit or PDU between the 2 station without the
necessity of a intermediate switching right.

So, the LLC layer of LAN or LLC layer of the data link layer DLL Data Link Layer is
concerned with the transmission of the link level at the data link level PDU right or
protocol data unit between 2 stations without the necessity of a interface of a switching
nodes. So it can transmit the things or in other sense, this that protocol data unit will
contain the payload what it gets from the higher layers right.

So, it is that the data along with the whatever the network layer header and footer and
whatever is there, header and tailor it comes as a payload to the data link layer which
transmit to the next device or next hop right by finding that what is the next of address
and transmitting the data right. So, that is the basic bottom line of the thing. And there
are two characteristics it must support multi access, shared medium nature of link. So,
these are the things what we expect from the data LLC or the data link layer protocol.
And it is relieved from some details of the link access to the MAC layer.

So, in other sense, LLC some of the things that media access things are pushed into the
MAC layer. So, it takes care of the MAC layer. So, if you look at conceptually, so the
data link layer is to LLC and that MAC layer, the MAC layer takes care that negotiation
or interfacing with the medium, underlining medium or the physical layer. Whereas, this

975
LLC is primarily involved or concerned about how it communicate to the higher layer or
in this case the network layer how it will concern to the things that is (Refer Time: 24:13)
taken care of the things. Only it needs to be ensured that the medium can be shared right
and then and multiple shared means it will be multi access nature of links.

(Refer Slide Time: 24:28)

Now, there are different category of LLC services and may be unacknowledged
connectionless service. So, it is something data datagram style what you have looked into
the IP, does not involve any flow or error control mechanism and data delivery is not
guaranteed. So, it is a some sort of best effort (Refer Time: 24:43) service what you have
seen that in case of a datagram right. Another is the connection mode service, a logical a
logical connection is set up between the 2 station, flow and error control are maintained,
it is a connection oriented type of service.

Another is acknowledge connectionless service right. A across between the 2 previous


services right, so it is a acknowledge connectionless service right. So, some sort of
guaranty is ensured. Data grams are to be acknowledged, no prior logical connection set
up is required. So, this different mode that LLC type of services can work on fine. So,
unacknowledged connection less service, connection mode service and or connection
some sort of a connection oriented service, acknowledged connectionless service.

976
(Refer Slide Time: 25:46)

So, if you look at the MAC or the Medium Access Control, so assembly of data into
frame with address and error detection fields. So, that is one of the major aspects
assembly of data into frames with address and error detection fields and deassembly of
frames and performing address recognitions error detection and other types.

So, it is it takes care that i of the MAC at the sender and the receiver. So, we need to put
the addressing things of the destination hop along with the frames and the error detection
fields etcetera. And on the other hand it sets to extract and also to check that whether
there is a error request for retransmission is there and type of things can come into play.
Governs access to transmission media that is one of the major or one of the major aspect
or major concern that is governs the access to the transmission media.

For the same LLC several MAC option may be available. This is another interesting part.
So, you have the 1 LLC, but you can have different type of MAC options right so, or
MAC mechanisms for the same LLC. Means, dividing them or into 2 aspects that 1 LLC
for the higher layer connectivity and MAC for the physical layer connectivity what we
achieve that you can have, now number of solution of this MAC for the same type of
LLC.

So, if you look at the medium access layer so all LANs consist of a collection of devices
that must share network transmission capacity right. So, whatever LANs at the layer 2

977
level network we are considering, consist of a collection of devices that must have a
network transmission capability.

What we see that if you have a pc it should have a Ethernet interface card, if you have a
network printer it should have a network interface card, anything which has a capability
to communicate with the network has to have some way interfacing with the things.

(Refer Slide Time: 27:49)

Function of a medium access control protocol is some means of controlling the access to
the transmission media in needed for efficient use of the capacity right. So, what is the
basic function of the protocol, that there is a some sort of a controlling mechanism so
that, it can first of all it can transmit through this shared media or multiple access type of
things and the media is maximally used. So, that is that means, the bandwidth which is
available can be used in a maximum terms right.

So, if you look at there are 2 things we are looking for where and how. Where refers to
whether the control info is exercised in a centralised or distributed fashion and that
means, in case of a centralised we have a controller has a authority to grant access to the
network. So, there is a control or centralised controller that who says where things will
be how things will be accessed. Who comes after whom and type of things and there is a
distributed station collectively perform in MAC function to determine dynamically and
the order in which the station stand right.

978
So, one is centralised, there is a master controller which takes care of that how
transmission will be there or that is distributed; that means, there is a some sort of
consensus protocol or way that the stations transmit to each other. And how is
constrained by the topology is a trade off among the competing factors like cost
performance, complexity and type of things the how the transmission will be there right.

(Refer Slide Time: 29:36)

So, overall if we try to look at that again that protocol stack, so we have the application
data right, which along with the TCP header at the transport level. So, it accumulates. So,
the application data payload application data becomes a payload to this TCP layer, it acts
as head or tail or whatever it wants to add. And along with that TCP header, it goes to the
has becomes a payload for this IP layer. When the IP layer header is added and then it
becomes a payload to this LLC or what we can say over all a data link layer.

And then this MAC along with that whatever is coming with the MAC header and trailer
become the MAC layer frame. So, what we say that TCP segment, IP datagram LLC
PDU and MAC frame or sometimes we say that layer two frame which consider both
LLC and the MAC layer things.

So, just to recompile what we are discussing, so, what we are looking at the data link
layer is primarily responsible for hop to hop transmission of the things right like, from
one hop to another hop how the data will be communicated right. And so whatever the
upper layer things coming up right the data link layer, when you transmit the things, it

979
opens up at the packets at the data link layer level and try to and find out that, what is the
next layer next address to be pushed into and push the data to the next.

So, it goes for a hop to hop layer. It is in the same transmission same what you say
broadcast domain, but different collision domain, it allows multiple access to these
overall multiple access to the media and also we have seen LLC for the higher level
connectivity and the MAC for the medium access type of connectivity right. So, with this
let us let us conclude this lecture and we will be continuing our discussion on this data
link layer protocols in our subsequent lectures.

Thank you.

980
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Departments of Computer Science and Engineering
Indian Institute of Technology Kharagpur

Lecture – 47
Data Link Layer-Basic Concepts

Hello. So, we will be continuing our discussion on Computer Network and Internet
Protocol. So, we have started discussion on Data Link Layer. So, overview of the things
we will again look at some of the basic concepts and then we will go slowly to little bit
specific things which we want to discuss, right.

So, as we have discussed in our earlier lecture that data link layer is a layer 2 position of
OSI and also the TCP/IP protocol stack. It plays important role because finally, the for
transmitting any data that data link layer address need to be resolved, right. And finally,
and end of the things we require a physical media wired or wireless to transmit the data
from one source to another from the source to destination or hop to hop. Or data link
layer manifestation sometimes we call is a hop to hop manifestation, right.

So, this is important to understand the different fields means different functionalities or
mechanisms of data link layer. Though whenever we are writing as a application network
application, writing an application or working as a network admin not primarily for
application etcetera may not be much always bothered about the data link layer, we are
mostly at the higher layer protocols and type of things. But to understand things it may
help us in optimising at different level.

And these days as we have seen that lot of cross layer issues are coming up or cross layer
optimisation challenges are coming up, lot of research going on, cross layer
optimisations which taking care that not that individually things but taking the stack or a
portion of the stack together that it is important to understand, right. Because our all
protocol things were primarily why we made stack because that one layer should work
independently and it should only bothered about its upper layer and the down layer, right.

So, this, it is extremely nice or for interoperability between different devices, different
protocols and type of things, but in doing so, more you make it flexible more you lose on
performance or maybe there is a compromisation of the performance; so that there is

981
people looking at the cross layer optimisation. In some of the cases like quality of service
or even type of services, security, overall network management etcetera this called cross
layer things optimisation things come up and several applications made demand a not
only one layer but a optimised different layer type of things maybe multimedia
application or some secured application over the things etcetera. So, those things are
some of the aspects which we look into this in case of a your data link layer. Data link
layer for (Refer Time: 03:33) that aspects is important to understand that why things are
there, right.

(Refer Slide Time: 03:59)

So, just to recap what with one slide what we have seen that data link layer is primarily
consist of two things, one is LLC or Logical Link Control, another in the medium access
control. So, LLC is primarily responsible for upper layer negotiation or upper layer
connectivity etcetera, whereas the MAC is primarily with the physical layer, right.

So, LLCs as LSAP or the LLC service access point and on other sense that MAC also
have a MAC address, sometimes we call a hardware address type of hardware address
those are at the MAC level, right. And if you look at the IEEE 802 standard, it
encompasses both these layer 2 and the physical layer stuff.

982
(Refer Slide Time: 04:31)

Now, if you look at the generic MAC frame format, right. So, MAC layer it forms a
frame. So, what is the MAC frame format? Its payload is the LLC PDU, right protocol
data unit which it gets from the LLC as its payload and it addresses the source MAC
address and destination MAC address and there are some control MAC control is at the
front of it. At the end it gives the CRC or the redundancy check field to find out whether
there is a transmission error or not by the end station or the next stop station where the
things are being transmitted, right. So, that is important.

So, we have a MAC control, contains the control information of the function of the MAC
protocol that is priority level, etcetera. Destination MAC addresses; the address of the
physical attachment point of the LAN for this frame, right; so where it is connected,
right. So, your number of cases if the if the if your PC or laptop say wire connection
connected to a switch, so that is the destination for this, the next stop is the switch, right.
And if it is a wireless then also the destination is the wireless access point is for it is a
(Refer Time: 05:54) hop to hop things, right and there is source MAC address, the source
physical attachment point of the LAN of this things.

So, attachment point means where it is connecting to network interface card. So, that is
important. So, what another is the LLC; the LLC data from the next higher layer, right.
So, the whatever the data it gets from the next higher layer is the LLC PDU things are
there and CRC is the redundancy cyclic redundancy check field used to check if the

983
transmission error has occurred or not. Set the distance and check whether the CRC
checking is there, right. So, we will see that if we can discuss on the CRC time permits in
some later lectures, but otherwise you can refer any standard book.

Now, important is that that I have a frame which is on the standard and as we understand
that the for this we require a physical device network adaptor card or what we say LAN
card where you have you can plug in your vat, RJ 45 type of cable. Or if it is a wireless
antenna or that transreceiver things will should be there or if it is a something other
things like some other things, (Refer Time: 07:26) things those interfaces will be there,
that card fits into over devices it is laptop, PC, server whatever, right. And it contains a
physical address, right. Physical address or MAC address or hardware address
sometimes. So, it comes with manufacture things. So, it comes with the address which is
embedded into the things, right. So, that is important.

Though there are things we talk about cloning of MAC address etcetera, we are not
going to those issues or complicacies as of now this MAC address is unique. That means,
any device having a interface card has a unique MAC address across the world, right. So,
what we required to do? We need to have a logical connection between the source and
destination from the IP address then every hop it needs to know that, what is the next IP
address, resolve the MAC address push it to this MAC into this MAC.

Because the layer 2 only understands up to the layer 2 things that means, up to MAC
layer LLC layer it understand. Layer 2 does not understand IP etcetera, right because
there is a higher level things. So, that need to be addressed need to be resolved need to be
resolved as by some protocol, we know there is the protocol called ARP, Address
Resolution Protocol with allows this which maps this IP address to this MAC address,
right and then goes on doing those things.

984
(Refer Slide Time: 08:57)

Now, MAC techniques or MAC approaches can be one is synchronous, a specific


capacities dedicated to a connection. Same approach as in circuit switch FDM that is or
TDM that is frequency domain multiplexing or time domain multiplexing. So, not
optimal for the land or metropolitan area network because the need of the station may be
unpredictable, right. So, you can synchronous and reserved things may not be dedicated
connection may be very appropriate. On the other way we have the asynchronous,
capacities allocate dynamically dynamic fashion in response to the demand.

When the demand comes, it is the capacities allocated. Subdivided or you can see that we
can have with it 3 approaches, one is round robin, I go on getting things after every
particular time slot. It can be some reservation strategy it is reserved for the things or
there can be contention, right I contend for that slot and get the things done.

985
(Refer Slide Time: 09:59)

So, round robin, in case of a round robin for asynchronous MAC techniques, which more
predominant, MAC synchronous things. So, in case of round robin what we say that each
station is in turn granted right to transmit, right. So, it is not that it is fixed, so each
station gets its turn to right to transmit after each station finish in transmitting it passes
the right to transmit to the next station in the logical sequence, right. So, once
transmission there it goes to the next.

Efficient technique when many stations have data to transmit over an extended period of
time. If the everybody is wants to transmit it is efficient, right but if there are station
which are nothing to transmit then also it is getting a turn and it is a wastage of the
things, right. So, it is it becomes efficient when everybody wants to transmit or the data
are more or less in uniform manner we want to transmit and type of things it becomes
much easier, very much efficient, otherwise it will be loss of things like, it goes on
getting turns but nothing to be transmitted.

Whereas, in the in case of a reservation for it is more appropriate for some of the traffic
where like stream traffic like voice, bulk file transfer etcetera. Time on the medium is
divided into slot like synchronous TDM, a station wishing to transmit reserve the slot for
extended period. So, it is it has a it in case of steady streaming (Refer Time: 11:34) traffic
you have a quite a volume of data to be transmitted, so you reserve the slot to be
transmitted, right a priori before transmitting, right.

986
And the third one which is contenders contends contention based technique that is for
bursty traffic, short, sporadic transmission such as interactive terminal host traffic and
type of things which is which are predominant in case of a normal network traffic. No
control is excised on to determine whose turn it is, right. So, there is no control on the
thing simply to implement then efficient for light load. So, it is it is something
contention. A contend for that slot and get the things and it is something which is very
means what we say simple or out of the (Refer Time: 12:31) simple to implement and
efficient for light load. So, if it is a heavy load and traffic etcetera need to be transmitted.
So, that may be a problem otherwise it is efficient.

(Refer Slide Time: 12:43)

So, if you look again in the medium access method, so there are two things which is
predominant, one is Carrier Sense Multiple Access with Collision Detection CSMA/CD
for bus topologies which are which we mostly see across us, right CSMA/CD.

There is another thing which is still there but not so popular that is control token or token
passing for bus and ring topologies, right. So, this is also there, but not so popular these
days. So, we are mostly on CSMA/CD type of architecture.

987
(Refer Slide Time: 13:23)

So, in case of a CSMA/CD used only in bus type of network where a number of nodes
CRA common communication path or bus or what we say communication media, right.
So, I have a communication path where the number of nodes or number of systems or
end system transmit through that bus, that it is the it is also the technique in our
traditional Ethernet connectivity, right CSMA/CD is the technique.

(Refer Slide Time: 13:57)

So, what we say that it need to carrier sense it need to sense whether there is a channel is
free or not. So, there is a whether the carrier is free or not it tends to sense. There is a

988
question of multiple access that number of thing can access at the same time, there is a
phenomenon of collision that party communicate and may collide, right and there is a
that should be a way to detect the collision and there should be a back off algorithm. So,
once collision is there that should be a back off and retransmission, so need to be
jammed that there is a collision is occurred that do not transmit and there is a back off
algorithm so after some time there should be a retransmission, right.

So, one is that I need to sense it, one definitely there is a multiple access I need to sense
it and if in spite of that there is a collision there should be a way to handle this collision
and retransmit the data in a using some back off algorithm.

(Refer Slide Time: 15:05)

So, if you look at the basic operation to transmit data, the source station assembles a
packet comprise of the destination address and that data and the control info at the layer
two level. The source station listen to the cable or the transmission media to determine if
the bus is currently is in use or not, if so it waits until the bus is free else transmit else it
transmit the packet, right.

So, if there is free transmit if it is not free it waits whether the bus is free and transmit the
operation is known as the carrier sensing. So, if it carrier sense if it is not free it wait for
the time and if it is free transmit. During the transmission the source station continues to
the listens to the cable or the media to detect if another station is also initiated
transmission that causing a collision. So, it look at the collision things.

989
So, collision and this process is a collision detection. Typically there is a if there is a
collision there is a fluctuation in the voltage level etcetera which it the source station
hardware suit able to capture that and there is a what we say collision detection. If a
collision has detected then to ensure all station are aware of the collision the source
station transmitted random bit pattern known as jam sequence, right. So, if the collision
is detection detected then other station will may also jumped in to the thing, right without
knowing that collision is there and it will be more collision and things will be there. So,
what it does source station that it sends a jam signal. So, random bit pattern which is
sends as a (Refer Time: 16:45) jam signal.

The station involved in a collision then back off for a random period before retrying the
packet for the transmission. So, the whichever station involved in this in a this collision
scenario will then back off for a random time period before retrying for transmitting the
packet, right. So, that is the fundamental way of things. (Refer Time: 17:13).

So, let me just repeat the thing the it assembles first off all source station assemble the
packets or it forms that MAC level frame. And then look listens to the media if there is
media is free it transmit, if the media so this the carrier sensing, if it is not free it I need
to wait if it is once transmission if there is a collision usually detected by the fluctuation
of the voltage the source station go for a collision detection mechanisms. If the collision
is detected or collision has occurred then the source station send a random bit pattern or a
jam signal jam sequence to alert other station that there is a collision has occurred, right.

And on listening that the stations which are preparing for involved in this collision or
preparing to transmit it will wait for a random back off time we will see that how things
are there in the protocol thing. So, it is basically back off time before retransmitting or
checking the again going to the loop checking the station and going on to the
transmitting the data.

990
(Refer Slide Time: 18:33)

The same thing, so sensing if the idle transmit immediately if busy wait till the channel
becomes idle, collision detection abort a transmission immediately if the collision is
detected, try again later after waiting a random amount of time, right. So, if we look at
the sequence start then set back off to 0, if it is a persistence strategy check that the what
sort of persistence strategy is there, send the frame, if there is a collision no then it is a
success, if this is a so transmission is there if there is a collision send jam signal in that
LAN segment then there is increment the back off time. And if the back off limit has not
crossed then wait for the back off time and then retransmit, right.

The same thing if the limit has crossed then just abort the thing, right that how much
time you can go on trying there if the limit has crossed then you say that you about the
connection or say that there is transmission link failure or something is not there. So, this
is the way it works in case of this, when we transmit the things in a collision detection in
a multiple access carrier sense multiple access with collision detection CSMA/CD.

991
(Refer Slide Time: 20:05)

Now, when collision detection time how long does it take to realise that there is a
collision? The worst case it may happen that to cross end to end propagation delay, right.
So, it is a end to end propagation delay twice that I think then we can have this whether
there is a collision has occurred or not. So, that maybe the scenario which will be there,
right.

(Refer Slide Time: 20:29)

So, there is a another protocol what we have just mention at the beginning which is
which is still they are but not so predominant but just to have a overview of this sort of a

992
MAC level protocol. So, this control token or token passing another way of controlling
access to the shared media is by control token or token passing so that means, whoever
the in the control of that token has the right to transmit, right.

The control token technique uses a control or permission token to share the
communication resource between the number of nodes, right. This technique can be
applied to both bus and ring topologies. So, this control token thing this token is passed
from one station to another according to a defined set of rules. So, that how this thing
should passed or shared it is a defined into the thing.

So, a station may transmit a frame only when it possess a token that means, you have a
control of the token or token is in your hand then only the station can transmit the frame.
And after it has transmitted the frame it passes the token on to allow another station to
grab that token and in turn used at media to transmit that data, right. So, this is the basic
philosophy which it works. So, in other sense we have a tokenization mechanism or a
what we say control or permission token, the station which has the control over the token
or has the token in its hand has the way to transmit after transmission it pass the token on
so that the other contending stations who wants to transmit can use this token to transmit.

(Refer Slide Time: 22:19)

So, control token operation whether ring or bus topology a logical ring is established,
right because it has to go on token in the sharing whether it is a physically ring or bus

993
topology there is a logical ring is established or they token moving or token moving in
the ring or token ring type of scenario, right.

So, logical ring is established which links the nodes using a physical media. So, will see
in the next slide that what is the thing. A link control permission token is one node, right
the token is passed from node to node around the logical ring until it arrives the node
waiting for the center frame so that means, it goes on moving in the node to node unless
somebody grabs the token into the to transmit the data. The node captures the token has
the control over the token and transmit the data. Upon completing the transmission the
node releases the token to the next node in the logical ring. So, in the logical ring it. So,
there are nodes which are in the logical ring. So, once that is one ring gets the
transmission done it release the token in that logical ring. So, that is the things which you
are talking of.

(Refer Slide Time: 23:43)

So, there is a logical ring is has been formed in to the things a token always circulates
around a ring net a user grabs a token and transmit the data and this is the logical ring
which is formed into the overall scenario, right. So, token is passed from one to another,
right. So, the way we discussed.

994
(Refer Slide Time: 24:17)

So, if we try to look at that what we say flow of the thing. So, the wait for the a station
need to wait for the token to come, once the token it gets the token it captures or on have
the control over the token then it data whether it has a data frame to send. So, it gets the
token it so, it has the control over the token if whether it has the it has data frame to send
if no then you release the token, right to the next one in the ring or if yes, then send the
frame accept the allocated time limit if it is expired then it has to delete the token
because it cannot indefinitely keep the token on its control its has the there is a time limit
for the things. If it is not expired then capture the go to the things again go for the data to
be sent etcetera.

In other sense so long it is the token is there till its time has expired it goes on
transmitting it goes on transmitting the data it wants to transmit. Once that is once that
time is expired then it has to release the thing or its transmission over time (Refer Time:
25:42) is not expired it release the token to the next node in the logical ring. So, if these 3
nodes are there if this is the way it is moving. So, it is release to the next node next node
next to (Refer Time: 25:53) the logical ring. So, this was in use rather some of the things
are still in use, but now it is all mostly over mostly are Ethernet based services or
CSMA/CD based services what we see these days.

995
(Refer Slide Time: 26:15)

So, there is another important aspect that how this addressing things can come up, right.
Communication involves 3 things, right one processes, stations, networks, right. The
process to be there their networks is the process used to communicate between the
processes and networks the two network, two or more networks are there and the stations
which are the end stations.

Transfer of data from one process to another involves getting the data to the station in
which the destination process resides and then getting it to the intended process within
the computer, right. So, if I want to transmit a data from the things. So, it has to go to
that intended process and a execute into the thing.

Two level of addressing they have. So, one is the MAC address or the hardware address
or what we sometimes called network address and there is a LLC addressing scheme
where it tries to identify the network service point.

996
(Refer Slide Time: 27:15)

So, if we look at LLC user data IP datagram are passed now to LLC which appends a
header to make the LLC PDU, right. So, with the header it becomes a LLC protocol data
unit. The LLC PDU is passed to the MAC entity which in turn appends the header and
the trailer to make the MAC frame, right.

So, I the user data in this case user data in this case what it receive from the upper layer
say network layer and then it address the LLC header and create the LLC PDU, this LLC
PDU now become the payload for the MAC. So, the MAC adds a header and a trailer
and make this MAC frame which need to be transmitted to the next hop, right, where the
MAC header contains the destination address that is the layer two address of the MAC
address which need to be transmitted to the next hop.

997
(Refer Slide Time: 28:19)

So, level of addressing. So, one is MAC addressing identify a physical interface from the
station to the LAN, right. So, it should be physically connected wired or wireless there is
one or more relationship between the station and the physical address. So, LLC address
identify LLC user, LLC address or LSAP is associated with that is a service access point
associated a with the particular user within the station, right. And also the LLC service
access point may refer to a process executing on a station or to a hardware port end type
of things that means, it is mostly talking with the upper layer type of, it is talking with
the upper layer type of protocol with the LLC SAP.

(Refer Slide Time: 29:05)

998
So, what we see; so 3 broad classes or categories, right. In case of if you look at the
MAC protocols, so one is channel partitioning like divide channel into smallest piece
either time slot or frequency the channel need to be partitioned, allocate piece to node for
exclusive use. So, I allocate these slots into different nodes either through mechanism of
CSMA/CD or token ring and type of thing. So, this is one aspect. Like the channel need
to be somewhat logically partitioned and things would be there.

Other aspect is random access: allow collisions, allow collision, recover from collision,
right. So, one is allowing collision and recovering from the collision. And there is a
shared access, tightly coordinate shared access to avoid collisions, right. So, there is a
more coordinated effort to avoid collision, right. So, these are the 3 what we say aspects
of MAC layer protocol which is hard to achieve.

The basic philosophy or a basic goal of this thing is that it should be efficient, fair,
simple and decentralized, right. So, efficient, fair, efficient means that channel is utilised
efficiently; fair means is fair to all the nodes in the in that LAN like it is not giving any
extra preference to the other things, right it should be simple to implement. Finally, end
of the day it is these devices are not that high resource devices. So, simple to implement.
So, simple and as far as possible it should be decentralised decentralized that there
should not be any centralised control over this mechanisms, right. So, that should be
decentralized type of things.

So, what we say efficient, simple and decentralized this; these are the things which if any
MAC protocol tries to achieve. So, what will what we have seen a overall mechanisms
overall basic philosophy of that how this layer two data link layer protocols works. So,
LLC and MAC and what are the different technique like CSMA/CD is the predominant
technique which is Ethernet uses also there is a token ring technique things are there and
the MAC protocol as such want to become efficient fair to all simple protocol and
decentralised.

So, with this let us conclude our discussion today. We will continue our discussion on
this layer two or data link layer in our subsequent lectures.

Thank you.

999
Computer Network and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 48
Data Link Layer-Ethernet

Hello, we will continue our discussion on Computer Networks and Internet Protocols and
last couple of lecture, we were talking about data link layer as we know that as a layer 2
in the OSI stack also in TCP/IP stack also it is in the layer 2 in some of the TCP/IP stack,
if we put physical layer and data link layer together nevertheless it is a in a layer 2
devices right.

So, we have also discussed that the switches or layer 2 switches has this property is that
it can open up packets up to layer 2 and take a call based on the things right and also in
the layer 2, we understand that it is a it divides the collision (Refer Time: 01:02) domain,
but still work in the same broadcast domain and another point that any routing protocol.
Once the route is specified when the routing path is found out by this routing protocol
then, this then when the packets moves up to hop to hop, it need to resolve the next
location or the next hop destination by resolving the IP to this layer 2 address or MAC
address right and also we have seen that there are 2 predominant, we can sub layer or we
can divide into sub layer 1 is the LLC, which takes care of the connectivity with the
upper layer or the negotiation with the layer and another major part is this MAC medium
access control, which basically takes care of the connectivity with the media and there is
a unique addressing of MAC address some also known as hardware address also known
as network address which comes with the network interface card.

So, today what we will be discussing is one of the predominant protocol in the layer 2,
which is more or less omnipresent across the across the all networks in the world that is
the predominant protocol of Ethernet right. So, initially we may talk about this some
other that allow a protocol or 1 or 2 slides, then we will go to the Ethernet basic features.

1000
(Refer Slide Time: 02:41)

So, what we are talking about shared network address right. So, that means, shared
network access assume multiple nodes on the same physical link right, it can be bus,
ring, wireless structure, whatever so, but we on a physical link there are several networks
transmission sent by one node is received by all others nodes right no intermediate
switches are required. So, that is within that what we say reach of all the nodes and
received by all the nodes as we are telling that is in the same broadcast domain. So,
method of moderating the access is the, is through the MAC protocols and which
primary look as the fairness and the performance.

So, it is fair to all nodes and it able to utilize this is means band width in a appropriate
way and also we know that it should be somewhat simple to implement otherwise putting
onto devices with low resources etcetera we cannot put resource hungry (Refer Time:
03:36) and those type of things.

1001
(Refer Slide Time: 03:38)

Now, if you look at the random access MAC protocol, when node has packet to send
transmit at full channel rate R. No a priori coordination among the nodes. So, whenever
the; it needs to send, it sends on a full rate right, no coordination things. So, randomly
access the channel two or more transmitting nodes if there are there are the same time
there may be a possibility of collision.

Once the collision is there should be a mechanism should come up and if there should be
a retransmission or whatever some action needs to be taken. So, random access MAC
protocol specifies how to detect collision. So, there should be a way to detect collision
and how to recover from collision right may be via one of the popular thing is that
delayed retransmissions. So, (Refer Time: 04:28) retransmission after sometimes.

So, and examples of random access MAC protocols one that from long back like sixties
or in early seventies is Aloha. There is a variant of these of slotted Aloha and this days,
what we look at is CSMA or CSMA/CD right or rather we have more things on the
things nevertheless what we see is the Ethernet is predominately (Refer Time: 04:59)
predominantly ruling the whole networking and it is sees on CSMA/CD.

1002
(Refer Slide Time: 05:08)

So, Aloha basic approach is the first random MAC developed for radio based
communication in Hawaii in 1970 all right early, I means late sixties and early seventies
19 seventy. So, basic idea when you are ready transmit; so, there is no question of
looking at the channel Aloha, whether it is busy or somebody is using receiver sends a
acknowledgement for data detect and collision by timing out of timing out of technology.

So, if you do not receive the acknowledgement in time. So, there is collision or there is a
loss of the packet, recover from the collision is by trying to trying after random delay.
So, too short large number of collision if it is too long underutilized channel. So, these
are the basic over all philosophy of the thing.

1003
(Refer Slide Time: 05:56)

And if you look at the network Aloha network developed by Norm Abramson at
university of Hawaii to use with packet radio network. Any station can send data at any
time receiver sends an acknowledgement same thing, if there is a collision sender will
resend the data after a random back-off all right. So, utilization; that means, how much
channel is utilized fraction of transmitted frames avoiding collision for N nodes, it is
pretty bad correct or pretty low. So, maximum utilization is 18 percent right. So, it is if
you if you will at some point of time, you try to look at the calculations or rough
calculations to see that. So, it is around 18 percent whereas, slotted Aloha dividing
transmit time into windows help so, maximum utilization. So, if we in the case of certain
Aloha the utilization time increases little bit to 36 percent, but better than Aloha. So, this
was the first card thing, but we need to remember it is there in 1970 right late sixties
1970. So, those type of reason (Refer Time: 07:08) was there and what we see that our
present day thing, what we came up later on is based on this basic philosophy.

1004
(Refer Slide Time: 07:18)

So, in case of slotted Aloha time is divided into equal size slots that is packets
transmission time right. So, slots node without packet transmit at beginning of next slot
right. So, the node, which want to sends with packets in nodes to have the packets to be
send and beginning of the next slots. So, it is on the slots it transmits; if collision
retransmit packet in future slot with probability p until successful. So, it is it is not like
that any time transmission it is on the on the slotted. So, there are it is divided in to slot
and whenever the things comes it node transmit on that particular slot.

(Refer Slide Time: 08:05)

1005
So, in case of pure Aloha, un-slotted Aloha: simpler, no synchronization. So, when we
look at the pure Aloha, there is no synchronization; that means, no slotting or type of
things packets needs transmission send without awaiting for the beginning of slot or
anything like that once, it goes it goes on the things. So, collision probability; obviously,
increases much packets sent at t0, you see at this in this figure collide with other packets
send in t0 minus 1 t0 plus 1 right. So, it can collide with the other packets at sending at
other time interval also right. So, there is a in case of pure Aloha it is once ready send it
type of things, if there is a collision wait for some time and retransmit.

(Refer Slide Time: 09:01)

Now, we come to that our Ethernet. So, this is the very first hand-drawn figure of
Ethernet sketch of Metcalfe. So, the first practical local area network built at Xerox
PARC in 1970’s right in 70’s, dominant LAN technology, it is cheap kept with a speed
race 10, 100, 1000 mbps. So, 10 Mbps, 100 Mbps and 1 gbps Ethernet and started in
1970s, there is a, this is a very popular picture, you will find in several books and other
several resources internet resources and type of things. So, this was the initial sketch of
the thing, the query interfacing a particular stage interface controller a transreceiver
connecting or tapping to the that backbone of the ether and there can be several other
devices, which is connecting to the things. So, there is a there are terminator and
anybody can means, any of the device can connect to this particular backbone of the
ether right. So, that was the philosophy and make a big change because, now you have a
shared media on a on a single bus or ether.

1006
(Refer Slide Time: 10:27)

So, one issue with the Ethernet MAC is the carrier sense. So, basic idea is the listen to
the wire before you transmit right, whether somebody is there avoid collision with active
transmission right. So, avoid collision with active transmission, if there is things.

So, why what was not in Aloha, the primarily Aloha is a packet switch network. So, in
wireless relevant contention at the receiver is not on at the sender right. So, at the
receiver end; so, there can be a problem of hidden terminal in this case, where the one
terminals are hidden or it can be exposed terminal, this both terminals are exposed and
get the things. So, there can be a hidden terminal problem or exposed terminal problem
and it may not be feasible to have all those, you can listen and before transmit.

1007
(Refer Slide Time: 11:24)

So, multiple access method; so, when what there are approaches, one is the fixed
assignment like partition channel into each node gets a slice of the bandwidth. So, I the
channel is partitions. So, it has it node has his own partition essentially some sort of a
circuit switch, thus inefficient like if you if you are not transmitting then also it is the slot
is allotted and type of things.

So, it is a inefficient. TDMA, FDMA, CDMA all used wireless and cellular
environments are examples of this type of fixed assignments, there is contention based
nodes contends equally for the bandwidth and recover from the collision. So, this where
our, this Aloha or Ethernet is based on and this is the thing. So, everybody contend for
the channel and look for the means and whence it is free transmit, if there is a collision
there is a process of recovering from the collision or retransmission of the data in to the
channel. Token based or reservation based is another thing that is the take turns using the
channels and that is that token ring is one of the example in previous lecture, we have
discussed that, when the node which holds the token has the right to transmit, the or take
charge of the channel type of thing. So, our main intention or main goal of the thing is
look at the contention based or things. So, like which is the Ethernet.

1008
(Refer Slide Time: 13:11)

So, coming back to Ethernet; so, background is something developed on Bob Metcalfe
on and others in Xerox PARC in mid seventies, roots in Aloha packet radio network that
is primarily standardized by Xerox DEC and Intel in 1978 and LAN standards define
MAC and physical layer connectivity right.

So, there are several standard we have already seen that is 802 dot 3 is the CSMA/CD
Ethernet that standard originally, it was 2 Mbps then we have that 10 mbps IEEE 208 dot
3 u is the 100 mbps Ethernet IEEE 802 dot 3 z is the one gbps of 1000 mbps Ethernet
right and the basic protocol is CSMA/CD Ethernet that media access and control MAC
policy CS we as you know that CS is the carrier sense send only if, thus medium in idle.
So, it sense, the carrier and see that whether the idle MA is the multiple access. So,
carrier sense multiple access with collision detection stop sending immediately of if the
collision is detection send a jam signal. So, that the other participating nodes understand,
there is a collision and then go for a retransmission of the things.

So, that is the basic philosophy of this slotted Aloha, it is not sorry that is the CSMA/CD
sorry that, CSMA/CD that is what we use in this Ethernet and this is the again the picture
comes back the same picture.

1009
(Refer Slide Time: 14:59)

(Refer Slide Time: 15:06)

So, the Ethernet technologies that initial thing was the 10 base 2, 10 was that 10 mbps 2
is around less than 200 meters cable length is permissible. So, thin coaxial cable in a bus
topology, it was there. Repeater used to connect multiple segments of such stable
repeater repeats bits, it is here on the interface to the one other. So, it is a physical
repeater is a physical layer phenomena layer 1 phenomena, which primarily increase the
signal strength or in others terms, we can say it increases the (Refer Time: 15:43) signal
to noise ratio.

1010
So, it is amplifies the signal. So, if you if the permitted length is 200 meters effectively
around 180 meters. So, after that you require a repeater to increase the 6 signal strength.
So, that it goes on the on the rest of the on the again, another segment of 180 meters or
200 meters right. So, and as we know that we are that that popular hub, which is also
layer 1 device is primarily a multi port repeater. So, if it is hub is typically 4 port, 8 port,
16 port hub, but they have the same collision and broadcast domain. So, the effective
bandwidth is pretty low. So, this worst case it is divided by the number of ports it is
having right. So, that is the basic thing.

So, what we see that there is a cable here and these are all tapped right. So, thin coaxial
bus repeater used to connect the multiple segment and there is a cable. So, there are
node, there are several nodes, which are tapped into the thing. So, there are these are all
tee connectors right, some of you might have seen, there are tee connectors right, where
this cables are connected and this things are there. So, transmit packet travels in both
directions. So, this, the tee connector and then we are the terminator at the end and there
are adapter at the things. So, this adapter basically connects this machine or the node. So,
that is the interface between these, this is the network adapter, which connects the things
right.

(Refer Slide Time: 17:32)

So, then it came that 100 10 oblique 100 mbps rate with twisted pair. So, initially if you
see it is 10 base 2, this is 10 base T and 10 base 100 base T.

1011
So, T stands for twisted pair hubs connected by twisted pair facilitate star topology type
of things. So, there is a hub sorry, there is a hub and there are these are the different
connections and again hub connectivity etcetera, the effective bandwidth goes on
decreasing, but we can have a star type of topology right.

So, um. So, this is the structure by which that 10 base 2. So here, again 10 stands for the
mbps and T is the twisted pair typical length of twisted pair is around not more than 100
meters another effective width is less, then 100 meter around 89 meters up to which this
just twisted pair is can run.

(Refer Slide Time: 18:39)

Will come to this physical layer, physical layer consideration letter, but has to have a
continuity of 802 dot 3 physical layer configurations specified in 3 parts either data in
data rate 10, 100, 1000 signaling rate, whether is a baseband or broadband signal,
baseband is the digital signaling, broadband is analog signaling and this cabling right,
there are difference specification 5 for thick coax coaxial cable, F for fiber optic, S for
short wave laser through multimode channel L, for long wave laser to single mode
channel and so and so forth all right and already, we have seen 2 and T what this stands
for.

1012
(Refer Slide Time: 19:25)

So, Ethernet is defined by a broadcast protocol, any signal can be received by all host.
So, it is a same broadcast domain switched enable individual host to communicates.

So, that the collision domains is fragmented or divided and network layer packets are
transmitted over and Ethernet by encapsulating by encapsulating so that means, that this
is our typical frame format, where we have a preamble of 64 bit destination address, 48
bit source address, 48 bit there is a type field of 16 bit, this is the body of the message
and there is a 32 bits CRC check right. So, this a typical size of Ethernet, typical format
of Ethernet a Ethernet frame.

1013
(Refer Slide Time: 20:32)

So, when we have a switch network there are several features or advantages right.
Switches forward and filter frames based on the LAN addresses or MAC addresses or
hardware address or network addresses whatever it is.

So, based on that switches forward and filter the frames. It is not a bus or a router
although, simple forwarding tables are maintained. So, a switches has a layer 2 switch,
what we are talking about layer 2 switch has a table and based on that. So, if I have a 8
port switch then it is forwards packets based on the based on the data it is received, based
on the destination input. So, in other sense the collisions are collision domains are
divided or we are avoiding this collisions in this in when, we connected in the switch. So,
it is very scalable like unlike hub, where the it is in the same broadcast and collision
domain here, it is different collision domain very scalable of sense for many interfaces,
full duplex operation send received frames simultaneously right. So, it can as a full
duplex operation.

So, that I do not have those type of collision scenario. So, connect 2 or more segments by
copying data frames between them right. So, I can even connect 2 or more segments with
the switch right, switches only copy packets when needed key difference from the
repeaters right. So, repeaters is primarily only signal enhancing or amplification of the
signal. So, that it is transmitted, where as switch divides the collision domain. So, you
can have different collision domain and that is why, the effective bandwidth is much

1014
higher than here and not only that scalability is there, you can connect cascade switch in
a much better way than then hub or repeaters, higher link bandwidth, collisions are
completely avoided.

So, you have a higher as you have talking about higher a link bandwidth or better
utilization bandwidth, much greater aggregate bandwidth, separate segments can send at
once. So that, I can have when, we aggregate the all these bandwidth then we have a
much better aggregate bandwidth, when we have a separate segment connected over the
switch.

(Refer Slide Time: 22:54)

Now coming to the Ethernet frames: so preamble is a sequence of 7 bytes and each set to
10101010. So, just to remind here; so, we have a this preamble of this used to
synchronize receiver before actual data is transmitted and address is a unique 48 bit
unique a unicast address assigned to each adapter right. So, of the form of x x though y x
x colon x x colon x x and this form. So, we have a; so, 1,2,3,4 5. So, we have a total 48 6
into 8 that is a 1 early 1 is missing. So, it should be 1, 2, 3, 4, 5, 6, 6 into 8.

So, I have a 48 byte a 48 bit unicast address for each adaptor, each manufacture gets it is
own address range so; that means, whatever adapter is manufacture is adapter or
manufacture has a unique addresses; that means, ideally or whatever interface card, we
are connecting with this our network has this separate addressing. So, all network
interfaces or adapter across the world are unique though, there are issues of cloning of

1015
this adapter etcetera, we are not again as I am send earlier also we are not going to the
those challenges complicacies, but we this is the basic philosophy right. So, broad in case
of a broadcast all 1, in case of multicast first bit is 1 right. So, this is the way we look at
it type field is a demultiplexing key used to determine, which level of protocol the frame
should be delivered to right.

So, this is a which signifies that at which level of which higher level protocol, these
particular frame will be delivered to, body can contained up to 1500 bytes like the
payload can be after up to 40 1500 bytes and finally, we have a CRC of 32 bit.

(Refer Slide Time: 25:34)

Now, in Aloha decisions to transmit are made without paying attention to what the other
nodes might be doing right so; that means, you have once you are ready you transmit.
Ethernet uses CSMA/CD listens to line before during sending the data right if line is idle
no carrier is sensed right send packet immediately. Upper bound size is 1500 bytes must
have 9.6 micro second between the back to back frames right. So, if the line is busy
carrier sensed; that means, carrier is senses somebody is someone is transmitting wait
until the transmit packet wait a wait until idle and transmit packet immediately, this is
also known as one persistent sending. So, wait until the it is the is the idle and transmit
packet immediately without looking at it, if collision detected stop sending and send jam
signal try later again right.

(Refer Slide Time: 26:38)

1016
So, this is the basic philosophy. These some form we have seen earlier also that basic
state diagram of CSMA/CD. So, the packet sense carrier if it is send if it is send yes then
the jam signal calculate the back-off time wait for b and go on keep attempt is less than
16 again carrier sense equal to 16 discard packet and go on like this right. So, this is this
is the way it goes on, if packet is there it is sense and type of thing. So, you sense the
carrier and then go on transmitting the things right. So, this is the way to go on working
on the thing right. So, first of all, if I want to send the packet sense the carrier if the
carrier is free send it, if there is a collision, if detected then wait for send jam signal wait
for a back-off time, if attempt is less than 16 go and again the sense the carrier if attempt
is equal to 16 then discard the packet.

So, collisions are caused when 2 adapter transmit at the same time right, adapter sense
collision based on the voltage differences. So, they voltage based on the voltage
differences it sense that whether, is a collision or not.

1017
(Refer Slide Time: 28:03)

Both found line to be idle right, in this case AB both found that line to be idle at that time
both had been waiting for a busy line to become idle and then they transmit A transmit at
time 0, message almost there at time T B starts collision right. So, this is this is the way
collision can happened and there should be a retransmitted, how can we be sure that A
knows about the collision?

(Refer Slide Time: 28:43)

1018
So, one way is that either that voltage difference and sort of things or if it is knows about
the collision takes place, there must be a mechanism to insure retransmission on collision
right A’s message reaches B at time T. B’s message reaches time A at time 2T right.

So, so, A must wait till transmitting still B transmitting at time 2 T. So, after typically
max time of 2 T comes to know whether, there is a collision or not. So, 802 dot 3 specify
max value of 2T to be 51.2 micro second, these relates to a maximum distance of 1500
meters between the hosts right, if we consider that speed the speed of way when
transmission. So, it is around 1500 meters between the hosts considering that cable
etcetera, where you cannot get that whatever, in the vacuum also around 60 percent of
the speed, you will be achieving. So, at 10 mbps it takes 0.1 micro second to transmit 1
bit. So, 512 bits that is 64 bytes takes 51.2 micro second to send right.

So, Ethernet frame must be at least 64 byte long, 54 byte header 46, yeah sorry 14 byte
header 46 byte data and 4 byte CRC. So, there is the basic thing, if padding is used if that
data is less than 46 byte correct. So, we have this thumb rule calculation. So, 8023s
specify that the 2T to be 51.2 microsecond, this relates to 1500 meter between the hosts,
if 10 mbps takes 0.1 microsecond to transmit 1 bit. So, at 10 mbps, it takes 0.1
microsecond to transmit 1 bit. So, 512 or 64 byte takes 51.2 microsecond to send right.
So, Ethernet frame must be at the 64 byte long, 14 byte headers, 46 byte data and 4 byte
CRC. So, if it is less than your data is less than 46 byte then padding should be use. So,
sending jam signal after collision is detected to ensure all hosts collisions are see the
collision. So, it is a 48 bit signal, which is a jam signal is send.

1019
(Refer Slide Time: 31:26)

(Refer Slide Time: 31:30)

So, this is the collision detection after time 2T and then we have a exponential back-off,
if collision is detected delay and try again delay time is selected based on the binary
exponential back-off. First time choose K from 0, 1 and delay equal to K into 51.2
microsecond. Second time choose K from this side 0, 1, 2, 3, K into so and so forth and
nth time choose from 0 to 2 to the power n minus 1. So, know the maximum value of
allowable K is 1023 to give up after several tries usually 16 once, the trial is 16 gives a
then report a error to the host, if delay is not random, then there is a chance that the
source would retransmit in the lock step.

1020
So, why not a choose small set of set for K, this fine it works fine, if the number of host
are less. So, if you have a less number of host there is small k will work fine, if the
number of host are pretty large then these there will be a chance of more collision. So,
this is the basic philosophy of our basic Ethernet, which uses CSMA/CD primarily and
so, what we will what we have seen that that it is a carrier sense and detection and then
retransmission after a back-off time, what it is doing. There are some base line what we
say, arithmetic which tells are that what should be the size of the things, will continue
our discussion in the next lecture with the Ethernet and other variation of this or on the
data link layer. So, let us conclude our discussion for this particular lecture, and we will
continue in the subsequent lecture.

Thank you.

1021
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 49
Data Link Layer-Ethernet

Hello. So we will be continuing our discussion on Ethernet. What we are discussing in


the last lecture on Data Link Layer phenomena under our this Computer Networks and
Internet Protocol course right. So, as Ethernet is one of the predominant technology in
the layer two devices and omnipresent across the network. So, we already discussed
some of the aspects we will be trying to cover some more aspects here. So, it gives as a
overall idea that how the Ethernet works right.

(Refer Slide Time: 00:55)

So, just to a recap slide it was developed by Bob Metcalfe in Xerox PARC and his team
(Refer Time: 01:02) in 1970. So, basic motivation from the Aloha packet-radio network
standardized by Xerox DEC in 78. And there are few standards which became pretty
popular 802.3 which use’s CSMA/CD. 802.3 u for 100 Mbps standard Ethernet and
803.z 802.3 z which is for gigabit Ethernet or 1,000 Mbps or gigabit Ethernet and it
employs CSMA/CD.

1022
(Refer Slide Time: 01:42)

So, just to give a Ethernet frame last lecture also we discussed, but there are little bit
maybe some ambiguity, but to clear it off the Ethernet frame is as far as 802.3 standard
constitutes a preamble. If you remember one some slide some of the literature means in
preamble consisting of a 7 plus 8 bit. But as per the standard preamble is a 7 byte; sorry,
it by 7 byte, SDF is 1 byte, destination MAC is 6 byte, source MAC is 6 byte, type is 2
bytes, payload MAC’s is 1,500 bytes, 46 to 1,500 bytes. So, if the there is no payload I
we should have at least a padding of 46 right. So, if I say the payload varies from 0 to
1,500 bytes, the varies from 0 to 46 bytes and we have a CRC check or FCS of 4 byte
right. So, preambles inform the receiving system that a frame is starting and enable
synchronization right.

So, that start of that it say it for the synchronisation it says the receiving systems or
inform the receiving system the frame is starting. SDF or the start frame delimiter is
signifies the destination MAC address field begins at the next byte. So, it says that the
next byte onwards the destination MAC address is there or that the hardware address on
network address, online address whatever we say.

So, destination MAC address identifies the receiving system, source MAC address
identifies in the sending system, type identifies the protocol inside the frame. That means
the next higher level protocol. Typically for example, it maybe IPv4 and IPv6 right and
data and pad contains the payload data right. What is received from the higher level

1023
protocol? The payload data and padding data is added to meet the minimum length
required for the field. So, the minimum length required for this field is 46 byte. So, the
padding is added for that if the pad there is no payload; that means, 0 thing is if
theoretically. Then the padding of 46 will be there if the full payload 1,500 bytes are
there then I may it may not have any padding right. And the frame check sequence
typically the CRC contains a 32 bit, CRC redundancy check which allows the detection
of the corrupted; so that is the frame check sequence or FCS. So, this constitutes the
typical Ethernet frame a preamble 7 byte, SDF 1 byte, destination MAC address 6 bytes,
source MAC address 6 byte, type 2 bytes, payload 46 to 1,500 bytes and payload plus
padding so it should be at least 46 bytes and FCS of this right.

So, if we keep away this preamble and SDF so we required 14 bytes at the beginning and
4 byte at the end. And these are primarily two more of synchronisation and say that
where the start of next address is there and like sort of this right.

(Refer Slide Time: 05:20)

Now how do I know the MAC address; many of you might I tried. In Linux there is a
command call ipconfig if you give slash all then it keeps on MAC address of the thing
right. In windows there is there is ipconfig in windows it is ifconfig let just try if it works
right. Now if you let me see whether I can expand it will let us see you can use the
command called ifconfig. And you see here the MAC is MAC address is all if you see
ipconfig minus slash all so where is the MAC here is the physical address right 64 00 6a

1024
ic 1 is 63 right. So, this is the typical MAC of this particular systems where from where
this we I am using the systems right. So, it is in case of this is I if this is ipconfig slash all
here also we have used this ok. It is in windows only in the in case of Linux it is ifconfig
right; anyway that commands you can get easily.

So, in other sense what you want to say that you can basically get in good get around this
MAC address or the physical address of the things. And we see that is the 48 bit structure
18 to 6 we signifies the MAC address of the particular systems. So, when we
communicate we require the source and the destination and as let me repeat it, but when
every hop that MAC need to be resolved right. So, when I hop from one system or one
router or any network device to network device every every link the hop the MAC it
need to be resolved for the destination and it is transmitted to the destination right.

(Refer Slide Time: 07:43)

So, the major challenge when we have a shared media is collisions right that. So that is
why carrier sense multiple access with collision detection scheme right when you say for
a wired media. We later on will look at in sometime we will look at the other mechanism
for wireless media; where we have a instead of a collision detection a collision avoidance
scheme. Because there are detecting collision in a wireless media is much difficult in that
will come to that sometime later in this particular course. So, collisions are caused when
two adaptors transmit the same time adaptor sense collision based on the voltage
differences right. So, the how the collision is caused when the two adaptors without

1025
knowing that both are thinking or both are sensing channel to be free and communicate
and then it is collide.

And there is a once the collision is there is a fluctuation in the voltage the adaptor
understand the voltage like A is sending to B. So, at time 0 it starts where as more only
set the same time or after a typical delta T time the B starts where, also it sense this so
somewhere here the it collides in between collides. And then the voltage fluctuations
difference among the things unless A gets a sense of that voltage difference is it thing it
is gets A and B both things that there is a collision. It sends a jam packet and resend the
retransmit after the sometime right.

(Refer Slide Time: 09:28)

So, how can A know that a collision happens? There must be a mechanism to ensure
transmission retransmission on collision right. Otherwise we do not know that where the
data it at send and then there is no data where I think so there otherwise retransmission is
there. If that is not there so it is typically some sort of a connection or best effort service
you transmit and then forget that whatever as gone one right. So, A is message reaches B
reaches B at time T so B is message from the B to A it is 2 T. So, A must still be
transmitting at 2 T; so after 2 T time it may know that there is collision or not.

So, 802.3 specifies max value of 2 T to be 51.2 micro second ok. Last class also we have
seen this relates to a maximum distance of 2,500 meter between the host which at 10
Mbps speed in 0.1 micro second 1 to transmit 1 bit to. So, 512 bits takes 51.2 micro

1026
second. So, it takes point in 10 Mbps to transmit 1 bit it take 0.1 micro second for in 51.2
micro second. It will be some 512 bits or 64 bytes of data to transit. So, the Ethernet
frame must be 64 byte long so that you can it can successfully recognise or identify a
collision. So, out of that 14 goes on the header excluding that first 8 byte of preamble
and SFD and the 4 byte goes for the FCS or the CRC check. So, 46 byte of the payload is
minimum required otherwise I cannot guarantee that whether I can find out the things.

So, that is why what we see that the payload length has been specified, specified from
not 0 to 1,500, 46 to 1,500 bytes right. So, or the in other sense 0 to 1,500 is the padding
or 0 to 46 is the or in a sense 46 to 0 is the hey sorry data 0 to 1,500 is the data 0 to 46 or
46 to 0 is the padding of the data. So, that is the requirement of the of that particular
payload field. So, if there is a collision it sends a jam jam signal after collision to detect
to ensure that all host know all host know about the collision or see the collision. So, it is
a bit 48 bit signalling mechanisms.

(Refer Slide Time: 12:30)

So, there is a same picture, there is a collision, and there is a retransmit this there is after
2 T time a gets that informational collision and then it goes on retransmission.

1027
(Refer Slide Time: 12:41)

So, if a collision is detected delay and try again; that is the philosophy it is not that
immediately retransmit delay, sense, try again right or try again in the sense again sends
the channel and then plumb that in. So, first time choose K how much time you will there
K from 0 one then delay for K into 51.2.

So, second time choose K from 0 1 2 3; nth time K 0 to 2 to the power n minus 1. The
maximum value of K will be 1023 this we have seen also right. If the delay is not
random there is a chance that the source would retransmit in lock step. And if it is a very
small then it is fine for small network, but it may be problematic or large number of
nodes will result in more collisions in a (Refer Time: 13:36).

1028
(Refer Slide Time: 12:36)

So, from the receiver side send a handles all access control right from the receiver is
simply read the frames and acceptable address. So, address to host, address to broadcast,
address to multicast, to which the host belongs all frames if the host is in the
promiscuous state right; so this is the receiver things right if it wants to do with the
receiver end.

(Refer Slide Time: 14:10)

So, there is a another; so what we are seen sometimes will down the today’s talk itself
will see that gradually how it evolved just to recap the things that how it evolved putting

1029
all this together. So, with the increase of requirement of bandwidth and more bandwidth
hungry applications etc that so we the overall graduate it from fast Ethernet and gigabit
Ethernet. So, fast Ethernet which gives a 100 Mbps has technology very similar to 10
Mbps uses different physical layer encoding 4B 5B will see that when we will discuss
about the physical layer sometime in this lecture series. And can be many NIC’s has both
10 slash 100 compatibility.

So; that means, it switches based on the things it negotiate and find out that where things
will be there. So, other thing is the 100 Gbps or gigabit 100 Mbps of the gigabit Ethernet
compatible with lower speed uses standard framing and CSMA/CD algorithms. Distance
are severely limited typically used in the backbone and inter router connectivity. So, it is
a high speed things where the backbone and inter router connectivity become becoming
cost competitive that become the cost is slowly coming down and it is becoming more
viable. And that finally, it need to be seen that how much effective bandwidth is realable
realizable that is also need to be calculated on need to be evaluated type of things.

(Refer Slide Time: 15:55)

So, if you look at the Ethernet; Ethernet works best under light loads, utilization over 30
percent is considered sometimes heavy nodes load. Network capacity is wasted by
collision what I am telling that traditional Ethernet. Most network are limited to about
200 nodes to specification allows up to 102 for nodes, but mostly when we say that
within a particular network then we have a 200 nodes. Then we will see the concept of

1030
bridged a land that we have a bridge to connect the other land. Most networks are much
shorter 10 to 5 to 10microsecond that RTT and round trip time. (Refer Time: 16:40)
Transport level flow control helps reduce load. So, as we are talking about that there are
the other layers what they are doing it is totally not keeping independently the transport
layer flow control mechanism may help in reducing the load Ethernet is inexpensive so
to say fast and easy to administer right. So, Ethernet found to be cost effective quite fast
and easy to administer overall. So, it is a from the network administration station point of
view it is always a good thing to do to look at the things.

(Refer Slide Time: 17:20)

There is a few challenges issues or with this Ethernet, I am that some of them ask
Ethernet peak utilization is pretty low right. So, it is low peak throughput worst with
more hosts. So, if you connect more hosts that the throughput will fall more collision
needs to identify by a single sender smaller packet size more frequent arbitration. Longer
links collision take longer to observe more wasted of bandwidth if it is a link is longer
than it is a more collision takes in a large time to works we have seen that 2 into T
efficiency sorry there is a typo can be improved by avoiding this condition.

1031
(Refer Slide Time: 18:19)

So, see these are these are may be administratively controlled and later on we will see
that there are things which we can which can be managed we can manage with this
Ethernet. So, this can be improved by avoiding these conditions. So, if we come to this
overall evaluation of the Standard Ethernet. So, we have Standard Ethernet, Fast
Ethernet, Gigabit Ethernet, Ten-Gigabit Ethernet. Now a days we are talking about Ten-
Gigabit Ethernet we see that there is a issue of bundling this things to larger bandwidth
and so and so forth.

Mostly use for higher things are mostly used for backbone traffic because in because
neither the application nor the most of the devices can exploit that that very high level.
Because I have a laptop with some 100Mbps capability connecting to a 1 gigabit so it is
wastage of the resources right. And secondly, all are not used even your connectivity is at
1 Gigabit or 100Mbps. Finally, your application may not be using more than 10Mbps or
20Mbps and type of things like that so it is a again a wastage of resources. And whenever
you go up on the scale on the speed the cost increases manageability becomes
challenging and it is a overall pressure on the backbone of the network.

1032
(Refer Slide Time: 19:33)

So, Ethernet addressing already we have seen just to recall. So every each station on a
Ethernet network or every system on an Ethernet network such as PC, workstation,
printer etcetera. Which on network enabled having a network interface card has it is own
network interface card or NIC right. So, in these systems like this system’s out I am
using here. And it is a own NIC your network interface card has adapted to connect to
the physical media, it can be wired connection, it can be wireless connection, it can be
coaxial cable, it can be twisted pair, it can be fibre optic, it can be some wireless devices
Bluetooth, etcetera. NIC fits inside the station and provides the station with a 6 byte
physical address which is unique for every NIC ideally.

So, typically like 17 6E 10 this is a typical thinks 6 byte address right and there is a
scheme at the layer two level is a Unicast multicast and broadcast address right. So, a
source address is always Unicast right so fine it is generating it is always Unicast the
frame comes from only one station. So, anyway generating a Ethernet or layer two frame
it comes from a one station. The destination address however, it can be Unicast multicast
or broadcast if the least significant bit of the byte in the destination is 0 the address is
unicast right or otherwise it is multicast right. So, say this address what is this 7; 7
signifies 0 1 1 1 so; that means, the least significant bit of the; a as you have seen the that
is similarly of the first byte in the destination address is not 0 in this case 1 so that
means, it say multicast. Broadcast address is a special case of multicast in which all bits

1033
are 1 what does it mean that all these are ones in other sense this is a FF:FF:FF:FF:FF:FF
right: 6 FF right. So, that is the multi there is a broadcast a special case of a multicast.

(Refer Slide Time: 21:56)

Like here, if we have this A as the BC so A is a Unicast because A is 0110 right. Any way
last bit is 0 for this first this one these the last bit of the first byte is 1. So, it is multicast
and these are all ones so that is broadcast right. And if I have a address like this there is
maybe there is some typo because this is not representing correctly here because this 47
it is not representing 47. So, just please re calculate this one it should be some a typo is
there any way. So, what to be mean to say when we took at address like this it is decipher
into the binary form right.

So, again I am repeating this 40 yes please check the representation. This 47 should be
representing here, 20 representing here, 1B representing here, 2 here at the 47 is not this
representation right. Because 4 is 0 0100 0100 and 7 is 0 111 so it is should have been
01000111 so there is a mistake here there please correct it.

Anyway these are the bit wise representation and when it goes it goes in this direction.
So, the when did you send that is going and receiver receiving it is in this direction. Now
if you look at the standard Ethernet already we have discussed. So, it is 10 base 5 bus
thick coaxial 10 base 2 it is say again bus structure with thin coaxial 10 base T is the
twisted pair that is which allows star connects start type of topology 10 base F is a fibre
with star topology where 10 represent the speed of the thing.

1034
(Refer Slide Time: 24:04)

Ethernet evaluation bridge Ethernet dividing LAN’s using bridges increase bandwidth
and separates collision domains correct. So, if I have a large number of systems into the
things so there is a concept of bridge Ethernet right. So, I we put a bridge in between so
what happen that instead of this one whole thing I put we can put a bridge here. So, these
two LAN’s are now connected with a layer two device or bridge. What it does it
basically as we know layer two device divides a collision domain the collisions are they
are separate collision domains and in a effect it increase the overall bandwidth.

So, this is the bridge Ethernet where we have better bandwidth things. So, if you look at
your own network in your office; or in your colleges, offices and so where the number of
networks are there. So, at least we have layer two devices which are which basically a
divide the collision domain effectively increase the bandwidth of the network right
effective bandwidth of the network is increase or in other sense the wastage of the
bandwidth due to collision are reduced. So, that is a very standard practice to do that so
divide LAN’s into bridges.

1035
(Refer Slide Time: 25:34)

So, we have the next phase the bridge to switch can be thought of what we can say a
multiport bridge. So, instead of one bridge dividing into two; I can have now a switch of
12 ports which is dividing into 12 domains right. So, as per domain which again can
connect to the bridge so, I can have a hierarchical structure of this layer two devices right
which allows me to increase the effective better utilisation of the bandwidth of the
available network right. Like here we have one set of switches which goes on things
another a switch which connect a set of systems say this is a router or layer three device
right.

So, it is a in this connection it is a full duplex connection it come to that so trans received
is difference. So, there is a not a challenge of collision, but a effectively we can manage
the things and as you know that these are there are manage switches and type of thing.
So, we can basically understand manage the switch in effective manner that how the
switches can be managed and type of things in effective more effective manner. So, there
we have the overall health of the switch or management of the switch.

Next one is a full duplex Ethernet which is popular these days which are switch are
mostly used these days in most of the today’s network. So, full duplex network mode
increases the capacity of the each domain to 10Mbps to 20Mbps. So, this is full duplex
as we are showing the pixel that is full duplex. So, or it increases in a double in
somewhat double in other sense we have a separate transrecieve line. So, they are not

1036
colliding each other in the transmitter and the receiver or not colliding with one another.
So, that that increases effectively so something 10Mbps effectively increased to 20Mbps.
So, all are transrecieve lines are different.

(Refer Slide Time: 27:46)

So, in other sense what we say in a full duplex Ethernet that may not be need of any
CSMA/CD because there is in a separate transreceive. So, there is a no collision parts say
right in a full duplex switch Ethernet there is no need of CSMA/CD method in a full
duplex switched Ethernet is station is connected to the switch via to separate links right.
So, we have a transline and a receive line so each station or switch can send or receive
independently without worrying about the collision each link is a point to point dedicated
path between the station and the switch. And the MAC layer becomes much simplier in
this case, because into do not have to take care all those things of the collision avoid a
collision detection and type of things are.

So, in other sense what we are saying these days whenever this system is connected to a
switch it is as a two’s trans two separate line one for trans and another for receives right.
So, in other sense it has it has independently that transrecieve things goes on there is no
collision so there is no need of CSMA/CD per say. So, there is a MAC control layer
standard Ethernet was designed as a connectionless protocol for MAC sub layer right.
So, if you look at the standard Ethernet it was more of a connectionless protocol like you
transmit and as such you do not manage the thing to provide for an error control in a full

1037
duplex Ethernet a new sub layer call MAC control is added between the LLC sub layer
and MAC layer sub layer.

Now we need to have something what we say flow and error control mechanism within
the Ethernet right. So, if there is a error of transmission; that means, you send the packet
the packet is not reached you have sending an acknowledgement it is dropped. So, there
is both. So, that hamper that error control error hampers overall flow mechanism of the
things because ethernet what we see layer two is a hop by hop, but end of the day it has
need to transmit across the thing. And in most in several cases in it requires some sort of
a flow control error control mechanism to ensure a some sort of typical service level
assurance or quality of services and type of things.

(Refer Slide Time: 30:05)

So, first Ethernet already we have a seen so was designed to compete with the LAN
protocol, FDDI, or fibre channel IEEE created fast Ethernet 802.3u has a rate of 100
Mbps. So, goal upgrade the data rate to 100 Mbps make it compatible with standard
Ethernet keep same 48 byte addressing scheme keep the same frame format. So, there is
no incompatibility keep the same minimum and maximum frame length so those are
kept.

So, there is a there is a feature added to fast Ethernet in is a auto negotiation. New
feature added to fast Ethernet is call auto negotiation. Auto negotiation allows two device
to negotiate the mode or data rate of operation right. So, which mode and which data rate

1038
operations to allow compatible devices to connect to incompatible devices to connect to
each other that will allow one device to have multiple capabilities right. So, it can
connect to 10 Mbps 10 slash 100 this type of things are possible to allow a station to
check the hubs capability like it if is a managing then I can check that how much
capabilities there. And accordingly, I the station can transmit so hub or switch we can
this is loosely used so it is so allow the station to check the switch capability.

And finally, the what we are the next evaluation on the thing is the gigabit Ethernet
higher data rate of 1Gbps in full duplex mode gigabit Ethernet there is no collision the
maximum length of the capable a cable is determined by the signal attenuation in the
cable. So, that is the only things which is there and there are different variation of the
things and these days we are having ten gig Ethernet and so and so forth. So, these are
some of the evolution of the things.

So, what we do with this we let us conclude today’s lecture on a overview or the overall
that basic functionality or Basic Concept of Ethernet. So now, will in the subsequent
lecture will look at more aspects of layer two or data link layer of this, but overall a
overall network a layering or the OSI or TCP/IP layer.

Thank you.

1039
Computer Networks and Internet Protocal
Prof Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 50
Data Link Layer-Flow and Error Control

Hello will continue our discussion on Computer Networks and Internet Protocol, in last
few lectures we are discussing on data link layer 2 in the OSI, also in important layer,I
also in TCP/IP. So, we have looked into ethernet and different other features of layer 2
and today we will see something on Flow and Error Control.

You will find similarity or between the flow and error control, what you have studied in
transport layer or in the transport layer phenomenon, where it in transport layer, it takes
care of the end to end process right that process a process in system 1 is process P, in
system 1 talking to process Q in system 2 and there is a process to process
communication. Where as in this case we have a hop to hop communication right that in
layer 2 hop to hop this is system connected to a to a nearby switch.

So, it is that hop connectivity is there, you also and has to you know that that a particular
ethernet frame or has a source address, destination MAC address and the payload which
is getting from the higher layer right and with other things like error checking, preamble
(Refer Time: 01:44) type of things. So, what is important, when we communicate
specially these days, when you have switched network switch full duplex networks and
things that the to, how this error and flow control mechanism are handled in this
scenarios right. So, will take a overall overview of the work flow and error control and as
I am again repeating that the overall mechanism is conceptually is similar to that what
we have seen in the transport layer, but here at the we are doing at the data link layer.

1040
(Refer Slide Time: 02:30)

So, flow control coordinates amount of the data that can be sent before receiving the
acknowledgement right.

So, what is there? Whenever I am sending a data to somebody right so, after sending I
am expecting acknowledgement, the data is received or not to resend. So, what flow
control coordinates the amount of how much data, you can send before receiving the
acknowledgement type of things, every bitwise byte wise, kilobyte wise or chunk wise
and whatever the things right. Flow control is a set of procedure that tells the sender, how
much data it can transmit before, it must wait for an acknowledgement from the receiver
right.

So, that is a mechanism it says that you say I say, that you sent every packet of so much
things or every frame and get a acknowledgement send and explain, what I say that you
sent 5 frames wait for the 5 acknowledgement and type of things I say 5 frame is
sequence and then wait for the last the maximum acknowledgement thing that all will be
there. So, it is say mechanism, it is a procedure, it is a protocol, it is a overall procedure
need to be there. Receiver has a limited speed at which, it can process incoming data and
a limited amount of memory in which store the incoming data. So, what we see that the
receiver it is basically receiving it is a speed at the limited speed (Refer Time: 04:00) or
at a speed it can receive.

1041
It can store some of data type of things. Receiver must inform the sender, before the
limits are reached and request that transmitter to send fewer frames or stop temporarily
right. So, if it is overall with the data, it should must sender the sender that 2 thing, it is
hungry of the data, it is basically dearth of the data as the sender to send more or if it is
overwhelm in the data, it should say that the stop sending and or at a reduced rate (Refer
Time: 04:33) right. So, this all are has to be through a procedure, which is primarily a
flow control mechanisms right.

Since the rate of processing is often slower than, the rate of transmission receiver has
block of memory or buffer for storing the incoming data, until they are processed right.
In general the rate of processing with more high speed things are coming up. So, rate of
processing the data is often slower than, the rate of transmission. So, usually you are
overwhelming with that data. So, receiver has to maintain a buffer or a memory block,
where the data can be incoming data can be stored and processed like whatever is in the
store and forward it store the data process the data and type of things, but there is a that
is a limit for the buffer also that, how much you can, it is not a indefinite buffer, you can
go on storing indefinite time right. So, that is a restriction on the how much buffer, you
can store the data and type of things.

(Refer Slide Time: 05:48)

So, on the other hand so, one aspects of a ethernet or layer 2, the data link layer is to
have a mechanism for flow control right otherwise, faithful communication at expected

1042
rate etcetera, will be difficult to maintain unless, there is a flow control mechanism
which manages the flow. So, that is that is one important thing, other in aspects of the
thing the error control. The data is sent from the receiver sender to the receiver, receiver
does not reach it, received it or while sending the acknowledgement, acknowledgement
is lost or delayed sometimes it is not lost, it is delay it corrupted and type of things come
up into the things. So, that is only important to the how to over all control the error in
this layer 2 transmission.

So, error control includes both error detection and error correction right, it allows
receiver to inform the sender, if the frame is lost or damaged during the transmission and
coordinate the retransmission of those frames by sender right. So, it allows us receiver to
inform the sender that whether the frame is lost or damaged during the transmission and
coordinates the retransmission of those frames by the sender. If there is a lost of frame,
damaged of the frame that should be retransmission, error control in the data link layer is
based on a concept of ARQ or automatic repeat request right, whenever there is a error is
detected specified frames are retransmitted right. So, it is a automatic repeat request. So,
it is requesting for a automatic repeat of the things. So, that is a mechanisms which is
there.

(Refer Slide Time: 07:42)

So, error and flow control mechanism as you might have seen earlier also. So, one is the
stop and wait mechanism and Go-Back-N ARQ mechanism, selective repeat mechanism.

1043
So, these are the 3 predominant mechanisms, which is followed or which is deployed in
the layer 2 of our standard local area network implementations.

(Refer Slide Time: 08:16)

So, in case of stop and wait it is pretty straight forward, sender keeps a copy of the last
frame, until it receives a acknowledgement right. So, sender keeps a things for the
identification both frames and the acknowledgment are numbered alternatively 0 and 1
so, 01, 01, 01 and type of things right. So, once the frame is sender the 0,
acknowledgement comes as a 1 sender frame as 1 acknowledgement comes as 0 and
alternatively goes on right.

So, the receiver on receiving the acknowledgement it gets the thing that it is (Refer Time:
08:56) successfully transmitted. The sender has a control variable S and holds the
number of the recently sent frame 0 or 1 right. So, control variable takes care of the
things, the receiver as a control variable R and holds the number of the next frame
expected 0 or 1 right. Sender start a timer, when it says the frame if an acknowledgement
is not received within a allocated time period or within the threshold period or within the
timeout period, the sender assume that the frame was lost or damaged and resends it
right. Receiver sends only positive acknowledgement, if the frame is intact
acknowledgement number always defines the number of the next expected frame right.

So; that means, you see here the acknowledgement 1 means the next expected frame is 1
acknowledgement, 0 is the expected frame is with the is of the sequence 0 and type of

1044
thing. So, this is a very simple mechanism, but it this allows for this flow and error
control rate. So, frame 0 is send acknowledgement send back as 1 on receiving the
things, it asks for the frame 1 is sent, acknowledgement send as a 0 and so on so forth.
So, alternatively 0 1 0 1 things will go.

(Refer Slide Time: 10:28)

Stop and wait ARQ lost acknowledgement frame, there is a there is a acknowledgement
frame is lost right. So, when receiver receives a damaged frame, it discards it and keep
the value keeps the value of R. In this case, if receive the damaged frame and discards it
and keep the R equal to 1, after the timer at the sender expires, another copy of the 1 is
sent right. So, it once within the time limit, the sender does not receive the
acknowledgement, it will send the another that frame 1 is retransmitted to the receiver
means sender to receiver right.

1045
(Refer Slide Time: 11:13)

So, this is a sorry, it is a lost frame right. So here, it is a lost acknowledgement frame. So,
frame this is lost acknowledgement frame. So in this case, if the sender receives a
damage acknowledgement in discards it right. So, the sender gets acknowledgement,
which is a damaged one and it discards it and how it is identifying? Because you you
mean the format we are FCS right frame checks sequence is there that CRC (Refer Time:
11:52) 32 and so on so forth. It can it is able to find out, the there is a error or not, when
the timer of the sender expire, the sender retransmit the frame 1 right. Receiver already
receives the frame 1 expecting to received frame 0 therefore, discards the second copy of
frame 1 right because, it is already received the frame 1 found it faithfully and, but
received again frame 1. So, it discards the second copy because, it is expecting a frame 0
right. So, that way it goes on means, it handles that lost acknowledgement. So, even the
acknowledgement is lost in the retransmission phase, it can basically detected.

1046
(Refer Slide Time: 12:42)

Stop and wait, delayed acknowledgement frame. So, happen that acknowledgement is
sent, but it is delayed right acknowledgement can be delayed at the receiver or due to
some problem right. It is received after the timer for the frame 0 has expired sender
transmitted a copy of the frame 0; however, R equal to 1 means, the receiver expect to
see a frame 1 right. So, receiver discards the duplicate frame 0 right. Previously what
was there?

That it has a duplicate 1, because of that acknowledgement problem here the, there is a
delayed acknowledgement and the sender thinks that the frame has lost, it will retransmit
the frame again and it discards the frame 0. The frame 0 twice transmitted discards the 0
sender receives 2 acknowledgement, it discards the second acknowledgement if the
sender is 2 acknowledgement because, the actual delayed 1 then, the now actual 1 and
then it discards the second acknowledgment.

1047
(Refer Slide Time: 13:57)

There is a concept of piggybacking right. Now because, this both sending the data and
acknowledgement are eating away space. So, when we have a both communication, both
side communication like station AB, both have data to send then the a method to
combine data frame with acknowledgement, the data frame itself carry the
acknowledgement.

So, the acknowledgement frame piggyback on the data frame instead of sending
separately station a sends the data frame that includes an acknowledgement. Station B
does the same thing, piggybacking saves bandwidth right. So, instant otherwise this
acknowledgement frames should have been another channel right; however, small it may
be it requires some bandwidth to transmit right. So, this piggyback on the other means on
the data, which are send across the across A and B.

1048
(Refer Slide Time: 14:59)

Disadvantage of stop and wait. In stop and wait, any point of time there is only 1 frame
that is sent right and waiting to be both the acknowledgement. So, it is sent waiting for
the acknowledgement still the timeout and type of things right. This is not a good way of
utilising the transmission media so, that is a when the media keeping the media under
utilised or not utilised for a longer time is not acceptable. So, there are 2 protocol is one
is Go-Back-N, another is Selective Repeat ARQ, Go-Back-N ARQ and Selective Repeat
ARQ, which are which are used to take care of these underutilised bandwidth or that the
problem.

(Refer Slide Time: 15:50)

1049
So, Go-Back-N ARQ, we can send up to W frames before the worrying about the
acknowledgement, send that W frames, we keep a copy of these frames until the
acknowledgement receives. This procedure requires additional features to be added in the
stop and stop and wait ARQ right. So, which bunch of frames are same in and the copy
of kept instead of waiting that every acknowledgement, this the acknowledgement is
coming it is goes on reconciliation or what we say that, goes on acknowledging the
frames are if the acknowledgement not received and send retransmission required so and
so forth.

(Refer Slide Time: 16:32)

So, as we have a bunch of frame, there is not 1 sending and receiving and type of thing.
So in this case, what we require is a sequence number right, frames from a sender are
numbered sequentially, we need to set the limit since, we need to include the sequence
number of each frame in the header, set a limit. So, if the header frame allows m bits for
the sequence number.

The sequence number range is 2, the power 0 2, the power m minus 1 right or m equal to
3, sequence number is 1, 2, 3, 4, 5, 6, 7 right or this is the sequence number, we are
having we can expect the sequence, we can repeat the sequence number of that those
things right. So, it is 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7 and so on so forth. So, the
sequence number can be repeated on the means on a regular basis.

1050
(Refer Slide Time: 17:36)

So, from the sending, send the sliding window at the sending a to hold the outstanding
frames, until they are acknowledged, we use the concept of a window right, because
unless this is acknowledged that has to hold right. We cannot discards those that the
sender ends, size of the window is at most 2 the power of m minus 1, where m is the
number of bits in the sequence number right. If there are 3 bit 2 to the power 3 minus 1
type of things.

Size of the window can be variable, how much? That all depends on the data rate (Refer
Time: 18:14) type of things; the windows slides to include new unsent frames when
correct acknowledgement are received right. So, the window slides to include new
unsent frames like here, this ones the acknowledgement 0, 1 is it slides to send the next
things. So, up to 4 received, it slides again and go on like that.

1051
(Refer Slide Time: 18:39)

At the receiving window, size of the receiving window is always 1 for this protocol right.
Receiving window always looking for a specific frame to arrive in the specific order. So,
whether it is sliding or not at the sender end, receiving is waiting for that specific number
of frames, may be in the sequence to wait for the in a specified order right.

Any frame arising out of order is discarded and need to be retransmitted right in a frame
arising due to say, monthly path, delay, etcetera. So, will be out of order (Refer Time:
19:16). Receiver window slides as. So, this is the receiver window slide shown in the
figure, the receiver is waiting for frame 0, in figure 1 and then 1, it is received slides to
the waiting for frame 1.

1052
(Refer Slide Time: 19:34)

Control variable, sender has 3 variable S, SF and SL. So, 1 is the end of methods that is
what we say first frame, last frame and S is the currently send frame. So, right receiver
has only 1 variable R to hold the sequence number of the frame, it expects to receive. So,
it is expecting 0 to receive it will be on that things, if the sequence number is the same as
the value of R.

The frame is accepted otherwise rejected. So, the if things received as 0 as it is waiting
for the 0, then it is accepted otherwise things are rejected.

(Refer Slide Time: 20:14)

1053
Acknowledgement as we see plays important role right that how the acknowledgement is
there receiver sends positive ACK if a frame arrived safe and in a order; that means, it is
correct and in order. If the frames are damaged out of order receiver silent and discards
all subsequent frames until it receives the one it is expecting. So, it is instead of it is
expecting 1 instead of 1, it is receiving 2 3 etcetera, it discards all frames right then the
sender resends all the frames beginning with the 1, which has expired timer for example,
suppose the sender has frame 6, but the timer for the frame 3 expires then, the sender go
back and sends the frame 3, 4, 5, 6, this is called Go-Back-N ARQ. The receiver does not
have to acknowledge each frame received, it can send 1 accumulate cumulative
acknowledgement for several frames that is also possible.

(Refer Slide Time: 21:12)

So, this is the Go-Back-N ARQ, sender keeps track of the outstanding frames that are an
updates the variables and windows at the acknowledge arrives right.

1054
(Refer Slide Time: 21:33)

And in case of a lost frame. Frame say in this case, frame 2 is lost, when the receiver
receives frame 3 discards frame 3, it is expecting 2 as we are discussing. So, it has
expecting, 2 here and receive 3 instead of 2 discards. The timer from the 2 expire and the
sender side and sender sends frame 2 and 3, go back to N, that is go back to 2, in this
case.

(Refer Slide Time: 22:01)

Go back to Go-Back-N ARQ damage, lost, delayed acknowledgement. If the


acknowledgement is damaged or lost, we can have 2 situations, if the next

1055
acknowledgement arrives before the expiry of any timer, there is no need for
retransmission of the frames because, the acknowledgement are cumulative in this
protocol. So, it is a cumulative. So, that is the next acknowledgement there is no (Refer
Time: 22:30) of retransmission if a AKC 1 sorry, ACK 1, ACK 2, ACK 3 are lost. ACK 4
covers them if it arrives before the timer expires, then its a its a cumulative thing. If ACK
4 arrives after the time out, the last frame of all the frames after that are resent right,
receiver never resends an acknowledgement. So, receiver never resends an
acknowledgement, it is only 1, it is sends a delayed acknowledgement also triggers the
resending. So, a delayed acknowledgement is also in the case of a is like a damage or lost
and it triggers a resending of the frames.

(Refer Slide Time: 23:12)

So, on the sender side Go Back N ARQ. The size of the window must be less than 2
power m, size of the receiver is always 1, if is equal to 2 the size is 2 to the power 2
minus 1 is 3. So, figure compares the window size of 3 and 4 that how things will be
there accepts as a first frame in the next cycle and error and so, it goes on looking at the
things right. So though, there is a lot of frames are lost, it has got erroneously got the
things erroneously 0 and it is expecting this 0 and mistaking to the 0 and which is
erroneously accepted, where is in this case, if there is a loss, it is it is expecting 2 and but
at the 3 correctly discarded. So, is not received a 0. So, it is correctly discarded right. So,
it is also that window size plays role in this sort of scenarios.

1056
(Refer Slide Time: 24:26)

Selective repeat ARQ sender and receiver windows, this is another ARQ mechanisms.
So, Go-Back-N ARQ simplifies process of the receiver side right, receiver only keeps
track of only 1 variable right and there is no need of buffer out of order frames and
simply discard the things, if anything out of the frame coming, in case of a Go-Back-N
ARQ, then you just simply discard the thing. So, was the thing right; however, in
selective repeat ARQ only damage frames are resent; more bandwidth efficient, but more
complex at the processing in the it means selective repeat; that means, you are not
discarding, in case of go back N in for finding 1 out of water, discard everything after
that, but in selective repeat you are not discarding all you are only discarding, which are
erroneous or damage frames and type of things right you are you. So, selectively
requesting resend from the sender for the selective frames. It sends, it defines a negative
acknowledgement pr NAK to report the sequence number of a damaged frame, before
the timer expires. So, it sends a negative acknowledgement or NAK right.

So here, instead of in the case of Go-Back-N, what we have seen there are this is SF, SL
and S was there and whereas, here we R F and R L that cannot be accepted frame
received and acknowledged right out of that things, which are received and
acknowledged here frames acknowledged, frames awaiting acknowledgement is after
that right.

1057
(Refer Slide Time: 26:33)

So, in selective repeat ARQ, lost frame 0 and 1 are accepted, when the received accepted
when receive because, they are in the range specified by the receiver window of the
frame 3 (Refer Time: 26:47).

So, it is within the receiver window size. So, it is 0 and 1 are accepted, when received
because they are in the range of the (Refer Time: 26:58) right. Receiver sends a receiver
sends a NAK2 to show that the frame 2 has not been received right and sender the
resends only frame 2 and it accept and it is accepted as it is the range of the window
right. So this, a range of the window matters much. So, if it is within the range of the
window. So and then there you receive a NAK of request repeat or selective repeat of a
particular frame, then it is resend by the sender.

1058
(Refer Slide Time: 27:35)

So, again selective repeat ARQ is the sender windows, window again plays a important
role, size of the sender and receiver window must be at most half that 2 to the power m;
that means, m is equal to 2. So, size will be 2 to the power 2 by 2 2 so window size is 3
an all acknowledgement as lost sender sends duplicate frame 0 right like in other case,
also if it is window size is greater than 2 to their m minus 1; that means, to your m
divided by 2 then, I can receive accept this 1 though, it was damaged, I accept this
erroneously accepted, where as if it is within that thing, that it is correctly discarded by
the receiver.

So, window size 3, all acknowledgement has lost. Sender sends duplicate frames 0
windows of the receiver expect receive frame part of the windows accept the 0 and the
first frame of the next cycle. So, it is a error. So, it is accepted in a erroneous manner
right. So, what we see here, in this sort of flow and error control mechanisms. So, the
sender receiver with help of acknowledgement, in case of the first 1 stop and wait it is
everything is acknowledged, every frame to individually acknowledged, but in go back
N what we have seen that, the receiver has only 1 pointer, where as a bunch of thing,
bunch of frames can be send from the receiver from the sender end. And it also send a
cumulative acknowledgement has a option of sending cumulative acknowledgement in
repeat ARQ selective repeat ARQ.

1059
So, in case of go back N, if there is a error everything after that need to retransmitted
where as the mechanism is the NAKs mechanism has a better utilization of the
bandwidth when is a repeat ARQ, they need it sends only those selective frames which
has damaged or erroneous things like that right. And in both the cases what will ask 2
cases, what your seen this window size plays an important role right, otherwise you may
erroneously accept something right, if the window size is not properly maintain. So, that
is important for things, this flow and error control mechanism over and above tries to
have provide a better utilization or better flow mechanisms within the things.

So, you have a better utilization of the bandwidth or provide a better quality of service
for this mechanisms right. So, this is the overall flow and error control mechanism. So,
with this we look we conclude the our basic flow and error control mechanism in the
data to data link layer and also we see that this provides, say this helps us in providing a
better utilization of the bandwidth right. There is 2 issues are there 1 is the bandwidth is
not available right, you have a 10 Mbps and more data to be you have a higher
bandwidth, but due to in proper utilization, you may not be exploiting that in a proper
way.

So, in subsequent lecture will see other aspect of the things, there are several data link
layer or switching aspect those things. We will be looking at which also which are some
of things in also have linkage with higher level network layer phenomenon. So, that will
see in the subsequent lecture or on this particular series of lecture will be looking at. So,
let us conclude today.

Thank you.

1060
Computer Networks and Internet Protocol
Prof. Sandip Chakraborty
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 51
ARP-RARP-BOOTP-DHCP

Hello. So we will be continuing our discussion on Computer Networks and Internet


Protocol. So, we were discussing on layer 2 or data link layer phenomena. So, we have
seen that aspects of flow control error control at layer 2 of the data link layer which is
one of the major aspect of things. Apart from that the packets need to be switched or
what we say frame needs to be forwarded at the layer 2 level.

As we understand that anything any upper layer packet finally, becomes it payload to this
data link layer we needs to be forwarded to the next hop through these through the some
layer two mechanisms all right or in other sense whatever the logical address space is
there, we need to be resolved to the next hop physical address to send the packet or the
frame from one host to the next host next hop.

So, it can be router to router, router to switch, switch to router, system to switch and
anything correct. So, that is why we will be today we will be looking at or may be into
coming two lectures will be looking at different as protocols of the layer 2 phenomena,
so namely ARP, RARP, BOOTP, DHCP. Some of these protocols also we might have
discussed in our earlier lectures or at the when we were discussing at the top level things;
nevertheless what I felt that this has direct linkages with our layer 2 level switching or
data link level switching.

So, we need to we thought that it should discussed in the perspective of the layer 2 or
data link layer right.

1061
(Refer Slide Time: 01:59)

So, if you look at the first protocol which is predominant is the address resolution
protocol, sometime which is also known as a companion protocol for our IP network or
IP layer or what we say internet protocol in the layer 3.

So, 2 machine on a given network can communicate only if they know each other
physical address. So, this is bottom line. So, unless they know your physical address they
cannot communicate, unless there is a physical connection you cannot communicate
right.

So, first of all the connectivity should be there whether it is wired wireless whatever, but
there should be a connectivity, the connectivity is not there whatever you do in the upper
layer you cannot communicate all right.

Similarly, unless you know the physical address you cannot push it to the next hop. So,
ARP serves or address resolution protocols serves for mapping from high level IP
address to this low level MAC address or physical address sometimes known as loosely
as network address also right or hardware address, so to say right.

So, that these ARP transform these from a logical address to this physical address.

1062
(Refer Slide Time: 03:12)

Now, what is this ARP? So, what we see first of all? Every machine every system
whether it is a PC or server or laptop or a router with multiple interfaces we come to that
router etcetera.

Any devices or a printer which are which can be network enabled any devices which are
network enabled has a logical address or IP address and a corresponding physical
address. And typically we have seen that for IPv4 this is a 4 byte address space and this
is a 6 byte address space or the physical address and also we learnt that this physical
address of a device is unique; that is given by the hardware manufacturer on the things.

So, there are again I am repeating there are issues of cloning those physical address. So,
we are not going to those complicacies, but physical address of a network device is a
unique right. Whereas there can be multiple like logical address at the same time, but the
router takes care of that how it to be there like these are private IP block.

So, private IP block can be same for 10 dot 4 dot 10 dot 90 can be in different places all
right, but as private IP’s are non routable, so there is not a problem of clashing with other
right; nevertheless physical addresses are unique.

Now, what I want to do if I want to send the packet from here to here, so only knowing
this logical addressing will not suffice right. So, I need to know the physical address

1063
from that particular packet or frame in terms of layer 2 to this thing right. So, if I only
know the logical address I need to resolve that.

So, usually what happen? You when station a this is b you want to send to a station a
wants know it is logical address or IP address and his physical address or MAC address,
where as for the where it wants to say it needs its logical address or the IP address these
IP address is known to this, but b’s physical address is not known to it.

So, for that it requires a resolution or resolving the thing right. So, these IP once I hit that
give me this 10 dot 4 dot 90 91 MAC address it should response to the things all right or
somebody else will tell me that this IP is these things right. So, there should be some
address resolution protocol right that exactly ARP does.

So, like ARP request from here to here or here to here, so different level of ARP request
when the files are getting transferred right. So, I need to know the physical address of the
both the parties to transfer the packet or frame.

So, ARP so if there is a ARP request ARP response with these, so somebody requesting
this first terminal that what is your physical address. So, it will request response will be
like that right.

(Refer Slide Time: 06:31)

1064
So, in other sense as we have seen what we have done a logical address or the IP address
to the physical address is the bottomline thing what ARP or address resolution protocol
does all right.

On the other hand, there is a concept of reverse ARP RARP all right. So, that is from if
given a physical address a logical addressing I want to know the logical address right.
Why this is required, will come to that right.

One of the thing what we can give that if I have a some sort of a terminal say dumb
terminal or a systems where I have the physical address because, I have an interface card,
but somebody else need to give me the logical address, I do not know I have connected
this terminal or a systems into this network and then I do not know that where the IP
address is there. Either I ask the system administrator that give me the IP address and
etcetera and he gives the thing or I somewhere other request to somewhere like a there
may be a RARP server, where I request to give me a logical address.

So, this is my physical address give me a logical address of this network and then I
consider as a all right. So, especially it is true for dumb terminals which are which are do
not have their own configuration saved, they request on the during the boot or bootstrap
it request for the for the IP address and there will get connected to the things right.

So, in other sense, I require some reverse resolution right and there are some other
scenarios where I want to know that what is the logical addressing of the things. I might
have get a request from the things then I want to know that logical address of a particular
system right. So, those are different scenarios where this RARP becomes important.

1065
(Refer Slide Time: 08:34)

Now, as we were discussing in the TCP/IP protocol suite where, this ARP or RARP sits
all right. So, one way of looking at it, they are interface between the IP and the your
MAC layer or data link layer all right. So, why these? Because, one side they are this
ARP or RARP have that IP addresses, which is your legal address which is a phenomena
of a network layer on the other side it has the physical layer things.

So, sometimes it is in some several literature is referred to as a companion protocol to IP.


So, it helps in (Refer Time: 09:14) in doing a in doing some sort of a address resolution
at the data link layer. So, ok, so this is there. So, in other sense in some of the literature
will find that it is a protocol which is in between like IP and then down layer is the data
link layer, so this is the in between nevertheless, it resolved IP to physical and physical to
IP in the reverse.

1066
(Refer Slide Time: 09:44)

So, ARP associates an IP with its physical address or a typically physical network such as
a LAN, each a LAN each device a on a link is identified by the physical or station
address or network address that is usually imprinted on the NIC right, as you are
discussing that NIC is the network interface card, which comes with the hardware
address and this ARP associates help us in associating IP address with the physical
address or the MAC address, hardware address, network address whatever we put or NIC
imprinted address or NIC address.

So, logical address to physical address translation can be done statically, also I can keep
a look up table that this is my logical address, this is my set of physical address (Refer
Time: 10:32) it is fine, so long you are it is not dynamic all right. The same systems are
there and everything configure then this is fine, not only it is straight forward it is also
sets time on this address resolution.

But in reality, it is not like that right. It is a you are looking for a dynamic network and it
becomes a huge network, there means there is a change you need to change everywhere
and type of things, so this ARP this dynamicity are brought in into the system.

1067
(Refer Slide Time: 11:07)

So, as we are talking that is system A and there is A wants to know about some node say
system B. So, what it does because, system a does not know that which IP address what
is the which one is the physical address all right. So, in a network, the A wants to send to
some system B all right. So, it is in the same network. So, it is single hop away all right,
but the A does not know what is the physical address of the things.

So, it cannot send the DLL at the data link layer or layer 2 frame to the B. So, what it
first need to do, send the ARP request that say anybody is there with this IP, send me the
physical address. So, ARP request is typically broadcast because, it is does not know that
where the things will be there right.

Whereas, only one fellow will reply whose physical address which logical address
matches with the IP and since the physical address, so it is ARP reply is unicast all right.
So, it responses with the B’s physical address that is A 4 6 E whatever.

So, whatever is there in the thing right. So, this is a example will find some literature.

1068
(Refer Slide Time: 12:32)

So, this ARP is ARP packet structure or packet format is like this. So, one is hardware
type protocol type, hardware length, protocol length operation type that is one for
request, 2 for reply all right and then what we require, sender hardware address, sender
protocol address that is from the if A to B is hardware address B’s processes hardware
address and protocol address and then targets hardware address and the protocol address
all right.

So, these are the things which are required out here. So, these are the things we require.
But what happened that when you are sending a ARP request it is not known right. So,
all 0’s all right, so it is not known that what is the targets hardware address there exactly
what the ARP request is looking for.

So, hardware address for ethernet type it is typically the value is 1, protocol type for IPv4
which is predominant thing is 0x that is 800, hardware length is the length of the ethernet
address in this case 6, protocol length is the length of the IP address which is 4 all right.

So, these are the things which an operations is either request or response for request we
send 1 and for response 2.

1069
(Refer Slide Time: 14:09)

Now, how this ARP packet will be there? So, ARP encapsulation of the ARP packet, so
ARP packet is encapsulated within an ethernet frame all right.

So, it becomes a payload into the things, rest you remember this preamble and SFD is 8
byte destination address and so and so forth are things are there, it is embedded into the
thing all right. This is the ethernet frame all right. So, type field of the ethernet is
0x0806.

(Refer Slide Time: 14:51)

1070
So, 4 cases can be there right as we were discussing; one is that your host has a packet to
send to another network on the same network all right another host on the same network
it can be in the same network. So, target IP address destination address in the IP
datagram. Here the host want to send a packet to another host on the another network;
that means, the host will send to the router right. So, it is on the other network, so it will
send to the router. So, target IP address, IP address of a router in this case IP address of
the in the IP destination address within the IP datagram in this case, the address is a
router. Third may be the router receives a packet to be send to a host on another network.
So, it is a router to router, so that need to be resolve all right. So, and the finally router
receives a packet sends to be the to the to the host; in other sense one is directly you can
send to the host; host if it is in the same network or host to some layer 3 device and there
are from it goes on and at the end of the things it goes on (Refer Time: 16:00) that is the
to the host router. Another can be router to router intermediate communication or router
to host on the thing right.

So, this is the 4 thing. Now incidentally if you look at the router, router has multiple
interfaces correct. Typically a router has a 4 interfaces. So, 4 interfaces 4 IP address, 4 IP
address and interface at it says that it has a 4 NIC card or in other sense 4 physical or
hardware address.

So, the router in return have may have multiple or will have multiple this sort of
interfaces. Now it depends that where the connectivity is there which path it is following
for that one router to another. So, there it depends that which particular interface
hardware address need to be resolved to get the get back the hardware address, so that,
the frame can be forwarded to the things. So, this 4 cases can handle all possible
combinations.

1071
(Refer Slide Time: 17:04)

Now, one example again from some (Refer Time: 17:06) if we look at a host with IP
address 130 23 43 20 and physical address something has a packet or layer 2 frame to
send to another host with IP address so and so and physical address so and so all right.
The physical address at the beginning while that initial source system is sending to the
destination is not known all right. The 2 host are on the same ethernet network, so that
means, it does not require those router etcetera shows the ARP, I want to look at the ARP
request and response.

(Refer Slide Time: 17:47)

1072
So, if you look at the ARP request path, so what it is happening? It does not know that
what is the hardware address of the destination rest are known right, 130, 23, 43, 20 so,
these are these are things which are embedded into the things right it is known 130, 23,
43, 20 in the x and it is also known that where 120, 23, 43, 25 is the destination that is
sorry, this is also embedded and this hardware address only it is what is not known is this
one right, the physical address of the things.

So, we make a ARP packet and forward it where it broadcasts because, it does not know
who is the owner of that IP address. Now on receiving one of the fellows whose things
matches is response which is the instead of this is physical address of the thing all right.
So, for it its own address becomes the whatever the address and the destination for it the
destination becomes this hardware address and the IP etcetera.

So, you see this one is mapped to this and rest are there right corresponding mapped.
And then, I then I know do not require a broadcast at the layer 2 level, then I can do a
unicast because, I know that where to be send right. So, it becomes again ethernet packet
and push into the network for a particular destination.

So, that is why, I can able to the things. So, this is a ARP request and corresponding ARP
response on the things.

(Refer Slide Time: 19:24)

1073
There is a concept called proxy ARP. So, this part is clear all right. So, just to before
going to the procedure let me just repeat it. So, this was my protocol packet, what we get
that once it is filled up, it filled a it is basically become a payload of the ethernet thing.
We are considering the ethernet once that is there, there are there can be 4 cases; one is
host to host, host to router, router to host and router to router.

So, this can be either in the same network or different network and based on the things
will be there, then what we have trying to see that how this things are formed. So, I have
that source having the IP and the hardware address whereas, the destination at the IP, but
are not the hardware address. So, if the packet is filled up accordingly correct. So, this
thing in the pink is that what it is not known and then once it is filled up, it is send to the
network in a broadcast move because, the IP address is not known, who is the owner of
this IP address is not known of destination.

So, once that is pushed, this fellow reads this and responds back resolve it whoever is the
owner of the things resolved it in a unicast mode. So, this is a broadcast whereas, here
we get as a B to A in a unicast mode. So, this is the bottom line of the ARP. So, at this
address is resolved.

Now a proxy ARP running in a router can so there is a concept of proxy ARP. So, let us
try to see what is a proxy ARP. So, at the term signifies if proxies for group of systems
right. So, as if it proxies for group of systems. Now a proxy ARP running in a router can
respond to an ARP request to for any type any of its proteges that is for its back end
systems.

The proxy ARP replies with its own MAC address when the packet arrives and the router
delivers it to the appropriate host. So, what it happens? There a proxy ARP typically
running on a router it whenever there is a request come for a group of systems which is
on the back of the router it responded with its own IP address. That means, it proxies or
take care of the all the systems. So, it absorbs the packet and then push the packet to the
rest of the network.

The proxy ARP router replies to any ARP request received right for the destination so
and so, 141, 26, 56, 21, so there are 3 systems 21 22 23, so it proxies on the things.

1074
So, on receiving the things it delivers the things and reply back and on their behalf. So,
what it happens we will see that there are lot of advantages in there. Not only advantages
in some of the cases, there is a requirement we need to do that. So, this is special case of
ARP where one server is taking care of the things.

(Refer Slide Time: 22:30)

So, proxy ARP or sometimes call also promiscuous ARP or ARP hack is a technique used
to map a single IP network prefix 2 1 or more physical address all right, using the same
network address space for more than one physical address all right. Assume that there are
two network A B connected by a router R that runs a proxy ARP.

So, using proxy ARP R can use the same network id for both the networks all right. So,
this is the thing it can do the proxy ARP.

1075
(Refer Slide Time: 23:10)

So, it is take a with a sub net marks. So, it with this particular router with a proxy ARP,
another network may be a PPP network, network B is so and so forth. So, this these takes
care connects those 2 network or proxying for the both the network A and B all right.

(Refer Slide Time: 23:36)

So, router R replies to ARP requests that are generated by the host on the PPP network
right. There is a network B and in which the target IP is on the network A namely it sends
the MAC address of the thing right.

1076
So, R knows which host are connected through PPP and so and so forth all right. So,
these hosts assume that the destination host on the same physical network right. In their
ARP tables, the router MAC address is associated with the destination IP address right.
Advantage of the proxy ARP over the networking scheme is simplicity of handling so
many things.

So, what it happening that in doing so, it as if things that it is in the same network. So, A
things on the thing and then send the ARP request to that router and which in turns
replies back on this B and on the other hand, it also takes care of the other part of the
thing; that is the network A, so it proxies on the both the side.

So, what it becomes say I want to increase a system, decrease a system, so long I am
handling within the network marks, I do not bothered about updating the ARP table
etcetera. So, this is one major advantage of handling this type of things right.

So, and secondly, that the manageability is now concentrated within how to handle this
router. Not only that if we look if we thing little allowed that or if we think little on the
broader aspect what you see that, now I have a handler or I have somewhere I can
basically control this who can access what or if I want to keep something allow that this
proxy ARP itself can be there. And in other sense, I can also restricting this broadcasting
thing to a large thing right. So, the broadcasting and congesting the network on a larger
this is a unable to restrict that.

(Refer Slide Time: 25:46)

1077
So, there are typically uses like joining a broadcast LAN with a serial network dialup
VPN etcetera where it will be a very helpful otherwise this interoperability etcetera has
to be handled that how this IP addresses will be address and so and so forth. Taking
multiple addresses from a LAN and making means more than 1 addresses from a LAN
and handling them on a firewall I can have some sort of a firewall level, what we say
operations into the things. There are issues of mobile IP’s right those IP which are mobile
IP’s where also it will be very helpful so that, I can have handling this mobile IP will be
much easier.

(Refer Slide Time: 26:37)

So, if you look at the ARP module per say all right, what that ARP want to will have?
One is that, I sends requires sender things, but from the operational point of view they
not then that may not be very cache or helpful right. Once so what are the things it will
be there? There can be a cache table with caching that what are the recent resolution.

So, that if there is request coming within a shorter time period, it can reply from that
cache only, there can ARP queue output module input module and cache control module.
So, these are the typical modules which is there in a ARP suite all right or what I can say
ARP software package.

1078
(Refer Slide Time: 27:25)

So, cache table if the ARP is just resolved an IP address chances that are few moments
later there is a request to resolve the same IP address.

When ARP returns the MAC address is placed on the cache. When the next request come
for the same IP address look at its cache and reply back. So, it saves time saves network
bandwidth and so and so forth.

So, cache table typically contained a queue number which queue the ARP request is
sitting in, attempts how many times have it has been tried for the resolution timeout, how
long you can go on trying before the things that it is flushed out, hardware address
destination hardware address and protocol address the IP address. So, IP address versus
hardware address is the mapping function and there are other things which needed to
manage those things.

1079
(Refer Slide Time: 28:19)

So, working of the caches is straight forward, there output module waits for an IP packet
for a request. Checks that cache for an existing request, if the entry is resolved that is or
sometimes say that is the entry becomes R, we have already have this MAC address. If
the entry found and the state is pending packet waits until the destination hardware
address is found.

So, either it can be resolved or it is in a pending state.

(Refer Slide Time: 28:47)

1080
So, like typically original cache table used for those examples if you look at or some
example scenarios like we say that there is a state is resolved, queue is 5 time out time is
9 out 900 after which it will be flushed out, protocol IP is this and the hardware address
is this.

So, within that if there is request come, so if it is a pending, so is there it is still pending,
pending resolve some of the things and this time out period is going on. So, after the time
out period goes off that cache flushed out. So, that it is a older version of the things.

(Refer Slide Time: 29:30)

So, ARP output module receives an IP address from a IP layer with the destination
address and so and so forth all right. So, it is getting a module that 114 dot 5 dot 7 dot 89
it is there, 114 dot 5 dot 7 dot 89, it is already resolved and resolved state and or within
the time period. And finds that there existing there in the revolved state R table it extract
the hardware address whatever the hardware address and sends to the packet and the
address to the data link layer for transmission.

This cache table remains the same. So, it is nothing to change it goes on doing that.

1081
(Refer Slide Time: 30:15)

So, scenario 3, the 20 seconds later ARP modules received a IP datagram from for the
destination 116 dot 1 dot 7 dot 22, it is there 116 dot it is not there right. It checks the
table and find that the destination addresses not present in the table right.

So, it creates a so the module adds a new entry for the state pending with the state
pending and attempt is one. It creates a new queue in the destination enqueues the
packet, is then sends a ARP request to the data link layer for the destination the new
cache table will be looking like this.

(Refer Slide Time: 30:57)

1082
So, there is a new entry of 116 dot 1 dot 7 dot 22 right. 116 dot 1 dot 70 this with an IP
entry and there is a new queue is there with that attempt is 1 all right.

(Refer Slide Time: 31:13)

Example 4, fifteen seconds later the ARP input module receives a ARP packet with target
IP 118 dot 11 dot 8 dot 71 right. Let us check whether, it is there 118 dot 11 dot 8 dot 71,
it is that the module checks the table, if the it changes the state to resolved right. ARP
modules receives a packet with a target IP this is the module resolved and sets the second
and 900, the module adds the IP address sorry MAC address or the hardware address
these to the entry.

Now, it accesses it accesses queue 18 and send the packet to the queue the new entry is
there. So, what is there, it was in a pending state now it receives the thing what that is
sorry 118 dot 11 dot 8 dot 71, 118 dot 11 dot 71 and then it resolves the with a IP address
MAC address like this.

1083
(Refer Slide Time: 32:09)

(Refer Slide Time: 32:12)

And there may be a some 25 seconds later, the cache control module updates every entry
the time out values for the 3 resolved entries are decremented by 60. And the timeout for
the last resolved decremented by 25, the state of the entry is resolved to free because the
timeout is 0 right.

So, for each of the 3 pending, so what we are doing? It some sort of a house keeping
thing. So, once it is there, it checks the timeout decrease decrements the timeout or if it is

1084
the timeout, I expired it flush out the things and make it free and then the new table
becomes like this all right.

(Refer Slide Time: 32:53)

So, it goes on doing this so that. So, you see this table handles this IP with a MAC
address right and also it go on updating it over a on a periodic basis. Now any request
come first consult the table all right. So, this is important, this ARP cache table or ARP
table is important because, it gives it makes a proper maintenance of the things, makes
the overall communication process at the data link layer if you send in other sense, at the
all the upper layer things much efficient to handle this right.

So, what will we have seen now that how a higher level address, while packet coming
from the higher level or this address need to be resolved to the hardware address, so that
it can be transferred to the things all right, to the next hop. So, I again repeat we all
though will or know that in order to transfer I need to require at a that layer that level,
that is layer to level hardware resolutions. Once it is done, the packet is forwarded or
switched from to the next hop. So, with these let us conclude our this present lecture and
we will continue with this discussion in the subsequent lectures.

Thank you.

1085
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 52
ARP-RARP-BOOTP-DHCP (Contd.)

Let us continue our discussion on this Computer Networking Internet, we are discussing
on layer two label or layer two protocols rather some of the protocols are companion for
the higher level protocols namely ARP, RARP, BOOTP, DHCP right. So, already we had
discussed in our last lecture about ARP and we will try to see other protocols that how it
helps in this overall communication process.

(Refer Slide Time: 00:47)

So, just to one or two slides on the recap that any two machines on the network can
communicate only if each other physical address network address is known. So, unless
you know the physical address the things cannot be communicated. So, there is a need to
resolve the higher level IP to a low level machine address or MAC address so that you
know that the next of the next of things.

So, any transmission whether it is host to router, router to router, host to host, router to
host what is required is it trans when the next stop things what is the hardware address of
the MAC address of the things right; so, that exactly the job of the ARP or Address
Resolution Protocol. Also we have discussed about some aspect of proxy ARP, the

1086
different component of the ARP package that which makes is possible like. So, there is a
need of caching of those things so that the next request comes and can be addressed in a
much easier fashion.

(Refer Slide Time: 01:59)

So, this is the very popular diagram. So, logical address or the IP address ARP to
physical address, on the physical address RARP to the logical address. So, there is
another companion protocol we or the other protocol means the, protocol with ARP is the
RARP, Reverse ARP that is given the MAC address or given the physical address how I
can resolve to the IP address.

So, where it may be possible requirement, we have seen that where things may be
require, one of the major thing is that if I have a dumb terminal wants to know what is
the IP address during the boot time etcetera then there may be a reversed resolution. I
may want to know that if I get a request of I want to do a reverse resolution and see that;
what is the IP of the thing. So, in case of connecting other things like VPN or some other
type of lines I want to there where the IP address need to be allocated based on the
network address and so on and so forth.

1087
(Refer Slide Time: 03:04)

So, finds the logical address for a machine that only know this physical address; the
physical address to the logical address mapping. This is of an encounter on thin client
workstation, as we have seen thin client workstations no disk. So, when the machine is
booted it needs to know its IP address.

So, in case of a thin client workstation if machine wants to know that IP address to be
getting connected with the network and so and so forth. RARP request are broadcast as
we have seen in ARP, RARP replies are unicast because you now you know that where to
send the reply. If a thin client workstation needs to know its IP address it is probably also
needs to know it subnet mask, router address, DNS address etcetera right. So, if you just
recollect or remember that if you want to do your IP configuration or so to say TCP/IP
configuration in your windows or Linux machine.

Some of the case, what are the different parameters you will be looking at? If we
recollect or if you remember say one is that IP address right, IP address what it gives the
logical address to the system, other than I what we require if the subnet mask right. Why
we require this subnet mask? The subnet mask allows me to when I, allows me to find
out that whether the other address is within the in my network or not. So, it is a subnet
mask. So, there is a gate way address like if the thing is not within my distances within,
not in within the network so what should be the next of gateways of that particular
packet.

1088
So, there is other of the DNS. So, if there is a domain and resolution is required then;
where is the DNS server is located. So, there are DNS usually primary and secondary
DNS. So, these are the things what we require in the thing. So, subnet mask or router or
the gateway address and DNS address and etcetera.

So, when a system boots thin client boots which do not have the memory of memorizing
the or remembering its configuration may wants to note that IP address, subnet mask,
DNS addresses and type of things. If we need something more the RARP, other than only
resolution there are other protocol call BOOTP will come to that, and also a the upgraded
or variant of the things which is DHCP which have replace RARP. So, RARP from there
we have BOOTP and type of things. So, all what it knows this physical address right
from there it want to populate its network property stack. So, that it start communicated
communication in the network.

(Refer Slide Time: 06:00)

So, as we have seen in case of a ARP here also that with physical address it gives
advertisement and the logical address is sent to the back to the host. So, there can be a
RARP server or some of they will require means the host sends a request the RARP
server sends the response of the on based on the request. If it is continuing that particular
hardware address from the logical address can be derived.

(Refer Slide Time: 06:37)

1089
And if you look at the packet format it is somewhat similar with that ARP things,
operations is 3 is request 4 is a response. And if you see here the sender hardware
address is a known; hardware address is known, where as sender protocol address is
unknown. So, because I the sender that is thin-client know that what is its hardware
address, but the thin-client does not know where what is the IP address that is it is
looking for.

So, what it says it sends request to that particular RARP server; the sever respond back if
there can be more than RARP server, the server which is having this things that mapping
of MAC address or the hardware address to the IP address respond responds back that
sending the this is the IP address and gets populated to the sender. So, in the previous
case it was there while sending the packet it is looking for that hardware address where
the frame can be forwarded. In this case it want to know the network address so it gets
connect can get connected to the network right.

So, if you look at sender’s hardware address protocol address or IP address is not known
in this IP b 4 for 4 bytes, whereas the target hardware address is known and the target
protocol address is known. So, where the server is there it is known to the thing.

1090
(Refer Slide Time: 18:08)

And also in case of Ethernet what we have that is goes payload to Ethernet over all is
Ethernet format and Ethernet packet and Ethernet frame and it goes as a data that is
whether is request of response in case of a RARP. So, what we say that the next step of
on upgraded variant of RARP is the BOOTP.

So, which as we are discussing that not only the IP address there are other parameters
which as equally important for the network. So, to say the parameters like IP your
network mask gateway or router address, DNS addresses and these are equally
important. So, that the server which is responding to this request should also should also
send back this are the parameter. So, that the network stack of the originating missing or
the thin-client gets populated so that it can connect to the network right. So, for that the
BOOTP server should have this capability.

1091
(Refer Slide Time: 09:37)

So, bootstrap host protocol allows a host configure itself dynamically at boot type. So,
that is the basic philosophy where the BOOTP protocol allows a particular host like thin
client and so, to configure itself dynamically at boot time. This protocol provides three
services, one is IP address assignment as did in RARP detection of the IP address of
serving machine right, it need to know that who will give the IP address and detect the
thing, the name of the file to be loaded and executed at the client machine.

So, it its get loaded and that file to be executed. So, it gets populated by this it helps in
populating the networks stack BOOTP protocol typically assumed to be never
fragmented. That means you get the whole thing in a one unfragmented message. So, it is
not fragmented. So, it is not like that two three and things are coming. So, this is BOOTP
protocol is not fragmented.

1092
(Refer Slide Time: 10:37)

So, as we are requesting for a service it works on to very well known port, well defined
port number one is for 67, where the server works and the port 68 where the BOOTP
client works. So, that is a defined port.

Process the BOOTP client broadcast a single packet call BOOTP request packet
containing the max client MAC address the client waits for the response from the server,
if not received within a specified time the client determines the request the server
response with a BOOTP, BOOTREPLY right. So, it sends a boot request packet
containing the MAC address clients MAC address that this is my MAC address you send
me the other details, the client wait for the response from the server. If not received
within a specified time period resends it, it is retransmitted the server responds with a
BOOTREPLY packet.

1093
(Refer Slide Time: 11:39)

So, few more basics on BOOTP or few more things the points to note; BOOTP is
alternative to RARP which operates at the data link layer for LAN only right. So, it is a
alternative to RARP, BOOTP is a UDP/IP based configuration protocol provide much
more configuration information allows dynamic configuration of the network IP network
configuration.

So, if you see, these are different companion protocol which has upper layer linkages and
also have needs to deal with the lower layer two level MAC address right. So, that is why
we are trying to look at the when we are discussing this DLL of the layer two level
phenomenon right. So, this is one of the important aspects to be known, to be seen. So,
BOOTP any extension become the basis for DHCP protocol right that will come to that
next upgradation of the BOOTP the DHCP right, DHCP protocol.

1094
(Refer Slide Time: 12:46)

So, if you look at the BOOTP packet format it is much enriched than what we have seen
in case of RARP.

So, operation code, hardware type, hardware length of account, transaction ID which
requires where it is sending number of second part it is with some person is and use them
is a client IP address, your IP address, client server IP address, gateway IP address and
then what we require that client hardware address server name and so and so forth. That
means what we are and there is a boot filename. So that it is downloaded and executed
during the bootstrap and there are some options (Refer Time: 13:41).

Now you see what where it is in this cases is required is I, it required a BOOTP server
which will respond to the things. So, the BOOTP server typically holds this MAC or the
hardware address to IP address mapping. Or in other sense in some cases if we when you
look at the DHCP will see it is has a pool of addresses from where the IP address being
allocated right.

So, it is much more managed and this is well known phenomena what we see when we
work; we when we work with thin-clients and the clients which do not have IP address
attached to it right. So, during the boot time it gets the IP address and the configuration
and start configuring. So, though there are in first chart we see that the challenges that is
having a thin client and this thin client of this BOOTP clients may not have the initially
the IP address, but you see there are if there is centrally manage things. So, the overall

1095
management may be much better when we look at the things right so configuring the
overall network will be much better.

In some scenario where you required is dynamic allocation of thing of network


configuration files, this are pretty helpful or pretty much needed for this type of
configurations.

(Refer Slide Time: 15:19)

So, BOOTP if you see operational code the value is one for boot request and boot reply it
is to that operation code, hardware type value may be a value is 1 Ethernet to
experimental Ethernet, frame relay ATM it support a variety of layer to layer to level data
driven level protocol like it can be Ethernet, it can be experimental Ethernet, frame relay,
ATM and different type of flavors it supports right, then if you look at the operation so
these are the things; and if you look at the operations.

1096
(Refer Slide Time: 16:01)

So, server at 67 port on UDP it keeps a passive open and when there is a request from the
thing, from the client from port 68 it replies back with the with a UDP and means UDP
and reply back UDP packet right. So, as if you see the request with a destination port
means source port, destination ports, source address destination port goes on and it gets
replies back on those line, right. So, what we see that my source address may be initially
not known, see if you see that if it is source code is 67, destination port is 68, source
address is the server unicast address and destination address is all 1. So, the clients
unicast address right. So this way it goes in to the things. So, it may be the client may not
have any address or the client may be having a address that all are not that all you
remember the previous address and try to conform that way the still address it will
continue with this address.

1097
(Refer Slide Time: 17:29)

If we look at the next or the predominant variant of this MAC to IP configuration is a


DHCP Dynamic Host Control Protocol. Now let us look at it, not as a MAC to IP
conversions only; it is basically meant for dynamically configuring the network stack of
a particular host right. Being a particular host I want to dynamically configure the things.

So, this is not only required for a dumb terminal, but several other scenarios where this
network configuration needs to be dynamic configure when the request come. So, there
are scenarios where in several situations where it is DHCP configure. So, in the machine
puts its requests for that keep me IP address and other configuration and it get the
networks stack of the host gets configured and if you see in today’s several organization.
Even in our IIT Kharagpur network labs and other places where number of systems
there. They are DHCP configured means while booting ideally they request for the
DHCP server which is somewhere in the network and it gets that configuration to be
loaded. As I was mentioning other than getting the IP address connected this gives a
enormous control over that which IP range you want to allocate and what are the
gateways you want to push through and it gives a lot of management related handles to
this type of configurations. So, this is a now a very well known practice to have this sort
of configuration in to this sort of structure in the start of a protocol or process into place.
So, that way the system gets configured dynamically while booting.

1098
(Refer Slide Time: 19:38)

Now, it is used to allocate manage TCP/IP configurations of the client notes as we have
mentioning right. So, it is centrally allocated and managed TCP/IP, allows a
administrator to define pools of IP address which are then allocated the client computers
in the things. So, it can be pool of IP address says CS IIT Khargpur this pool is there
from there the system can be allocated, this pool of addresses of often known as a DHCP
scopes right, not all the addresses is handed out.

So also, the related configuration settings like subnet mask, default router of the gateway,
DNS server etcetera these are also can be configured. So, the DHCP server per say
contains those informations which can be let out to the things right. So, this is one way of
looking at that DHCP server and it is a as I mentioning practice in several organization
and installation to look at to for dynamic configuration of the network.

1099
(Refer Slide Time: 20:49)

So, how it works? DHCP works across most IP routers, allocates IP address depending
on the subnets and the request came from no need of configure of a PCs that is move
from one subnet to another.

So, it is it event across the thing. So, we when there are concept of DHCP release if it is
not within the DHCP server within the network it goes across the there are DHCP release
which can send the request across to some other network. When a DHCP client is first
switched on it sends a broadcast packet to the network with a DHCP request, there is a
picked up by a DHCP server. If there are more than DHCP server that will picked up to
the DHCP server and server allocates an IP address to the PC for one of scopes it has. So,
what you say that it is some sort of discovering a server and then getting bind with that
with that particular IP and other configuration of the server it is having. Now DHCP per
say do not allocate a address or addresses permanently.

So, it leases the address for a particular time period control by administrator right. So,
this for a particular time period and controlled address by a administrator right. So, it is
that how much leasing etcetera is there. So, this is give lot of manageability in to the
things like if you want a particular sector of the things you put a configuration for a
particular set of systems. Then once that time period goes up you can basically take out
those IP out of the things goes the system goes out of the network right or it next day you
can put them on next instant, you can put them separate bundle of IP address blocks. So,

1100
this gives a better manageability of the thing that over all that how you handle and
manage the your internal system within the network and so and so forth.

So, DHCP packet as like we have seen in the BOOTP also contained several similar
fields there may be some one or two changes, but there is mostly same type of fields and
what we see if we look at the configuration of the things.

(Refer Slide Time: 23:20)

That initially as we are discussing in that over all operation, it that initially when it
system boots it sends a some sort of a broadcast massage to there to find out that whether
any server are there and not. As I was mentioning that if it is the server is not within the
network there is process of relaying the request to the other network there may the
DHCP server.

So, it is DHCP discover is the process which goes on, then several server can offer that I
am I am ready to serve, I have a IP address that ready to serve more than one server is
there. So, ideally DHCP things selects one of the server and it goes of a DHCP request,
that requesting to give the IP address and other network configuration. So, that is one of
the aspects and on receiving the request DHCP server; the request the DHCP server
allocate a IP and other configuration files right. So, it is DHCP acknowledge, once that is
there it goes on bind with that particular configurations right. So, this is if you look at
this process. So, this is the process of getting and gets configured into the things right.

1101
So, it initializes has to repeat it sends a discover message, the potential server sends a
discover DHCP offer and DHCP request and requesting and DHCP acknowledge and it
sends a once that one of the server things are there acknowledge and it sends a DHCP
acknowledge and bound to that particular configurations one it is there it is attached with
that particular DHCP server. So, once it is attached to the DHCP server now the next
things come in to the play as we were discussing that it is not a permanent allocation of
IP address right. So, the IP address or the other configurations are not primarily
allocated. So, in other terms it is a lease to the system, lease to that particular requester of
the host.

Now once that is lease to the things so after the expiry of the lease period things will be
recovered or it need to return the things, but there are two situation the DHCP may
request for a renewal of the lease right. So, it may request for a renewal of lease, when it
can request (Refer Time: 26:12)? When there is a lease time 50 percent expired, it sends
a typically sends or it at any point of time it can send, but it typically send other DHCP
request so renewing of the things. So, there may be two operations that is either it is
acknowledge, that is renewed and it is gets to bind. So; that means, it sends a after 50
percent DHCP request it for the renewing it acknowledges as a positive acknowledge and
it goes to the binds and the new time starts right.

So, this is may be the one thing and if it not acknowledged positively in a that if
DHCPACK it is not received the lease time 87.5 percent was expired then there is a
another DHCP request right. So, request of DHCP. So, it is rebinding goes in to play
right DHCP acknowledge and again bind into the thing right. So, see two aspects are
there, one is after 50 percent it sends a request gets a acknowledge rewind or rebound to
the particular a stack does not have to new IP and the and the things works on a smooth
vessel and that can be the thing that it may not be renewing that, may not receive the
DHCPACK.

Then it gets a after 87.5 percent it sends a fresh request, then again the rebinding
operation goes on. If there is positive acknowledgement it gets again bind to the thing
with the thing and goes on. If it is still not acknowledge that means it is DHCPNACK.
So to say, that is the DHCP the lease is not been increased by the server then it goes for
the again initial stage right. So, if it is again requested goes for the initial stage, again
request for the fresh allocation and the process continues right.

1102
So, this is the way, but there is another connection if you see. If after the binding so there
is the client can release it DHCP release work is over release it or leases cancelled mid
way. So, that can be may happen, the lease is cancelled mid way in that case also it goes
to the initialization state right. So, that again this recovery its discovery of the DHCP
server getting some offer and go and so forth. So, there is one process or it can other
process, should see if we look at this whole flow diagram it is it is interesting to see that
the IP configuration is leased to this client.

So, it can be any client right, any serves right like as a mentioning most of the systems in
IIT Kharagpur network are on DHCP lease right. So, they request once boot the request
for the IP; IP is allocated and it goes on IP another configuration is you know and those
lease period after the period defined period goes on reactivity right.

(Refer Slide Time: 29:34)

So with this, if we look at again that thing; so, the DHCP server again 6 port 67 with
UDP passive open so, that the DHCP discovery as we have seen here, the process come
in to play and it offer reply with DHCP offer; again if you look at it is offer then DHCP
request. And this a DHCP positive acknowledgement or acknowledgement to accept the
things and go in that particular accepting the IPN other configuration at gets bind with
that particular thing.

1103
(Refer Slide Time: 30:11)

Now, after 50 percent of the time a lapse time expires the DHCP request. If the server
does not respond the request is repeated after sometime that is the 87.5 percent time
expire, then it goes for a DHCP request if the server respond with the NACK that is not
acknowledgement negative acknowledgement then the client must start all over again
that goes for the initialization and so and so forth the DHCPNACK.

So, if the server response with an acknowledgement and the kind as new lease that is the
new lease of the thing and so and so forth. So, there are other options we have seen in
here DHCP release and lease cancelled stuff where it is again goes to the that machine
the DHCP list is released or that for things.

So, what we see in this protocols like from ARP RARP BOOTP or DHCP protocol what
we see these are the protocols which allows this data link layer to have the say so to say
at the connectivity level how things works right given a IP how a hardware address can
be resolved and proved given hardware address I can get the IP configuration. So, it can
be connected to the network. So, there is more of a configuring the network aspects of
the thing which come in the play.

So, these are all important protocol and these are some of what we say border level
protocol or transition things where which connects that that other part the IP networks
and others with the data link layer helps in forwarding the packets right. In some of the
literature they kept is in the IP layer itself some of the things you will get in the border,

1104
but nevertheless it involve both IP and the MAC things and rather more of IP a if you
look at the RARP BOOTP and DHCP it requires IP level configurations and the
hardware address things I means from which it can be requested and populated. So, these
aspects are as important as we have seen error control and flow control in data link layer.

So, with this let us conclude our lecture today. We will continue our discussion with
other aspects of layer two, and also will finally we look at some aspects of layer one or
the physical layer considerations.

Thank you.

1105
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 53
Connecting LANs, VLAN

Hello, so we will be continuing our discussion on data link layer on this course on
Computer Networks and Internet. Today we will be talking something on connecting
LANs and a concept called virtual LAN or VLAN this is keeping that other technologies
in place, we will try to see that how LANs can be connected whether the what are the
issues into this connection of the LANs etcetera right.

As we understand that in our modern day labs or modern day offices etcetera. There are
several networks right or what we have talking about layer two networks right they need
to be connected right. And in not only that lot of if you look at the today’s applications or
today’s operations of any organization, any section, any division, any department. They
are primarily dependent on applications which runs over networks right.

So, it become it is becoming a what we say that it is becoming a necessity to keep this
network always up. In doing so the network administrator loves to have a multiple
connection into the connecting network right. So that means, between two LAN there
can there should be more than one connection. So, that if connection is teared off fail for
some reasons, or other the other connection popup and start executing. Indeed doing so
there may be lot of other issues right. So, even there are redundant connection how to
manage them etcetera. So, connecting LAN in a appropriate fashion or in a seamless fail
proof way is a challenge.

So, we will see that a basic consideration that what how do you connect LANs and type
of things today’s lecture. And also see a concept called virtual LAN right in the thought it
is not only a layer 2 phenomena, it requires for routing layer 3 type of thing that we will
see that three level routing activity. But we see that it also helps in handling the things.
Another concern of our in case of layer 2 is it is in the same broad cast domain though
the collision domains are divided, but still they are in the same broad cast domain, so that
dividing the broad cast domain into different things. So, that it gives better manageability
better security of the traffic and all those things that will try to see in this lecture.

1106
(Refer Slide Time: 02:59)

So, if we come to the basic slides, or basic philosophy of layer wise connectivity, or peer
to peer connectivity. So, what we will see that in the physical layer is hub and repeater
which are primarily signal regenerator at layer 2 or data link layer. We have layer 2
switches or bridges which bridges LANs etcetera LAN.

And we have also seen that MAC layer protocols and other things. Layer 3 is a primarily
that network activity one of the major part is or activity is routing. And then at the other
layer there are primarily application to application connectivity, or in transport layer it
gives a reliable are this is a that what we mostly say that there are gateway connections
between the two applications.

And as it indicates it is there can be multiple hub within the things and it goes on like
peer to peer. And also we understand that intermediate devices can open the packet up to
the layer it is enabled. So, if it is a hub or repeater it is it can see that layer 1 where as if
it is a switch or bridge it can switch about layer 2 and so and so forth right.

And further we understand that your any upper layer phenomena or any upper layer
device can have all the lower layer capabilities like a layer 2 bridge or switch can also
have a signal repeating capability, or repeater capability. Like layer 3 switch has a
definitely a switching capability and also a repeating capability right.

1107
So, hub a higher in the layer you have the capabilities doing the things. Then why not by
the something which is a layer 7 11? One of the major constraint is the cost right here,
we have a huge cost on the if you go up in the ladder right.

So, you may not require that much cost to be invested. Secondly, more is the capability
more is your processing time right, so that is why the cost is higher and not only that you
need to process. Like so you may not want to have so much thing or you need to plan
accordingly where you require layer 2, layer 3, layer 4. All upper layer capability
switches right.

So, these are different consideration which has a separate way of system administration
and management per say which need to look at that what are the things there. Other
aspects what we look at is the scalability right the network should be scalable right. So,
today I may have 10 systems, tomorrow I have 15 systems. So, I that most of your
networking infrastructure are somewhat it is in the backbone and changing them now and
then is very costly affair right. Costly affair in terms of monetary items, costly affair in
terms of other configuration power etcetera.

So, when you increase the things there should be able to scalable; scalable to a definitely
to a range type of things. So, those things has to be kept in mind when we design the
things and this different type of things we are what we are discussing may help in able to
do a better management of the things.

(Refer Slide Time: 06:21)

1108
So, if we look at the repeater or hub its act as a signal regenerators, so I can have a 1
segment, 2 segment, and there is a repeater in between regenerates the things. But
nevertheless it is in the same broadcast and collision domain as it is in layer 1. And so
connecting more will in you will have a problem of more what we say more crunch on
the bandwidth. Because if there are more collision that more repetition of the things
etcetera right.

So, it has does not have any filtering per say because whether it understand layer 3 IP, or
layer 2 MAC right. And I can have hierarchy of hub a hub a say couple of hubs below
the level and couple of so, it is I can hierarchy of hub. And again it save a lot of
bandwidth side.

(Refer Slide Time: 07:13)

So bridges on the other end is a layer 2 phenomenon which connects LAN, separates
collision domain. So, bridge typically a LAN is in a different collision domain. But same
broadcast domain or bridges also separate the collision domain even if they are in the
same collision domain when I bridge them with layer 2 switch they are in the different
collision domain.

So that means, I have say file 5 LAN network, or 10 network connect with a bridge, or
say two LAN network connect with a bridge. Usually bridge bridges are typically two
port when it is multiport bridge we say a layer 2 switch right. So, this is convention there

1109
is nothing harm in talking that number of connection in the bridge, but this is the way or
showing domain the bridges.

So, they use MAC layer, MAC address for filtering traffic; connecting segments form a
single network same broadcast domain. So once it is connected it is becomes a single
network. So, I we have a bridge network which is a single network; that means, in the
same broad cast domain, but different collision domain right. So, that is none of the
aspect of the thing and it can filter based on the MAC address, so that is the another
property of bridging.

So, like here what we see that there are in one LAN there are two systems with this MAC
addresses. And the other LAN there are the two systems and there is a mapping things
that or which MAC address is connected to which port, which MAC address is connected
to which port and these are the mapping things right.

(Refer Slide Time: 08:53)

So, if you see that in the port 1, so that the bridge has a 2 ports, port 1, these two
machines are connected port 2 machines are connected port 2 machines are connected,
and here is the bridge table. So, what to from there what we see that bridge initially does
not know who is connected 1, where once the data trans start transmitting the bridge start
learning this once it is learn then it is not that the port thing.

1110
So, if a request comes from this particular thing it knows that it need to be host to port to
port 1 it not to the port 2. If this is a multiport bridge or a layer 2 switch there can be a
more bigger diagram a bigger table, but nevertheless I can forward the data into the
appropriate table right.

So, this is this way it able to learn and have divide collision domain and type of things
right. So, what we see it is a still in the same broadcast domain, but two different
collision domain right.

(Refer Slide Time: 09:53)

So, I can have bridge or layer 2 switch with multiple connections and as we attaining that
it is it will learn that initially when A sends to D. So, that it learns that A is connected to 1
and then typically C after E sends to frame A; it learns that E is in 3 and so and so forth.

So, while communication goes on B bridge goes on learning and the bridge table goes on
populating populated. So, once the bridge table is populated than it basically now it is
easier to the forward packet. And it basically works gives a better performance in terms
of bandwidth; that means, the collision domain etcetera are broken into different things.

1111
(Refer Slide Time: 10:43)

So, there is a problem in bridge like, so as we are mentioning initially that given a
network the it is it is sometimes desirable, and sometime make it making it some sort of
fail proof or having multiple connection between the network. So, I have say connected I
have a say cash section, or a administrative section and a account section and then I have
lot of communication. So, if there is a communication break the things may have become
problematic. So, what we do? We have multiple connection between these two LANs
right.

In doing so whether we are end up in a some problem right here in this a typical case it is
shown that A is sending to D a message and it is it learns that A is connected to port 1,
and bridge 1 and 2 does not have any connection to those are all transparent bridges and
it also LANs that this is A is at 1 port 1, and then this message is broadcasted and the
when this gets that message. So, it gets the message A from bridge 2 as a from the at port
2 and then it converted to the port 1.

A is connected to port 2, and go on doing this in a circular fashion. As if you remember


as the as our basic Ethernet, Ethernet frame does not have any TT a lot time lever where
the timeout will be happening that is so to say. So that means, it goes on learning it goes
on in a loop, and that creates a problem in the whole bridging thing. So, there so one of
the one of the major challenge when we have this out of a bridge network all layer 2
switch network is how to handle this loops right. There should not be any loop into the

1112
things otherwise it will it not only it away all the bandwidth, it also creates a problem of
communicating between any source to destination.

(Refer Slide Time: 12:55)

So, that is why you need to deploy some mechanisms. So one of the popular mechanisms
which is being deployed is the STP, or spanning tree protocol right. So, handling loop
problem in transparent bridge right, so spanning tree protocol. So, in this case if you see
LAN 1 is connected to LAN 2 one connection. LAN 1 is connected to LAN 3; 1
connection and so and so forth.

In other sense from LAN 1 to LAN 2 there are several ways I can connect this through
this I can connect this through this I can connect this through this right. So, there are
multiple way how we can connect LAN 1 and LAN 2 right, so two LANs right. So, and
in doing so we end up in that loop problem right if we allow this it will end up in a
problem.

So, what we need to do is to handle of this. In order to handle this what we need to do is
to look have a mechanism, or spanning tree protocol, that means I need to generate a
cycle free all loops free connectivity, or if you consider as a graph this one a loop free
graph into the thing.

1113
(Refer Slide Time: 14:11)

So, how this spanning tree can be implemented out here or how do I do that? So, in
incidentally every B has a unique ID. Let me say every B layer to see has a unique ID;
that means, B1, B2, B3, B4 let it be the unique IDs, so the select the bridge with the
smallest ID as the root bridge. So, what we select here that the bridge means smallest ID
than in this case B1 as the root bridge. So, that I have a bridge tree, so the root bridge is
the bridge with the smallest ID, mark one port in it bridge except the root bridge as the
root port right. So, the root port is the port with least cost path from the bridge to the root
bridge. So, every bridge will have a root port which has the path to the root bridge as a
least cost path right. Now least cost may be a consideration from the system
administrator whatever organisation or whatever organization thinks it may be the
minimum distance minimum hop to the path, or it may be the congestion free bandwidth
driven etcetera. So, that is the least cost path between the any root any note to the any
bridge to the root bridge and that particular interface is marked as a star right, or say one
star.

For each LAN choose a designated bridge. So, for now on the for the LAN we need to
choose a designated bridge the designated bridge as the least cost path between the LAN
and the root bridge right. So, that is the designated bridge as the least cost path between
the LAN and root bridge. Root bridge the arrows mark the corresponding port and
connects the LAN to its designated bridge the using the designated port right.

1114
So, the mark the corresponding port that connects the LAN to its designated bridge as
designated port right with a two star. So; that means, designated that LAN to the
designated bridge is the through this term.

Now mark the root port and the designated port as the forwarding port. Now we are
coming to that that mark the root port and designated port the forwarding port rest are
blocking ports right the or every port with one on start are kept ports with no star are
dropped right. So, this is the thing or our basic objectives is or the final goal is to have
there is only one path between any two bridge, so other are in block stage and there are
only one path between any two bridge.

(Refer Slide Time: 16:51)

Now looking applying STP, if we see so this is my root bridge and accordingly we
connected by 2 star or 1 star which is from this every bridge. And there are so these are
all marked as forwarding where as this fellow, this fellow and this fellow are marked as
blocking.

1115
(Refer Slide Time: 17:19)

So, if you if you see so this not having star, this also not having star, this also not having
star, so these are having blocking. Now you see for every LAN there is only one
connectivity to this other LAN like LAN 1 and LAN 2 through B 1; LAN 1 and LAN 3
to B 2; LAN 4 to LAN 2 or LAN 2 to LAN 4 by B 4. So, this is the only these are the
only connectivity; that means, every LAN has one connection, one connectivity or one
path to this any other LAN.

So, this STP, or this spanning tree protocol ensures that right. Again if you look at the
spanning tree protocol is not done that new it is well studied, but it is a application of this
things becomes much interesting. Now with this, now I can allow a redundant
connectivity right. So, if the connectivity goes off then I can have a option of switching
to another connectivity to do that. So, the connections will be one is forwarding’s mode,
another in the blocking mode.

1116
(Refer Slide Time: 18:33)

Now if you look at the backbone networks. So, there are different variety of back bone
network, one very popular backbone switch is that multiport switch. So, in this case 6
LAN a typically multiport switch ranges form say 8 to 16 to 48, even higher than that
right. So, these are the ports which are there in the multi port switch and acts as a back
bone with a star connection.

(Refer Slide Time: 19:01)

So, we can have a bridge connection; that means, there are 2 LAN’s, 3 LANs connected
with bridge and point to point or point there several point to point links between

1117
connecting between the bridges. So, these are this is also possible at the back bone that
how it correct to the thing.

Now so what we have seen till now? We have we have looked into a bridge network. So,
there are these are several LAN segments, LAN segments and we have layer 2 bridges or
layer 2 switches which connect this LAN right. Also the one interesting thing is that as
they are may be redundant connection any source, and between 2 LAN; that means, more
than one connection. So, at a time one of the connections will be made active right.
Otherwise there will a problem loop or what we say bridge loop right.

So, that this is a bridge network there can be loop which is which is extremely difficult to
handle. But; however, if we have this sort of things like your STP spanning tree protocol
and so and so forth. So, then we can we are what we can see that is able to handle the
things. Next thing what we thought that will sit discuss in this context is the virtual LAN.
What does it mean? I whatever we are discussing so far is the physical LAN that is the
an end is there network etcetera is there. Now what is my requirement like say I want to
make a I have a generic lab and I want to make say into different segments to work on
the lab this say some of the data and maybe having sharing the same problem etcetera
right.

So, that may be a section say in the lab there is a section call maybe a one part of the
students are working on assignment on networking. So, there is a network group there is
a computer architecture and operating systems clouds group. So, there may be a data
science group and type of things right. So, I have different groups nevertheless they are
connected in the same layer 2 switch, or bridge layer to so; that means, the same
broadcast domain right.

So, what I want to do? I want to segregate them into different groups right. So, whether
there is a possibility to create a virtual LAN within the LAN right, so the LAN is there in
the layer 2 LAN along with the virtual LAN right. So, this is a serious means and
practical requirement for organisations having different departments, layer accounting,
sales, purchase and sort of thing. They are companies like these they are will be are will
be very convenient to have this thing. So, this VLAN case up like that one.

1118
(Refer Slide Time: 22:01)

So, as we are discussing we can have this layer hub, or switch for different floor and then
a router to route the things. Why router is required? We will come to that. Here also you
see there may be three buildings right three separate building where there is a department
for say account department, or section for say maintenance and type of things right.

So, the location of this one and location of this one is maybe different like one maybe
building 1, another maybe building 3 and but what I require that all administration
should be one in one LAN. So, that their communication are faster if there is a security
enhancement is required instead of doing it across the board, I can do it only for that
particular things and there may be several requirement, rather they share the only
broadcast.

In another sense there are in the separate collision domain now you want to do it in a
separate broad cast domain. One interesting thing you can see that it is from the same
layer 2 switch it is coming up one going to this VLAN 1, another is some other VLANs
or something right. So, this you know this is what the basic of VLAN is. So, it provides a
segmentation based on broad cast domain; broad cast domain. VLAN’s logically
segments switch network based on the function project teams or application of the
organisation regardless of the physical location and connection to the network, so that is
the requirement of the switch network a VLAN network right.

1119
So, now so all work station server used by a particular group share the same VLAN ID
and physically connected to the location, so this is my objective. So, hope those are new
to the VLAN concept and get it. So, I have different I want to segregate say
administration systems and etcetera accounts etcetera sales.

And then the administration department or the people working for the administration of
systems in the administration department may be across several physical locations. But I
want to bring them in separate VLAN and that the within the layer 2 this things are
coming up here right.

(Refer Slide Time: 24:19)

So, VLANs are created to provide segmentation service traditionally provided by


physical routers in the LAN configuration. If you look at the LAN in the physical
routers, this segregate those things right in the in the routing, every interface as a
separate LAN with a separate broadcast, and collision domain right.

So, VLANs address, address, scalability, security network management as we are


discussing routers in VLAN topology provides broadcast filtering, security, traffic
through etcetera. Switches may not bridge any traffic between VLANs, as would valid
integrity of the VLAN things right. So that means, a switch where if a switch of a 8 port
can 4 port can be VLAN 1.

1120
And other 4 port can be VLAN 2, but they will not route the traffic because they do not
have the routing capability. You require a layer 3, or layer 3 switch or router to do that
that what exactly here also we are showing that this is a router which allows this VLAN
1, VLAN 2 and VLAN 3; 3 VLANs to be can be routed things.

(Refer Slide Time: 25:23)

Similarly same thing that I can have this different VLANs and the server from switch off
particular this may be, but they are in the same layer 2 switches, these three VLANs,
three machines indifferent VLAN etcetera. So, VLAN is a broadcast domain created by
one or more switches. The network design above create three different broadcast domain,
so this is having this colour is one broadcast, this is one broadcast domain right.

1121
(Refer Slide Time: 25:47)

So, without VLAN you see I have this switches for one engineering marketing sales like
this, another switch and etcetera and then connecting. But with VLAN I can have a dual
switch and have all this segments right. So, this may be in the same floor on the same
particular floor and then, but I can have this type of things right. So, without VLANs
each group on the different IP networks and so and so forth.

(Refer Slide Time: 26:15)

So, VLANs can be done statically that is port by port each port has a shares that
dynamic. Otherwise dynamically; that means, I need to have done a applications at the

1122
MAC address use a software base of the MAC address to VLAN mapping etcetera, so
that MAC can be. So, each switch port can be assign different VLANs ports assigned
same VLANs say on the same broadcast domain, port that do not belong to a VLAN do
not receive this broad cast.

So, that if that port belong all the port belonging to the VLAN in the same broad cast
domain. So, what we are trying to look at the different switches? We define the ports and
these ports are a designated with the VLANs right I say that 1 to 4 is in this switch is the
VLAN 3, another switch also 1 to 4, and the etcetera etcetera those are the things.

(Refer Slide Time: 27:05)

So, I need to only connect to the things right. And if you look at the operations static
membership VLANs are called port based and port centric member see VLANs right. As
a device enters the network, it automatically assumes the VLAN membership of the port
to which it is attached. So, once you connected it is attached, it is the default VLAN for
every port in the switch is the management VLAN. Management VLAN is always
VLAN 1, and may not be deleted right, or because you can basically destroy the VLAN,
or delete the VLAN etcetera, all other ports in the switch may be reassigned in alternate
VLANs.

1123
(Refer Slide Time: 27:43)

So, important on VLANs, VLANs are assigned on switch port there is no assignment
done on the host that is usually not done. In order to host be a part of the VLANs it must
assigned in IP address that belongs to the proper subnet that is important. So not only
that port where it is connected, but also IP address which is at the proper subnet is
required, or in other sense if VLAN drives that in subnetting type of things right
somewhat equivalent.

Assigning a host to the VLAN 2 is a two step process right, connect the host to the
correct port of the switch. So, I need to connect that and assign the host of the correct IP
address depending on the VLAN membership. So, it should be in the same proper subnet
of the IP that is also important. So, not only the physical port of the things also that IP
address which is important. So, this is the thing.

1124
(Refer Slide Time: 28:37)

So as we have seen, so there can be a VLAN with the taking VLAN 1, 2, 3 the packet
moves and there is that can be transferred across this different switches. So, dynamic
membership VLANs are created to network management software. It requires a separate
software, dynamic VLAN allows membership based on MAC address of the device
connected to the switch. As a device enter the network it queries the database and the
switch for the VLAN membership right. So, once in the network it can enquiry on the
things.

(Refer Slide Time: 29:11)

1125
So, there are several benefits. So, key benefit is that a permit the network administrator
to organize LAN logically instead of physically. So, it may be distributed in different
physiological we can arrange that. Easily move workstation on the LAN, easily at
workstation on the LAN, easily change VLAN configuration, easily control network
traffic and improve security. So, there are several advantages of using VLANs.

(Refer Slide Time: 29:41)

So, if you see that broadcast domain without VLAN, that ARP request goes to the every
machine.

(Refer Slide Time: 29:51)

1126
And with VLAN it goes to that only those machines which are the member of the VLAN
right. So, that is the broadcast is controlled here no broad cast control per say.

(Refer Slide Time: 30:03)

So, what are the different types of VLAN? The most popular and use type is the port
based VLAN right. And there are other types like MAC address rarely implemented
today. Each address must be entering the switch and configured individually and there is
a protocol based configured like MAC address by instead is a logical, or IP address it is
not so common these days. So, the predominant is the port based.

(Refer Slide Time: 30:31)

1127
So, VLAN tagging as the traffic moves or the layer two frame move so there is the
VLAN tagging that tag with the VLAN number which is read and stripped off at the
other end to read that actual content. Another interesting is that if the switch cannot
segregate the VLAN, there are possibility there are thing it can still trunk the thing across
the switch because there may be switch large network and go on doing that. So, it goes
on trunking the things.

So, the VLAN tagging is used when the link needs to carry the traffic for more than one
VLAN right. So, when only one VLAN is fine, but if you have more than one VLAN
then I need to have a tagging. So, trunk link as the packets are received by the switch
from one any attached end device a unit packet identifier is added for the each of the
header.

The header information designate the VLAN membership of each packet right, the
packet is then forwarded to the appropriate switch, or router based on the VLAN
identifier and MAC address right. Upon reaching the destination nodes switch VLAN ID
is removed from the packet by the adjacent switch and forward to the attached device.
So, at the end point it is tip top and put the thing right. So, this is VLAN link and VLAN
trunking is there.

(Refer Slide Time: 31:49)

So, with no VLAN we have multiple link, where with a VLAN trunk we can have a
single line to have the both the VLAN with the VLAN tagging.

1128
(Refer Slide Time: 32:05)

And finally, there can be two types of VLAN one is end to end campus wide VLAN.
Another is geographical location based VLAN.

(Refer Slide Time: 32:13)

First one is most on based on functionality like here that accounting, here also VLAN 10
here also VLAN 10 engineering and so and so forth. So, it is a based on thing VLAN
everywhere model. So you can have that the function based.

1129
(Refer Slide Time: 32:29)

The other one is more of a location based here the accounting is VLAN 10, but whereas
this location is defined the accounting is VLAN 30. So, it is location based on the
physical location of the system VLAN dedicated to each access layer of the switch and
accounting switch are different in different VLANs. For example, there can be even in
the same location these are two accounting things on the VLAN. So, what we will see
that VLAN allows us to better manageability have a some sort of the I mean allows us to
have deferent broad cast domain within the within at the layer 2 level.

But one thing need to be kept in mind this at four port of a particular switch is VLAN 1,
other port is VLAN 3. Then if you want to send the packet from this one of the port 1, 2,
3, 4 is VLAN 1; 4, 5, 6, 7, 8 is VLAN say 3; then a port 2 wants to communicates to port
7. Then I require a layer 3 device or routing router to route this packet from the things.
Because they are in separate broadcast and collision domain right both broad cast domain
and they are in separate network needs a router thing. But nevertheless it allows us a in a
better manageability right. So, with this let us conclude today’s lecture on connecting
LANs and VLANs we will be continuing our discussion on this networking topic in
subsequent classes.

Thank you.

1130
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 54
Wireless LANs

We are discussing on Computer Networks and Internet Protocol and as last couple of or
last few lectures, we were discussing with layer 2 phenomena. So, what I thought that
today will discuss overview of WLAN or wireless LAN. Though as many of you
understand that wireless LAN or WLAN is a topic itself it is a separate course if not
more than one course itself. And it has different consideration to be handled at the
especially at the physical and layer 2 of the MAC layer or data link layer right. So, at the
layer 2 and layer 1 there are separate consideration for enabling the wireless and to the
rest of the things are may not be affected that much or are not affected that that way.So,
so, that is why wireless LAN is a separate consideration, but nevertheless what we
thought that a basic overview of this wireless LAN or WLAN at phenomena at data link
layer. And also vis a vis little bit of physical layer may be good for the overall for the
overall course structure, and especially those who are not exposed to this technologies or
this particular well listen and phenomena will be it will be helpful for that right. With this
motivation will be having a basic overview of wireless LAN phenomena at the layer 2
level right.

(Refer Slide Time: 02:05)

1131
So, as we see that WLANs especially due to huge purification of our different mobile
devices and obvious LAN mobile applications on those devices. So, there is a need for a
omnipresent network to be there right. So, rather the if we look at that bandwidth
availability with, in a wireless LAN network or data network par to say our mobile
devices, it is increasing day by day right. And with technologies like 4G and 5G trying to
become operational and it becomes a different ball game to handle those scenarios right.

So, not only that with easy availability of this band width at a lower cost, it also makes it
more feasible to have a infrastructure with wireless LAN right. Even we are these days
having a lab starting full working fully on wireless; like, what you require is only the
power to power the systems, the network configuration is wireless. And it also is helping
in reducing this overall cable infrastructure and management of the specific cable and
type of things right. So, its becoming a de facto standard for operations and type of
things. So likewise if you want to in intraoperative wireless, similarly IEEE 802
standards come into play. And if we look at that different set of IEEE 802 standards it is
not only wireless.

(Refer Slide Time: 03:56)

So, specifically if you see 802 dot 11 is the wireless LAN working group right. So, there
is a 802 dot 15 wireless personal wide PAN group and so on and so forth. So, there are if
we see. So, there are lot of activities on the standardization point of view also right. And

1132
to be very specific so these are from that 802 standardization committee’s
recommendation and their documents.

(Refer Slide Time: 04:35)

And if you look at the 802 standard part say, see we see a series of development came
into play right. So, 802 dot 11 a wireless network bearer operating at 5 gigahertz ISM
band up to 54 Mbps, 11 e quality of service and prioritization, 11 f handover, wireless
network bearer operating in 2.5 gigahertz ISM data rates up to 54 Mbps g, and so and so
forth right. And there are different standards which came up, though popular are a b g
and n become more popular for practical deployment and type of things. So, what we try
to look at, what we see that there is a lot of effort from the standardization which
obviously, there is based on the demand of this type of deployment.

1133
(Refer Slide Time: 05:35)

Now, if you see that wireless LAN that types of broad categories of wireless LAN. So,
one is something base station based right all communication through access point right.
So, its a base station based so, you have a access point and communicate, infrastructure
wireless base station is connected to the wired back bone all right. So, its a more of a
thing its a wired backbone and then infrastructure then base stations are connections.
These are more controlled because I have that measure control over the wired back bone
between the segments and etcetera and management is much better and so and so forth.

There is a Ad hoc connections where there is no per say there is no central AP sort of
thing, but there is a connection which is Ad hoc and there is MANETs right mobile Ad
hoc networks. So, Ad hoc network again on the movement and there are different
variants of different types of networks which are coming of this like, one may be the
when it declared Ad hoc network the network where the where the vehicles communicate
each other in the things So, it says that there are these are major categories of the
network, which where this wireless proliferations is there.

1134
(Refer Slide Time: 07:07)

Now, so, to specifically one with the base station which is wired backbone, another is the
Ad hoc may be the broad thing type of configurations what we are looking for.

(Refer Slide Time: 07:23)

and if we look at that from other perspective so, there is a concept of BSS Basic Service
Set, where within that particular basic service set the stations can be there they
communicate with each other. Either on Ad hoc basis without any access point or there is
a access point within the basic service set right. And there is a concept of extended

1135
service set, where the service set is extended to the other BSS through some access
points.

(Refer Slide Time: 07:56)

So, extended service set so, there are basic service set to access point they are extend
they are into different BSS. So, there can be different the stations, this particular stations
can be different type, one is it can be stationary that in other sense it is within the BSS
only. Other is there may be movement of the things that is one BSS to another in side to
another BSS.

So, there can be movement from one BSS to another BSS or that can be ESS type of
things right. So, move from one extended service to another. So, usually what happen?
This AP’s are connected on a distributed on a backbone, which is a distribution systems,
which in turn connected to a server or gateway, which allows it to different type of
services starting from different network level services right. So, this is the typical
structure which make more practical and says that I have BSS different BSSs they are
APs, APs as a backbone where we say distribution systems and go on other things.

So, this is the extended service set and there can be movement within the BSS, within
two BSS, under the one ESS, or across ESS one ESS to another so these are all those
things are possible. But however, 8 not 2 dot 11 does not guarantee that communication
is continuous during the move right. So, the protocol does not guarantee that the
communication will effect full during the overall movement.

1136
(Refer Slide Time: 09:33)

And if we look at the physical and data link layer structure of the whole stack. So, it is
this there are at the bottom line there are several physical layer standards, over there,
there is a distributed coordination function or DCF, over that the point coordination
function PCF. And there is a there are issues of contention free service, contention
services and over and above there are 802 dot 1 that is the LLC sub layer.

So, we have this sort of structure for the wireless or WLAN or more specifically 802 dot
11 standard, above this are network transport etcetera that remains same right. That
whatever the standards or IP and other things whatever is working as in a same less
fashion so, that the bottom lines are considered.

1137
(Refer Slide Time: 10:40)

So, if you just go little look at little quickly at the different wireless physical layer
consideration so, physical layer confirms to OSI. So, there are 8 naught dot 11 infrared
FHSS, DHSS, 802 dot 11 a, OFDM. and 802 dot 11 b, HR-DSSS, and 802 dot 11 g,
OFDM so, these are the different things. So, 802 dot 11 infrared 2 capacities 1 Mbps or 2
Mbps typically, range from 10 to 20 meters and cannot penetrate wall right. That is why
infrared cannot penetrate typical wall and does not work outdoors, but its can
communicate with a low range thing right. And 802 dot 11 FHSS frequency hopping
spread spectrum, again a physical layer consideration we will see some of the aspects of
physical layer.

But may not in our subsequent lecture, but may not go deep into the physical layer
consideration, these are more communication oriented phenomena. So, there is a multi
path feeding, 89, 79 non overlapping channels and so and so forth and these are different
characteristics of that. So, 802 dot 11 DSSS the direct sequence spread spectrum. So,
spread signal over entire spectrum using pseudo random sequence and I have the
bandwidth achieved is 1 or 2 Mbps. 802 dot 11 a OFDM orthogonal frequency division
multiplexing so, comfortable with some European hyper LAN 2 can go for 254 Mbps
with wider 5.5 gigahertz and there are these are the different consideration into the thing.

1138
(Refer Slide Time: 12:37)

Then we have a variant of 802 dot 11 b, though there are incompatibility between 11 a
and 11 b up to up to 11 Mbps for 2.4 gigahertz and with 11 million chips per second. The
bandwidth of all this protocols updates with interference from the several other home
appliances right like microwave oven etcetera. So, 11 b rangers much higher than the 11
a so, it can communicate to a higher range.

(Refer Slide Time: 13:08)

Then we have 11 802 dot 11 g orthogonal frequency division multiplexing, it is


backward compatible with 802 dot 11 b. That is why in several devices you see that 802

1139
dot 11 b slash g up to 54 Mbps uses 2.4 gigahertz frequency for greater range. So, this as
sum of this physical consideration, this is primarily to have a idea that what are the
technologies or what are the standards at the physical level.

(Refer Slide Time: 13:41)

So, if we again come back to this 802 dot 11 Mac layer Mac sub layer protocol. So, that
its not which we have a problem of this having this sizing the channel, which is not in the
8.3 dot wired network we will see that some of the things. Two major problem which
comes up here is, the hidden terminal problem and exposed terminal problem. We will
see that this is in channel problem will not come in a wired network where things are not
like this.

So, to deal this two problems 802 dot 11 supports two operations; one is DCF or
Distributed Coordinated Function and PCF Point Coordination Function. So, these are
the two things which are supported by 802 dot 11 right. So, implementation of the PCF is
optional, but DCF is there its all implemented and support DCF right another PCF is
much more complicated to handle also.

1140
(Refer Slide Time: 14:55)

So, what is this hidden station and exposed station problem? We will presented in several
literatures and internet resources. So, this is a hidden station problem on the A figure A
and figure B is the expose station; A wants to send to B, but cannot hear that B is busy
right. So, it is a hidden station problem there are range of C radio is not up to the A. But
here B wants to sends to C, but mistakenly things that the transmission will fail right. So,
because it is in the A’s range and it is exposed station problem right.

(Refer Slide Time: 15:41)

1141
So, in hidden station problem wireless stations have transmission range, but not all
stations are within the radio range like C that it is in the transmission range of B is in the
C, but the A is not there. Simple CSMA will not work carrier sensing will not work, C
transmit to B sorry. And A senses the channel it will not here transmission and falsely
conclude A can begin the transmission to B right. So, A senses the channel and see that
the communication to the B is free because it is not within the range of the C and it may
begin transmission to B. So, this is the challenge with the hidden terminal problem were
shown in the figure A.

(Refer Slide Time: 16:31)

On the other hand on the flip side or the so to say on the inverse problem is the expose
station problem, B wants to sends to C listens to the channel. B here is that A
transmission B falsely assume that it cannot sends to C right. In this case B wants to
sends to C and since the channel and what it sees that it assumes that here’s A
transmission. And because it is in the radio range of the thing and then it cannot sends to
C so, this is a exposed station problem.

1142
(Refer Slide Time: 17:06)

So, this are being tried to handle in the wireless scenario by to as we have been the two
approaches or two functions. Like there is one distributed coordination function or DCF,
uses CSMA/CA, CSMA with collision avoidance, both physical and career sensing right.
So, virtual carrier sensing so, it is not that we will see that how things it done. So, two
methods are supported; one we have to say multiple access with collision avoidance with
virtual carrier sensing and one persistent carrier physical carrier sensing so, we will just
see that what it does.

(Refer Slide Time: 17:53)

1143
So, Multiple Access Collision Avoided on MACA for wireless has to solve the hidden
exposed station problem or these two challenges by, two type of mechanisms; like one is
ready to send and clear to send. So, before sending the things it says a RTS signal and
waits for a CTS thing. So, RTS, CTS helps determine who else in the range or the busy
are in the range or busy so, that it can avoid collision.

Now, we will see that detection collision it may not be false feasible here out here.
Because this first of all this channels are pretty noisy, you need to have major resources
and bandwidth to handle this sort of sensing. Because you are sensing and trying to
transmit at the same time like. But whether still collision occurs yes, whether in spite of
this collision occurs will see that in spite of this to may collision occurs. But nevertheless
the based on that CTS or RTS not receiving the channel will go for again retransmission.

(Refer Slide Time: 19:17)

So, if we look at that MACA for WLAN added acknowledge and CSMA no RTS at the
same time. So, this is A send a request to tell me to B and in the range of A so, B sends a
CTS and responses CTS clear to transmission and transmits. So, it is really does not; it
able to handle this hidden channel, both hidden channel, and exposed channel issues. So,
we have a virtual sensing with CSMA CA like in the C in the range of A receives a RTS
right.

1144
(Refer Slide Time: 20:04)

C in the range of A receives RTS and based on information in the RTS creates a virtual
channel busy NAV right. So, what is a NAV? So, Network Allocation Vector; the time
period set by all other waiting station before sensing the medium for idleness right. So it
is the time period like if it is A sends a RTS for B, then it is the other stations who are
hearing this will wait for, will set there NAV that and it also in the RTS their information
is there how much time it may required to transmit the data. So, for that time this a other
stations who are hearing this, will wait for that and for that period before looking for the
channel whether it is idle or not. So, D in the range of B receives the CTS and creates a
shorter NAV right.

So, if D also in the range of B received the CTS and creates a shorter NAV. The virtual
implies that is source stations sends duration field in the data frame of the RTS and CTS.
So, and so that is why by reading those its creating a wet time, which is an sensing after
some after that wet time by setting their own NAVs. So, it is creating some sort of a
virtual science channel since sensing right. So, it is not sensing the channel based on this
information wise is the RTS and CTS. Station, then adjust the NAV accordingly right so,
the network allocation vector accordingly and wait for the things right.

So, let me repeat it when a channel wants to A wants to send to B it sends a RTS, the
other channels we are listening to this RTS, the RTS also contains the information, how
much time it required to sends the data. So, based on that sensing, the other channels way

1145
set their network allocation vector to that time period after which it will look that
whether the channel is idle or not right.

(Refer Slide Time: 22:18)

So, there is a another one persistent physical carrier sensing, the station senses the
channel when it wants to send right. So, change the station senses the channel when it
wants to send, if idle station transmits right. So, station does not sends channel while
transmitting. If the channel is busy station defaults until idle and then transmits right,
upon collision wait a random time using binary exponential back off. So, there is a one
persistent physical sensing, in a previously it was there it is not physically sensing, but
based on the information in the RTS CTS it is setting up that after what time it will again
check the idleness of the thing.

But in one persistent physical carrier sensing, what it is doing that station senses the
channel when it wants to send some data right. If it is idle that is the station transmits.
So, if it finds the station it find the channel is idle that nobody is within that range
because, the revaluation. So, there is no wired channel and then the station does not
sense the channel while transmitting, while transmitting it will not sense the channel. It is
go on sensing there, if the channel is busy that station defaults still the idle and then
transmit. So, upon collision wait for a random time using binary exponential back off
period right; so, this is the bottom line of this one persistent sensing.

1146
(Refer Slide Time: 24:01)

Now, point coordinated coordination function that PCF uses a base station to poll others
station to see if there are frames to be sent. So, in this in PCF in this case it requires a
base station to poll other station, to see that it is a polling operation goes on, if they have
frames to send so no collisions occurs per say right. So, there is no collision occurs. Base
station sends beacon frame periodically. So, base station can tell other station to sleep, to
save batteries and base station holds the frame for sleeping station right.

So, it is a more coordinated or point coordinated because they are the base station is
polling and seeing that if they are frames to send. No collision occur, base station sends
become frame periodically, base station can tell other station to sleep to save the
batteries, and other and base station holds the frame. So, this is the point coordinated
function little bit complicated and not over not it is optional for things that you may not
for. But DCF is considered mandatory for all communications with those features of
RTS, CTS sort of things.

1147
(Refer Slide Time: 25:18)

So, DCF, PCF coexistence distributed and centralised control can coexisting using inter
frame spacing. Like there are three type of thing one is short IFS is the time waited
between the packets of ongoing dialog like RTS, CTS, data, acknowledgement, next
frame. So, this is the short IFS; so, some short interstine spacing and PIFS PCF IFS when
no SIFS response the base station can issue a beacon or poll alright. So, for that it
requires that is the PCF inter frame spacing. There is a DIFS that is DCF IFS when no
PIFS any station can attempt to acquire the channel alright.

So, that is a distributed that is DC DCF, IFS and there is a extended IFS or EIFS lowest
priority interval used to report bad and unknown frames right. So, that is a extended IFS
or EIFS which has a much lower priority and it is primarily to report bad unknown
frames. So, these are different inter frame spacing’s which are standardized, which are
used for this communication.

1148
(Refer Slide Time: 26:38)

So, we come back to our CSMA/CA. So, as we have discussed the WLAN can
implementing CSMA/CD there are lot of problems in case of WLAN. Collision detection
requires send data and receive signal and the same time, required resource poll stations
and higher bandwidth which is a difficult for several this type of mobile devices; which
are communicating, which are not that resource poll both the in terms of application and
other resources. And, there are issues of hidden and expose station problems alright.

So, if there are hidden and expose station problems which are things. And, in number of
cases this channels are noisy, sometimes the devices which are communicating are far
away which creates a problem of fading. So, the signal fades off or the signal strength
comes down which makes this CSMA/CD to implement much difficult right. So, as we
have discussed we have DIFS: Distributed InterFrame Space, RTS: Request to Send; a
control frame, SIF: Short FrameSpace, CTS: Clear to Send; with this thing if we just we
look at the things.

So, at the start it is a send set the back off to 0, it sends the channel if it is not free some
persistence strategy is deployed. So, wait for DIFS or Distributed InterFrame Space then
the sense the. So, it is it waits for a time period and then it sends the RTS or a to request
to send to its destination station. After that it after it sends a timer that so that it is
looking that within that particular time period, the CTS should be reserved that is the

1149
clear to send signals, it should receive from the destination. If it is received yes, then wait
for again for a short time period or SIFS and then send the frame.

Again set a timer so, long this acknowledgement is not received and if it is successful if
it is acknowledgement received is success. So, sense the channel, wait for a persistence
channel deploy a persistence strategy. If it is channel is busy wait for some time, wait for
a distributed or DIFS, sends RTS, wait for CTS. If it is received within the time period,
wait for a again small periods, set the send the frame it is on the sender to the CTS is
received from the destination. And, then it sends the frame sorry, sends the frame set a
timer if acknowledge is received is successful right.

On the other hand if you see, if there is no CTS that it does not depend with the things, it
may increment the back off, back off time limit, wait for the back off time and go for the
things. Again if acknowledgement is also so, if the CTS is not received within the time
period or acknowledgement is not received the entrepreneur is goes for a back off time
right so this way it goes on running.

(Refer Slide Time: 30:03)

So, just to look at in the other perspective so, the source waiting for a DIFS sends a RTS
waiting for a SIFS sends a the destination sends a CTS. And, it again waits for a SIFS
sends the data or the information to the destination and this waits again for a SIFS and
sends the acknowledgement. So, this is the whole process and there in that this phase
there is a NAV or that is Network Allocation Vector which are set by the all the other

1150
station within the sensing zone. Like the wait they because this RTS, CTS have that thing
that how much time they required to send the data. So they have they wait for the other
things before checking that whether this channel is idle or not. So, this way it handles the
problem of this hidden station expose station problem.

Now, whether still collision not cannot happen or type of things, yes it may still happen
right. Still happen there are this is a totally mobile, this is a wireless environment there
are mobile devices etcetera. There are noisy channels these are channel so, though it may
happen. If there is a things either the things will be lost RTS acknowledgement, CTS
acknowledgement etcetera will be lost or corrupted. So, it is within the time period it is
not reached it all goes for the back off things.

So, with this let us conclude our overview a short discussion of this how this wireless
LAN or WLAN have there the phenomena works in the layer 2 or data link layer
infrastructure right. Again as I mention that the wireless LAN is a separate topic or
subject all together may be it requires couple of courses to handle the all aspects of
wireless LAN. So, it is a basic overview of the wireless LAN with respect to the data link
layer that what are the basic consideration following the 802 dot 11 standard.

So, we will continue our discussion on this overall networking topic in our subsequent
lecture, let us conclude today.

Thank you.

1151
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 55
Layer 1: Physical Layer

Hello. So, we are discussing on Computer Network and Internet Protocols, today we will
be looking at the our level layer 1 of the OSI or in TCP/IP model that is the physical
layer. So, rather couple of lectures we will be discussing on physical layer phenomena
though in some of the literature on in several standard some of the standards they
considered physical and data link as a single layer like if you put the NIC card it comes
with the both things.

And though again the physical layer as we will see is more related to the so, to say quote
unquote electronics and communication perspective, nevertheless we need to try we need
to understand that physical layer basic philosophy, which allows me to carry the traffic
from one network to another network and type of things.

So, as we discuss several times that, any upper layer phenomena need say lower layer to
communicate; that means, unless the lower layer is there it is not able to do it not able to
communicate and end of the thing is the physical layer. That should be a physical
connectivity between the source and the destination or in our cases the physical
connectivity between two hops. So, whether it is wired, wireless it based on the
technology, nevertheless or fibre or whatever, but nevertheless I require a physical
connectivity.

And there are several consideration like what should be the encoding scheme because
finally, whatever we are doing with the system or at the end systems are generated digital
signals right, but your communication path may not be suitable to carry that digital
signals right. So, in that case you need to convert this digital to some sort of analog and
then communicate and do a other way around who will do that right. Who will provide
the physical infrastructure to work on the thing work on this communicate path right. I
buy a laptop I want to communicate with the rest of the world right through say mail,
chat, browsing and type of things right. Either in a interactive mode or either I read or
write type of things right.

1152
Now in order to do that, I need to a connection to the overall networking cloud right or
overall this internet; how do I connect? So, one the best way at the home what we are
using is using the mobile data network. So, what you are doing? You are using the
mobile as a hub right or hotspot or Wi-Fi hotspots or a type of things, then you connect
to the mobile your device mobile device from your laptop and that in turns use the
backend data network to connect to the internet right.

So, this is something which is need to be connected or physically connected whatever


your protocol and whatever you are working at the upper layer, this thing is needed right
or you can connect your PC or laptop through a cable if you are having a connection in
your office with RJ 45 through a cable. So, there is a physical connectivity in turn that
point it is connected to a switch in turn to the backbone network and so and so forth
right.

So, what we require at our end at the device end is a network interface card; the NIC
typically takes care of both your data link layer phenomena for more to say MAC layer
phenomena and the physical layer standard, whether it is having a wireless connectivity,
whether it is having a fibre connectivity whether it is having a coaxial connectivity or a
RJ 45 Ethernet cable connectivity that is decided by your NIC card. So, NIC card has
those interfaces right and then you can connect to the rest of the world the physical
connectivity will be there.

So, there is the physical connections what is there, lot of things goes on and its a very
complicated not only complicated its a very complex communication procedure which
goes on which is another purview of communication. So, it would not be possible to deal
with all communication phenomenon, but we will try to hit on those important stuff. So,
today we are trying to see that what makes this overall process works together and then
slowly in next 1 or 2 lectures we will see that what are the basic features which we need
to understand when you will when we are looking at a computer network or protocol
stack in a following some standards. Now, the picture which is available in several
literature also we are seen in at the beginning of this lecture series.

1153
(Refer Slide Time: 05:55)

So, what we see at the end we have this physical layer, which is mostly responsible for
transmission of binary data through a medium right very straight forward and simple
right. So, if we go up, you have transfer of unit frames etcetera then delivery model for
network layer and so and so forth right.

So, physical layer is concentrated with the things medium maybe wired wireless or any
medium which allows to communicate right. So, this is the down the layer OSI again I
am repeating in case of TCP/IP, some of the cases we considered this two as a single
thing in some cases the physical layer is kept apart because this is more of a
communication phenomena, nevertheless it requires for us to communicate.

1154
(Refer Slide Time: 06:48)

Now, two things are coming whenever we are discussing two stuff is coming one is
communication, let us put it as a data communication because we are looking as, we are
trying to look at data where we will communicate another aspect is a networking right or
other time is what we do once the communication is there. So, data communication as we
see transmission of signals in a reliable effective manner.

So, want to transform one node to another node. So, that is the way what we do get the
data communication and it involves signal transmission, transmission media, signal
encoding interfacing with different transmission media and interfacing with the NIC card
with the transmission media and type of things and multiplexing and so and so forth.

So, these are the different aspects which are there with the data communication whereas,
the networking it mostly deals with technology, architecture, protocols, protocol of
communication network used to inter connect communicating device or entities or end
points or intermediate points per say. So, its the technology, the other should be a
architecture and the protocol or what we say standards so, that the two devices can
communicate right. Here mostly what we have seen topic like LAN WAN networking
protocols of different levels say routing and at the network level that a transport level
communication TCP or UDP there are communication at the and finally, we have
network applications which talk to peer to peer communication right.

1155
So, these are mostly concentrated in the networking. What it tries to; what it assumes in
when we will worked on the network? We assume that the underlining media is there
right when you try to browse a particular site or do some networking do some network
related operations with your systems PC or laptop, what we assume that the as if the
physical media is there right or there is a physical communication is there.

(Refer Slide Time: 09:20)

So, these are the two aspects and again in the literature, we will find that when we see.
So, we have a source where the data is generated, there should be a something which is a
transmitter then a transmitter carries the thing to a transmission systems right then at the
other end I have a receiver and the destination which are there right.

So, this way source to destination is there, if it is a full duplex or both way
communication and there should be a communication path when the destination source
when it acts as a source and this is the distance. So, what we have this thing one is the
source like typically PC or laptop can be a source, a transmitter that some devices which
allows me to transmit to the backbone of the network.

Then the transmission systems it can be internet or it can be a rather I should say that it
can be a some sort of a communication system like the most prevalent communication
system what we are having is the telecom network right; so, the internet with the
backbone as the telecom network and then we have other things right. There is a what

1156
call modem come into coming into picture we will seen coming one or two slides that
what is there and that the other end of the computer.

So, I have some way to communicate with the things right, it can be a mobile device, by
this systems connect to this say particular mobile device and then this in turns at the data
network at the backbone and then it the data traffic goes out. It can be like this, this
system my system can have a RJ particular Ethernet cable, which is connected to the
wall mounted socket which is in turn connected to the backbone layer two network, a
back backbone layer two switch or the layer two switch off our IIT Kharagpur network
which in turn connect to the hierarchy of switches finally, goes to the gateway to go out
of that particular network right.

If it is required or if it is within that the same switch network, then it as whatever is there
to be do in a layer two switch right. So, that is the way is here. So, there is some devices
which allows me to push the network thing.

(Refer Slide Time: 11:43)

And if you look at the communication task, there is a variety of things, some of them I
list transmission system utilization, interfacing or rather than utilization if you say
transmission system utilization is definitely another aspect transmission system
utilization, interfacing, signal generation, synchronization of the things. Once we
communicate there should be a way of synchronisation there is a exchange management

1157
or there should be when we exchange the thing there should be a in management things
like I send a data I get acknowledgement and type of thing.

Error detection and correction mechanisms, if there is error how do we recover from the
error? Addressing and routing - how to the route packets? Recovery from a particular
failed situation, message formatting. Another aspects which come into play though it not
directly may not be possible to do cover those things, but what we plan that at least one if
possible two lectures we will talk on network security aspect right.

Become this is becoming extremely important so, what are the different aspects of
network security that we will take which is so, that is also a thing, and then we have a
network management overall network management process to handle the things. So,
these are the different aspects of communicate task or so to say computer data
communication components right. So it is a when you do looking at the data
communication aspects of it.

(Refer Slide Time: 13:17)

So, we have two type of things one is a Local Area Network or LANs right. So, there are
several protocols which are predominantly for the LANs, we will see that there is a basic
consideration for LAN another category is a WAN Wide Area Network which is connect
to the internet. Typically what we say this LANs are pretty high speed thing, like you get
a backbone of a connectivity of 1 Gbps connection etcetera through your system

1158
provided your NIC card supports that right 100 Mbps is very common is the defecto
things or communicating in the things.

Whereas, if you look at your other side of the router, getting 8 Gbps links is pretty costly
right so, even means to that tune of order of 100 Mbps as also costly to maintain. So; that
means, in other sense the LAN connectivity is much higher, much much higher than the
backbone or the internet router level connectivity. So, and if you look at the source and
transmitter at together we put in the sources like your NIC card is sitting on your system
itself. So, the both the transmitting and the typically the source of the data are together.

So, out of what we typically see you have the source which is having source data source
and the transmitter, you have the destination which has the receiver and the destination
for the data right an intermediate thing is that transmitted media and we will we will try
to see that what are the different consideration for this transmission media for in one or
two lectures.

(Refer Slide Time: 15:14)

So, what is the predominant things what you are having is the telephone network right.
So, that is the something which is omnipresent when the communication network coming
into play.

1159
(Refer Slide Time: 15:32)

So, this is very much there this telephone network and what we see rather it is what is see
basic telephone network. What rather we see there are not only there, there can be
different parties which are there right, there are different telecom companies or telcos
which are in your serving in your area or serving in your region, state, country and type
of things right.

So, these telecom operators are primarily initially started or primarily started for voice
communication, but now they graduated to a scenario of to data communication rather
streaming data type of thing. So, voice data multimedia along with mobility right. So,
this sort of communication are happening into the things right definitely we have devices
which can talk to each other using these things.

There are one thing come into play immediately that this different telcos should be able
to communicate with each other; that means, there should be interoperability between
different telecom company right or if you look at our things that mobile service providers
or there should be some way, how they communicate with each other. So, that is one
important aspect, now if I can put somewhere other my data network or my data
communication paradine into this enter this telecom cloud, then at least the backbone
communication I can ensure with their data communication right. And if you practically
see its a huge infrastructural investment when you go for this sort of a thing; its a huge
infrastructure investment when to when things are there right if you look at.

1160
So, we can utilize the things; what we require? We require some connectivity with this
thing with your system or your network or your organisation network to the nearest
telecom centre or what we say nearest exchange right, if you are a organisation right.
When we use as individual then my system should be able to communicate to my
network suppose I have a BSNL or Airtel or Vodafone or something Reliance and
etcetera etcetera connections what I require is the how I communicate to the system to
the they are backbone telecom network. Once it is there then the connectivity everybody
is connected things are there right.

(Refer Slide Time: 18:17)

So, another thing as we are discussing so there is a the usually our communication path
are analog right wired or wireless audio tones info conveyed through a signal amplitude
frequency phase or analog signal right where as the working of our system etcetera are
primarily digital or 1’s and 0’s. So, what is the problem happening? You are basically
generating a series of 0’s and 1’s needs to communicate through a media, which
understand that analog signal.

So, you a generating a digital signal, but need to be pumped through a media which
understands a analog signal right. Consider a wire that previously how used to
communicate, there is a many of you might have not seen that. So, there was landline
still it is there through the landline phone cables, there is a device used to connect and

1161
that device connects to this system or the computer, when I used to we used to
communicate we communicate this through this.

So, this device is typically a modem right or what we say a modulator and demodulator.
So, the modem at the source end or one end is does that modulation signal getting a
binary set, it modulate and pumped into the analog by this analog backbone which
understand the analog, that is carried to the other end of the signal and then it is again
demodulated and push it to the end system. So, the two system talks each other at the
physical layer itself they communicate that one is modulation another is demodulation at
the other end right so that two terms we is called it is as a modem.

(Refer Slide Time: 20:14)

So, it is like this I have a analog network, it’s can be a phone or type of the cloud itself.
So, the digital signal through the modem goes to this analog and goes out right. So, this
analog to the another end while at the in system it is the other way around right. So, that
is a very effective device and we could able to easily connect it is not there are lot of
other hindrance as like your call drops like it goes can disconnected say the nevertheless
the phenomena is straight forward. You need to have a modem at your disposal, which
connects to the rest of the network where at the other end also somebody who is
communicating is having another modem so and so forth.

1162
(Refer Slide Time: 21:04)

So, what we do effectively? So, we have a system through a modem, it communicates


through this basic network and communicates here again a modem and a basic system
right and a computing system. So, I can use these backbone network or the backbone
telcom network to communicate with the two systems right so using modulator and
demodulator or modem.

(Refer Slide Time: 21:36)

Now if you look at the modem, modem translate the digital computer signal to analog
signal which are which is the telecom network or the telephone backbone understands

1163
and carry it to the destination and vice versa right. So, that is the things are there and
there is a like what we have that plain old telephone systems or the pots. So, what
telephone service there is a pot, and then what this modem allow is to communicate with
this things right. So, that is the way we communicate.

(Refer Slide Time: 22:14)

So, what we see if there are multiple systems need to communicate with the other
system; like there is a bunch of system out here, which wants to communicate with this
say this is the server at the other end right. So, there can be database server, application
server different type of different type of clients which wants to communicate with this
server; and for that what we require? We require individual lines to communicate with
the things right. So, to say if I am communicating distance where modem 1, modem 2,
modem 3, modem 4 and communicating with the things or even it is communicating with
a wired mesh to connect if means a wired connectivity from the source and destination.

1164
(Refer Slide Time: 23:02)

Now this becomes a cumbersome process if multiple things are there. So, we have a
there is a concept in the communication called multiplexer or multiplexing where a
allows multiple signals to be carried across the single physical dimension so, that is the
multiplexing. And if you look at these are there can be different type of things we will
discuss in our subsequent lectures, that is one is time division multiplexing or TDM
frequency division multiplexing and so and so forth. So, these are through popular things
and we will see that different variants of the things.

Now so I have different signals which are generated by this different systems and then
we have a multiplexer which multiplex this things and usually this when the signal things
are communicated these are through baseband communication whereas, these are
through broadband communication. So, apply able to carry single multiple signals
simultaneously, in a baseband it carries only one signal right. So, this is the way it is
there. So, I have broadband because there are multiple signals. So, there are multiple. So,
those are multiplex using some technology and that has be communicated to a broadband
signal.

1165
(Refer Slide Time: 24:23)

So, just to quickly do the letters are pretty little small in size, but nevertheless we just
have a quick look at the baseband and broadband. What the baseband said? Baseband
transmissions typically use digital signalling over a single wire right so; that means, the
transmission themselves take the form of either electrical pulse or light the thing. So,
whether it is a what sort of media is there, that digital signal used in baseband
transmission occupies the entire bandwidth of the network. Band to the network media
and transmit a as a single data signal right. So, typically the baseband multiplexing is the
TDM.

Whereas in case of a broadband uses the analog signal in the form of a optical and
electromagnetic wave over multiple transmission frequency. So, I have multiple
transmission frequencies or carriers by which this signals are carried. For signal to be
both send and received the transmission media must be split into two channels. If I have
a send receive type of path then we have a things that is true for they are also that if you
have to both send and receive data using single cable, then that type some sort of a
mechanism that with is there (Refer Time: 25:54). However, the sending and receive can
occur on the same whereas, the same time. So, either I to have a separate two separate
cables can receives or some arrangement of doing some sort of a time division
multiplexing, where multiple things can be shared.

1166
So, in case of a broadband also, multiple channels are created by the broadband system
for multiplexing technique, known as using some a approach for frequency division
multiplexing, we will just see those things for in subsequent lecture.

(Refer Slide Time: 20:34)

So, early communication so there is a pots and it able to communicate. So, there is a
branch office or head quarter or a location 1 and location 2. So, it has some multiplexer,
then if I have a multiplex a modem which communicate to the plain old (Refer Time:
26:59) telephone service, which in turns communicate to other modem to or this is for
modulation one end, this is demodulation and then if there is a multiplexing. So, there is
a demarks and the signals are formed into the at the server end or the other end.

1167
(Refer Slide Time: 27:16)

Now, with if the multiple locations are there, then we have multiple modem connections
where say and so and so forth. So, with these things also its works fine do the achievable
speed is not that high secondly, the management etcetera also challenging right. So, there
are different architecture, different protocols of managing them and type of things right
though there are lot of standardizations will occur. So, these are three locations where
these are communicating with the modem and then it is communicate into the plain old
telephone services or pots framework or pots backbone.

(Refer Slide Time: 28:02)

1168
So, what we are looking and that if we look at the physical layer consideration one is
your NIC or Network Interface Card as we discussed. So, NIC provides both this MAC
and the physical layer as we are discussing it gives a connect a way to connect through a
RJ 45 cable or through a wireless media or even through your say coax cable if it is like
there coaxial cable is there is prevent. So, two systems, we to connect two computers
what I need to do? Suppose I have two computers how do I connect? Install NIC at each
right and then connect the thing right? I can have a single cable to connect to the two
systems because I if my networking is based on these two system, I do not require
something to do that.

But it is how, there is a small catch that we need to do using a crossover cable; that
means, crossover means trans of this source is receive of other things and trans of the b
in the receive cable of the thing. So, it is cross over to the thing. So, that is a crossover
cable or popularly what we say cross cable right we require a cross cable means there is.
So, two system can communicate so it is consider at the thing. So, this physical
connectivity is that through a say RJ 45 cable.

(Refer Slide Time: 29:45)

So, typically this cable can be stretched up to 100 metres or 300 feet that for say fully
construction of things, but in reality we may not able to go that path it is little less than
the 100 metres considered as a, otherwise signal degradation will be much higher to
handle that.

1169
(Refer Slide Time: 30:07)

If it is more then we require something call every repeater right. So, a repeater which
regenerates the signal right so that is a repeater can be used to increase the distance. So,
if I have repeater, again the distance is increase there right. So, repeater regenerates the
signal.

(Refer Slide Time: 30:31)

And one we look at the concept of hub, if there a number of points needs to be connected
then we have a hub or multi port or also a sort of a multi port repeater right. So, these are
the devices which are at the manifestation at the network here the layer 2 or the physical

1170
layer. So, any other layer thinks like instead of the hub if I have a layer two switch, that
also works as a signal regenerator and have this physical layer connectivity. So, that
instead of hub, I could have a have a layer two switch or I even can have a layer 3 switch
or where we have the routing for the network layer level active activation right.

So, any upper layer has all the lower layer phenomena. So, that is absolutely fine it
works with right. So, another things what we previously also discussed we just to
mention again that, see at the layer 1 I am in the same broadcast level or at the same as a
thing the same collision domain also. So, as we are in the same collision domain. So, the
more is the collision or more simultaneously the stations want to exchange information,
there will be collision and retransmission of the signal right.

Suppose considered this a four port switch, a four port hub of say 100 Mbps for our some
arguments thing right. Now with the four systems are connected. So, and they all are
communicating at the simultaneously. So, there will be huge amount of collision or
retransmission of the signal or effective bandwidth will form right. So, even if it is a
backbone of 100 Mbps. So, effectively if or in a worst case situation we will get a around
25 Mbps right. So, divided by across the thing. So, the hub the overall bandwidth is
divided by the number of ports of the end type of things. So, that is a as in the same
collision domain all right.

But the other side is that, more you go on the higher devices more cost increases right the
hub is the switch is much costlier than hub, layer 2 switch a layer 3 router is costlier than
the layer 2 switch and so and so forth as you go on the things right. So, hubs are good for
some very small network or for extending a network and type of things, but may not be
that efficient to do that. But our basic consideration is not that immediately finding the
overall performance efficiency, but to look at that how to connect systems across right at
the physical level right. So, this is the thing.

So, what we what we have seen today is more of looking at the different aspects or of
that of at the physical layer of the layer 1 and in our subsequent lecture or what we will
look it to some more phenomena and go little deep into the some more phenomena of
this physical layer like that including multiplexing and so and so and forth, how they
work and type of things right. So, that in subsequent lectures in this. So, with this let us
conclude today and for and we will continue in the in our next class. Thank you.

1171
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 56
Layer 1: Physical Layer – II

Hello, we will be continuing our discussion on Computer Networks and Internet


Protocols. We were discussing on Physical Layer phenomenons. As I mentioned earlier
that physical layer is the lowest layer in the OSI and TCP/IP protocol suite. In some of
the cases in physical layers are kept apart from the actual network protocols suite
because of the reason that, that it is primarily more concerned about the communication
between the devices or underlining media right. And as we understand that there can be
different sort of consideration that can be wireless and wired and type of things and I
need finally, I need a media to transfer the data from one system to another right.

Now, incidentally the mostly the mediums are mostly are carry signals through
electromagnetic waves so to say and those are analog. So, is our digital thing needs to be
converted to analog to convert that to transmit right. We have also seen that, the
predominant connectivity because, this requires a physical infrastructure to be in place
right, if I want to communicate across the world or across India also then I require a
physical infrastructure which will work at the back bone right.

And typically the physical infrastructure which is somewhat readily available with us is
our telephone network right; though the bandwidth may not be that high, but
nevertheless these days with the fiber etcetera you can get higher bandwidth but, that the
telephone our telephone network is the basic framework of the things.

And there are several service providers which able to which give services. So, our one
consideration that if I can hook this telephone network then I can travel using this
network and then at the other end get the data out of it right. So, again we are talking
about the physical connects, physical layer consideration right, now in order to have this
to push it to this telephone network and type of things, we have seen there is a we require
a device called modulator at the at our end at that the source end. And a demodulator at
the other end if the communication is this way or in other way or rather we require
modem or modems at the at the devices devices right.

1172
Also we have seen that we the network interface card which comes with every system to
support the network connectivity is primarily have both physical and data link layer
properties right. So, they have a physical layer consideration; that means, the you can
connect RJ45 like our standard ethernet cables or wireless connectivity or fiber
connectivity or in some cases coax connectivity etcetera right. So, these are the physical
connectivity, so in other sense there should be a data link layer should be converting in
them into appropriate signals to travel push the data across through the media right.

And when it travels to the media that the whatever the means consideration from the
media medium comes into play it will be there right, like there could be attenuation due
to noise and type of things or transmitting to a larger area a larger distance and so and so
forth. So, those things will be there. So those will be there and those are consideration, it
varies from medium to medium.

The things which is true for fiber are not true for not always true that particular true for
cable or wireless and type of things right. So, again I just to reiterate that when we are
talking about physical layer, we are considering the other layers are as there in their
place. The same thing like the routing protocols works the TCP that transport layer
protocols works at the suppose to work application works at they are suppose to work.

So, when you open a your email or a some network application at the upper layer the
speed may vary right, due to the different type of physical wired connection, wireless
connection, fiber connection and type of things speed may vary, but nevertheless the
application for the application it is a communication path which is available right. So,
this physical layer connectivity is the what we say that the last mile or not only that that
bottom most layer of the connectivity etcetera and it dictates heavily that what should be
the bandwidth, what should be the throughput, to some extent reliability and so and so
forth.

So, this lectures what we are trying to do we are trying to look at different physical layer
properties which may affect our networking capacity right. And also little bit of try to not
that go into deep into the communication, but little bit of consideration of the
communications which may help us understanding our systems right, so that is our
consideration. So, today also we will look at some of the features and maybe in next

1173
lecture we will see some of or few more features, where the physical layer phenomenon
come into picture.

(Refer Slide Time: 06:12)

So, as we are discussing now, so 2 things coming now and then is the data and signal
right. So, analog and data and signal so what is data, what is signal and how things are
going on.

So, whatever we are generating in our systems are or working with is the data which has
primarily to manifestation 1 or 0 right. So, that is a binary representation of the things
and I generate the data for my purpose and I do not care that how it things to be there;
whereas, at the backbone as you are telling at the backbone it is primarily
electromagnetic wave need to be converted to some signal. So, data can be analog or
digital, analog data are continuous, take continuous values, digital data whereas a
discrete state and take discrete values right. So, to be to transmit data must be
transformed to electromagnetic signals as the media is can carry that electromagnetic
signal primarily.

So, data can be as I told data analog or digital, signals also can be analog or digital right
and analog signals can have infinite number of values in the range, a digital signal can
have only a limited number of values within a particular range. In a data communication
we commonly use periodic analog signals and non periodic digital signals right. So, it is
the periodic analog signals and non periodic digital signals; that is the things which we

1174
consider mostly we will see that what are the things. So, this is a typical example of a
analog signals and this is a typical scenario of a digital signal. So, we have digital things.
So, I can consider that the positive has some positive voltage negative voltage, I can have
different level at the positive or negative type of things.

(Refer Slide Time: 08:09)

So, signals if you see what they have? They have a amplitude primarily periodic signal
they have a amplitude. They have some frequency and they have a phase right. So,
frequency means how what is the after what time period is returns repeats the signal
whereas, the amplitude is the highest value it attains on the on the positive side or the on
the negative side the minimum value it attains and the things that dictates (Refer Time:
08:45) the amplitude of the things. And phase we will see that how much it is drifted
from the origin so to say later on we will see that how things will be there, so at what
time it is static.

So, signals with same phase and frequency, but different amplitudes. So, this is starting at
the same time that is 0 and 0, having same frequency repeatability this and this whereas,
they have different amplitude right. So, frequency and periodicity or periods are
inversely proportional. So, frequency equal to 1 by T. So, it repeats f every T time
durations of frequency will be 1 by T or T equal to 1 f. Signals with same amplitude and
phase, but different frequency may or happens. Like this signal as repeatability is higher

1175
than this like here 6 periods in 1 second, here 12 periods in 1 second, so here frequency
is typically 12 hertz here 6 hertz right, so hertz is the unit of frequency you know.

(Refer Slide Time: 09:54)

So, sine in this case, sine of the wave with same amplitude frequency, but with different
phase, so it is (Refer Time: 10:01) different at start time right. So, it is a sine wave is at
different, so this is say amplitude and frequency on these 3 waves are same, but they
have different start time. So, these are the 3 thing. Now one interesting thing you see
from here, so if I some way add this 3 sine wave to make a composite wave right, I have
3 waves, I have a adder or which adds. So, what does add means, that any point of time
you see that what is the signal strength at 0, here it is say plus 5 or plus 10, here it is also
0, so the I in my output here I put this as a 10 if this value I if we consider as 10.

Again at this particular junction or some junction, I can basically put this vertical lines
and calculate that how much value etcetera there and then some of the things and say this
is my output signal because, this composite added signal right. Had it been all in the
phase, same phase same amplitude etcetera the things could have gone little higher at the
thing because, the same repeatability.

1176
(Refer Slide Time: 11:17)

Now this way, I can have a composite signal type of things like time domain as
composite signal like it may generate end up in making a composite periodic signal right,
so we will see that.

(Refer Slide Time: 11:24)

Now, we see there are 2 type of representation; the time domain and frequency domain
plots of the sine wave like in this case, it is a time domain plots with time it is changing
this peak value is 5 volt 5. Whereas, we can have a frequency domain thing, how many

1177
frequencies are there in here, only one frequency 6 giga 6 hertz, so it is repeatability is 6
hertz.

So, here also it is one frequency and I know that what is amplitude of the thing right, so
here the amplitude of the thing. Now if I have 2 sine wave, one with a rather here we are
having 3 waves, 1 with frequency 0; that is flat, one with frequency 8 and one with
frequency 16, so blue, then this pink and green and then I can represent them into 3
things right like if it is a 0 frequency, there is no repeatability, so it is a dc thing, it is no
not repeatable it is a constant thing and that is at 15. Whereas, frequency with 8 is that
pink is at 10 and frequency with 16 that is a green is at this right.

Now, in this case again if I want to make them composite, so any point of time I go on
adding what are the different values and do the composite signal right like typically I can
I may have a some sort of a composite signal like this and which is again repeatable, it
may not be repeatable also means it may be non periodic. But in this case periodic
signals we are having because there is a inherent periodicity in the whole thing right.

So, there are in this typically if that is some half if you do in a graph paper also you can
calculate. So, typically how many frequencies are there, there are 3 frequencies, if it is a
sum we made it so 0 8 and 16 hertz right. So, there are a techniques like using Fourier
transforms like that and we can basically (Refer Time: 13:35) composite signal is there,
we can deduce it to this signal right ok. So, that is a way of representation of the things
ok.

1178
(Refer Slide Time: 13:51)

So, so now we see that non periodic composite signal. It can be the signal created by a
microphone or a telephone set, where the when a word or two are pronounced like, so it
is I am doing analog talking with a in a microphone or telephone set. So, those things can
be composite can be so, when 2 words are pronounced in this case the composite signal
cannot be periodic otherwise, it is repeatability of the whole things will come up usually
the conversation is a in information action. So, repeatability is much less and things are
they are not periodic they are non periodic. So, bandwidth of a composite frequency
difference between the highest and the lowest frequency obtained from the things.

Now, if I look at that composite frequency, it may vary from 0 that is not no signal to 4
kilohertz that is our range of vocal and type of things also that what we see that range of
our telephone plane or pots telephone line is also typically in this range. So, that is the
thing and I can have any frequency within this range right. So, these are this is more of a
this sort of a structure I can have different frequencies at this range and it is a composite
frequency.

1179
(Refer Slide Time: 15:08)

So, bandwidth of a composite signal is the difference between the highest and the lowest
frequency of the thing right. So, it is bandwidth is given by the highest and the lowest
frequency for that matter in a signal the highest frequency and lowest frequency is the
magnitude of the things right. Why we are breaking our heads on this, because your
communication channel may not allow all frequency batch right. So, it has a own
property right, it has own materialistic material property and then based on that all
frequencies may not be allowed. So, it may allow a set of frequency, if it is some of the
channels may allow in wider range, it may be allowing this range of frequencies in the
things.

So, your data signal or the data which you are generating at the at the end points, should
be able to put through this channel only right or I need to know that how much the
channel can allow and capacity type of things right. So, that is why we need to study that
how is this type of bandwidth consideration those are coming up in terms of this
signaling or communication.

1180
(Refer Slide Time: 16:25)

Now, if you come to the digital signal it addition to being represented by a analog signal,
information can all be also be represented by a digital signal; for example, one can
encoded as a positive voltage, 0 can be encoded as a means as a 0 voltage, so I can have
0 and 1 digital signal can have more than 2 levels, even it can have 2 levels, 1 is here it is
only 2 levels right with 1 and 0. It can have more than more than two levels right
different levels, so I can have 1 1 1 0 0 1 1 0 0 0 and type of things right.

So, this is more than 2 levels that the more data is packed within the thing right. So, in a
effectively I can make more data communicate within that pack thing. So, it gives us a
better output right, but not always feasible we will see.

1181
(Refer Slide Time: 17:22)

So, a digital signal has 8 level, how many bits are needed per level. We can calculate the
bits as with a formula that log 2 8 equal to 3 bits. So, if it is eight level so I can have 3
bits 2 to the power 3 is 8 right. Each signal level is represented by 3 bits. So, bit rate is
the number of bits, since in one second expressed in bits per second right. So, assume we
need to download the text documents at the rate 100 pages per minute. So, if that is my
consideration what is the required bit rate of the channel so, if the page is an average of
24 lines with 80 characters each line, we assume that one character requires 8 bit
representation. The bit rate is 100 into 8 into 80 into 8 equal to 1 point so that is 1.63
mbps. So, that is the bit rate for this type of things right.

So, it is a very flat way of calculation, there will be lot of other consideration, but
nevertheless we can have a come to a thing.

1182
(Refer Slide Time: 18:33)

Similarly, a digitized voice as we see in somewhere it is digitized at a 4 kilohertz and we


need to sample the twice the highest frequency then we can have a bit rate. Similarly
what is the bit rate of HTTP, we can calculate with the rate of what is the reference time
and so and so forth.

(Refer Slide Time: 18:50)

So, this way I can calculate the bit rate. There is a concept of bit length, the bit length is
the distance of 1 bit occupies in the transmission medium right. So, bit length is the
distance 1 bit occupies in a transmission medium. So, bit length equal to propagation

1183
delay into bit duration, so how much duration is there along with the propagation speed
is give me the bit length.

(Refer Slide Time: 18:15)

So, time and frequency domain periodic and non periodic digital signal, so this is the
representation of this if I have a periodic signal and if you have a non periodic digital
signal then the frequencies are both actually, both cases it goes to infinity right, so end of
the things. But in order to reconstruction I may not require those frequencies which
contribute very less into the things right. So, there are different consideration from the
communication point of view, there are consideration like take that which harmonics of
the things will be there or harmonics and type of thing, how many you can go to gave
effective reconstruction. So, both bandwidths are infinite, but the periodic signals has
discrete frequencies, which referred as the non periodic signal has continuous frequency
right.

1184
(Refer Slide Time: 20:02)

So, there is another consideration comes out when we try to transmit data over a channel
right, what we say it is a transmission impairment right. Signal travel through
transmission media which are not perfect, the imperfection cause signal impairment
right. This means that the signal at the beginning of the media is not at the same other
things. So, you send something and it is something got in not the same thing. The
typically 3 categories of things are there, one is the attenuation, one is distortion, another
is the noise. So, this type of 3 type of situations which causes this term impairment.

(Refer Slide Time: 20:42)

1185
In case of attenuation loss of energy, when the signal and the simple or composite travel
through the media, it losses some of its energy in the in overcoming the resistance of the
media. To compensate this loss the amplifier are used to or signal regenerator I used to
say instead of amplifier are used to regenerate the signal right, so it has the degrader a
regenerator.

Suppose a signal travels through a transmission media and its power is reduced to half.
So, it was P and now it is P by 2 or sorry P1 and now P2 is half of P1. In this case, the
attenuation loss power can be calculated as like this right. So, a loss of 3 db or minus 3
db is equivalent of losing half of the power. That is why that that 3 db loss etcetera we
coming to play that is a 50 percent power is lost.

(Refer Slide Time: 21:35)

Another means another source of impairment is that distortion, signal changes its form or
shape right. Distortion can occur in composite signal made of different frequencies. So,
each what happened each signal component has its own propagation speed through a
medium and therefore, its own delay arriving at the destination.

So, differences in the delay is create a difference in the phase which in turns not exactly
the same as the periodic periodicity of the periodic duration. So, let us see, I send a
composite signal which has number of frequency component incidentally, because of this
channel characteristics that is the channel properties the different frequencies get
different type of say delayed of reaching the things. So, there are no attenuation per say

1186
(Refer Time: 22:34) but there are different delay and while it reaches the thing then what
happened it is now it is at different time duration or period duration.

So, when you reconstruct you cannot reconstruct the same composite signal or in other
sense you do not get back the same data. So, it if it is a here you see it was in phase data
like this is same time in phase data when we made a composite signal due to impairment
it receive there you decompose the signal it goes for a impairment like there is a shift
here with respect to this. So, there is a phase shifting phase shifting we will go for a
problem of the overall data.

(Refer Slide Time: 23:19)

And finally, we have this noise as the impairment right. Several type of noise such as
thermal noise, induced noise, crosstalk impulse noise may corrupt the signal right, so
there can be different noise. So, thermal noise is a random motion of electrons in wire
which creates an extra signal not originally sent by the transmitter. So, that it is the
thermal noise. Induced noise comes from source, such as motor or appliances from
different source has induced noise so that is induced in the thing.

Crosstalk is the effect of 1 wire on the other, 1 wire acts as a sending antenna other as the
receiving antenna. So it is a crosstalk when two things are moving, a two things are in
nearby location and there can be impulse noise is a spike signal with very high frequency
with very short time that comes from the power lines lightning etcetera. So, there is a
impulse and the impulse noise.

1187
So, these are the different category of noise which distorts or creates problem in the
signal right. So, in other sense there are impairment and there is there will be a challenge
in reconstructing the things. So, what we see, this noise also plays a important role in
faithful delivery of the signal at the other end. Now these are the things which are there
right, we need to with respective this we need to send data and type of things.

So, there is one side there are lot of development or things are going on that, how more
improved channels can be created like, you get a more faithful transmission when you do
you work with something called in fiber type of channels and type of and then other
things that whether, I can better way encode or modulate the data. So, that the, so it can
be sent through even to some extent not so good channels and type of things.

(Refer Slide Time: 25:30)

Another metric come into play or we listen now and then is a signal to noise ratio. To
find the theoretical bit rate, we need to know the ratio of the signal power to the noise
power. So, average signal power by average noise power that is important, so get the
SNR type of thing. So, average signal and average noise power are considered as these
may change with time right. A high SNR means the signal is less corrupted by the noise
or a low SNR means the signal is more corrupted by noise. So, this is the consideration
means that that plays a important role right. Since SNR is the ratio of 2 powers, it is
often described in decibel and SNR dB defined as SNR equal to 10. So, there is a typo at

1188
10 log 10 SNR, so it should have been in the same line. So, similarly I can calculate a
SNR and SNR dB using this right.

(Refer Slide Time: 26:42)

Data rate limits. So, data rate depends on primarily on 3 factors; one is the bandwidth
available how much bandwidth you are available. Level of signals, what are the levels of
signals it is a 2 level, 4 level what are the levels of signals. And quality of the channel
level of noise right. So, what is the quality of the channel right like, the fiber some fiber
cable there will be a different quality aspect then if you have a wired cable and type of
things. So, quality of the channel or the level of noise plays a important role.

Increasing the level of the signal may reduce the availability reliability of the system. So,
if I go on increasing the level of the signal because, we say that if I go on increasing the
thing it is more compact and I can (Refer Time: 27:32) but it hurts the reliability of the
things, more granular things more finer things there will be more likely chance of
disruption or distortion and type of things.

So, there are 2 theoretical formulas which help us in estimating that what should be my
bit rate and type of things. So, one is Nyquist for noiseless channel, another is Shannon
proposed by Shannon for noisy channel. So, we just see quickly that what they say the
Nyquist bit rate formula defines the theoretical maximum bit rate is the 2 into bandwidth
into log 2 base 2 L is the number of levels right. So, there is that is the theoretical thing
in a noiseless channel.

1189
(Refer Slide Time: 28:17)

So, consider the noiseless channel with bandwidth three 100 hertz transmitting a signal
with 2 signal level. The maximum bit level can be calculated as 2 into 3000 into log 2
base 2 equal to 6000 right.

Consider the same channel transmitting a signal with four signal level. So, instead of one
it has a four signal levels. So, what it goes on, it basically say 2 into this it should be
12000 bps. So, changing the signal level, I can go up in the bandwidth right.

(Refer Slide Time: 28:55)

1190
So, for noisy channel that we have that Shannon’s capacity, in reality we cannot have
noiseless channel right, so there will be some form of noise or not the channel is always
noisy. In long back in 1944, the Shannon introduced a formula for Shannon capacity to
determine the theoretical highest data rate for the noisy channel. So, what is the highest
data rate it can support, so bandwidth into log base 2 1 plus SNR that is the highest.
(Refer Time: 29:24).

Like consider an extremely noisy channel in which the value of the noise to signal to
noise ratio is almost 0 right. So, that is all you made number of levels etcetera, but the
noise is so high, the SNR value is nearing 0 right, so very low signal. Say, channel
capacity C equal to B log 2 1 by SNR and then what we can find out that irrespective of
what whatever you do finally, it end ups with the 0 only a 0 there is no transmission is
possible, so much noise is there.

This means the capacity of the channel is 0 regardless of the bandwidth in other words
we cannot retrieve any data through this channel right. So, this is the way it gives some
limitation of the means boundary of the things that what is the highest level you can
reach with this type of channel and type of things.

(Refer Slide Time: 30:28)

So, if you see for practical purpose when SNR is very high, there is we assume that the
SNR plus 1 is also almost the same like if you have a huge SNR. So, practically 1 plus
SNR is same or in other sense, the theoretical channel capacity can be expressed as C

1191
equal to B into SNR dB by 3 right, so based on the things. We have a channel with 1
megahertz bandwidth, the SNR of this channel is 63, what are the appropriate bit rate and
signal levels? Correct so, this is the thing we want to find out.

Like first we use Shannon’s formula to find out the upper limit right. So, it is B log 2 1
plus SNR and something 6 Mbps, so that is the upper limit. Now the upper limit the
better performance we choose something lower that is 4 Mbps for example, and use the
Nyquist formula to find out the level. So, putting the Nyquist formula we found out the
level equal to 4.

So, somehow means if we try to look at the summarize the thing, so what we use the
Shannon capacity gives us the upper limit, the Nyquist formula give us the signal
channel. Now see our this basic consideration helps us in finding the what could be my
channel capacity, what amount of rate we can get, this may allow me to plan something
that what should be the data transmission time etcetera and type of things right that,
which is very much needed for different consideration.

So, let us with this thing that basic fundamental way calculation that and this digital
signal digital data and signal and analog data and signals considerations, how we can
have some sort of estimate of approximate bit rate and the signal levels that will we have
seen and this will help us in estimating separate thing. So, with this let us conclude today,
we will be continuing our discussion in our next lecture next lecture on this physical
layer.

Thank you.

1192
Computer Networks and Internet Protocal
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute o f Technology, Kharagpur

Lecture 57
Layer 1: Physical Layer-III

Hello, so we will be discussing our this layer on Physical Layer considerations. As we


have done for last couple of lectures; that different aspects of physical layers, we will be
also we will be seeing today also some other few more important aspects of physical
layer consideration. As I mentioned in earlier lectures also, we this is our bottom most
layer, one of the important layer for communication where the communication aspects
come into play and so, and heavily dependent on the media considerations right.

So, how you communicate whether it is through wireless, wired, what sort of
communication media, it plays a important role that how the data will be pushed into the
things.

Finally, this layer is also at end of the thing that this layer is also in responsible that how
much bit rate will be able to achieve right. Whatever we may be doing different sort of
encoding compression at the upper end, but nevertheless finally, pumping the traffic
through this should be on the physical layer right.

So, there are different physical layer consideration and most of the cases we will see this
physical layer is more dictated by the communication paradigm. It is a major aspects of
communication paradigm and lot of things which are happening which are there
prevalent theories and practices which are prevalent in the communication systems, we
are inheriting there or we are discussing therefore, that matter to for this physical layer
consideration. So, today also we will discuss about couple of things like one is the
encoding techniques other is the your multiplexing techniques, encoding, modulation,
multiplexing techniques right.

So, those type of techniques which are there in the which are needed at the physical
layer. Again let me emphasize that this are a vast communication topics right. So, we will
basically try to see the overview upon the consideration what is required for our network
point of view what we have seen earlier.

1193
So, we will just to see a overview of the different type of techniques which are prevalent
into the things right. So, if you look at the encoding decoding techniques, so what is
encoding? It is a process of converting a data of or a given sequence of characters
symbols, alphabets etcetera into specified format for efficient transmission of data, right.

(Refer Slide Time: 02:59)

So, that is flatly like that decoding is a reverse of encoding. So, it is a process of
converting a data which is generated by the system into given sequence of some
character say symbols alphabets etcetera, in a particular format to a efficient transmission
of data.

1194
(Refer Slide Time: 03:22)

So, what we are doing giving a digital or analog signal analog data, we want to encode it
either through a encoder, and who generate a intermediate signal which is transmitted
through the media. And put it to the decoder which generate the signal back or generate
the data value. Now these there can be a analog data with digital signal, digital data,
analog signal, analog data, analog signal, digital data. So, they are different variation of
the things.

Now, there is another technique called modulation; which is basically with that it is
modulated with respect to a carrier frequency right? Why is this is done we will come to
that right, see while I encode; while I just encode into analog signal. Now that as we
have seen earlier that the signal has some frequency phase and amplitude or a composite
signal has different frequencies a set of frequencies. Now as this frequency range should
be within the within the range of the frequencies which that channel can carry right.

So; that means, if it is not in those range I need to modulate this frequency through a
through a carrier. So, that it fits into this channel carrying capacity right. So, I require a
carrier frequency by which I can put this range into the particular things, like say this
there this one; it could have been in some other range here or some other range, but if my
particular media can carry within this range then I put a carrier frequency f c and
modulate it such that it is within that particular range. So, we will see those

1195
considerations. So, these are again as I mentioned (Refer Time: 05:24) these are core
communication phenomenon.

(Refer Slide Time: 05:28)

So, other thing is modulation is a process of encoding source data, encoding we have
seen encoding source data into a carrier signal with a carrier frequency of frequency f c.
Frequency of a carrier signal is chosen to compatible with the transmission media use
that too at the (Refer Time: 05:46) then it should be linear thing. So, the modulation
techniques involves can be 3 different things; it can be amplitude modulated, frequency
modulated, phase modulated.

The carrier frequency carrier signal is modulated that way, according to the input source
signal m t either analog or digital which is called the baseband signal or modulating
signal. The carrier signal f c will be the modulated into modulated signal s t right. So,
that that we have seen so we have a source signal m t carrier signal f c and modulated to
a some signal s t, which is carried through this channel in a faithful manner; that means,
with less with minimal distortion or minimal loss type or loss there or I can get the signal
with maximum S N R.

1196
(Refer Slide Time: 06:30)

Now, as you are telling that encoding techniques or encoding or modulation techniques
there are there can be 4 option, one is digital data digital signal, analog data analog
signal, digital data analog signal and analog data analog signal right. So, this can be the 4
option so we can have this sort of 4 variant. So, all our this techniques what are there are
if we can cater (Refer Time: 07:00) to this 4 things are absolutely fine right.

So, digital data digital signal the equipment for encoding data into digital is less complex
because it is on some levels we will see that. Whereas analog digital signal conversion of
analog data like voice, video into digital form for communication or different type of use
of modem digital transmission, and switching through using the same data network to
transmit the data and sort of things digital data analog signal. There is optical system
guided media wireless that propagate analog signals where digital data needs to be
converted to analog signal.

And then we have analog data analog signal that is baseband easy and cheap that is voice
grade telephone lines, what we do was signaling modulation permits frequency division
multiplexing or F D M like for FM radio and am FM radio.

1197
(Refer Slide Time: 07:57)

So, digital data digital signal digital sequence of discrete continuous voltage pulses right.
So, each pulse is a signal element, binary data transmitted encoding bit stream to signal
the simplest is the one is represent by some voltage say by a lower voltage. And 0 is
represented by a higher voltage 2 voltage level that is the simplest thing, but I can have
more I mean more complex scenario with multi-level set sort of things.

(Refer Slide Time: 08:26)

Such few terminologies there is a thing there is a concept called unipolar. If all signals
have the same algebraic sign positive or negative, polar one logic state represent by

1198
positive voltage other as by negative voltage. Data rate - the rate of data transmission bits
per second, duration or length of bit already we are seen time taken for transmit or emit
the bit. Modulation rate, the rate at which the signal level changes measured in baud
signal elements per seconds. And there is a mark and space that is mark is binary one
space 0 and type of thing. So, these are some of the terminologies which are used in this
type or in this paradigm of this encoding decoding multiple signal so on.

(Refer Slide Time: 09:12)

How to interpret the signal; thus receiver needs to know the timing of each single
element right.

Otherwise it will not able to synchronize when the signal element begins and ends. So,
and if there are signal levels accept only positive and negative if there multiple signal
levels. There are some of the factors which are important that is signal to noise ratio, we
have discussed data rate band width these are the affecting successful interpreting of
signal if the huge degradation it may not be able to faithfully regenerate.

Some principle and increase data rate, increases bit rate error right. If you increase the
data rate there can be bit rate error, an increase in SNR decreases B E R an increase in
bandwidth allows an increase in the data rate. So, we are not going to the detail of the
things, but these are which can be proved and observed.

1199
So, we request some encoding scheme right with the vanilla (Refer Time: 10:10) or the
plain signal, it may not be possible to maintain all those parameters. So, some of
encoding scheme which may improve performance, so the mapping the data bits into
some signal elements. So, we have the encoding scheme. So, we have data bits data at
one end and we need to map to the some signal element which need to be which can be
transmitted.

(Refer Slide Time: 10:34)

So, there are some of the popular encoding schemes we will just quickly look at those
not may not be the all. So, non-return to 0 or NRZ or at NRZ L NRZ inverted, then in
bipolar AMI, Pseudoternary AMI Pseudoternary things which are multilevel binary bi
phase Manchester encoding differential Manchester and scrambling techniques and type
of things. So, there are different type of encoding techniques right, like to give a gist of
the things.

1200
(Refer Slide Time: 11:08)

So, this is the different ways like non return to 0 level; is 0 is high and 0 is represented
by high level. And one is represented by low level similarly if I am consider as an one of
the popular thing is the Manchester transition from high to low level is a middle of the
interval transition with a low level to high level is the middle of the interval differential
Manchester is also popular.

And these are the things which are and several other things we are not going to details on
the things. The important that while encoding we need to we at what we are trying to do
as we have seen that we want to ensure better bit rate, better signal to noise ratio and so
and so forth.

Along with that we need to have minimum error or in other sense we need to what you
are looking for that it is easily identifiable right. That which with what sort of data is
there it is easily identifiable. So, that once the error is less it leads to less regeneration
transmission and saving in bandwidth.

1201
(Refer Slide Time: 12:17)

So, this is the NRZ as you can see that it is 0 is high, 1 is low. Here also 0 is high 1 is
low and this way representation is there right. So, there is a plain thing NRZ, I is a
variant of the things, if you look at the Manchester encoding on the other hand like
Manchester what you say that 0 transmission from high to low at the middle of the
interval, in case of 1 transmission from low to high at the middle of the integral.

(Refer Slide Time: 12:49)

So, you see that at in case of 0 in the middle of the interval it is high to low and in case
of 1 again it is low to high and it goes on like this right.

1202
So, what we see in the middle of the interval is not at the fringe where the data may be
something degraded it the, so that we can have this encoding scheme where the at the
middle of the interval.

(Refer Slide Time: 13:18)

So, variant of differential Manchester, it always there is a transition in the middle of the
interval along with there is some consideration. Like always a transition in the middle of
the interval 0 transition from at the beginning of the interval and 1 no transmission at the
beginning of the interval.

So, there is always transition at the middle and 0 and at the middle at the beginning and
for one there is no transmission. See by this what we are trying to do we have a better
representation of these, signal which is less prone to error less prone to degradation and
typo and faithfully construction of the things easily identified by the receiver so and so
forth. So, there are few more scrambling techniques etcetera said which are there in this
particular encoding techniques.

1203
(Refer Slide Time: 14:15)

So, differential Manchester encoding, and as we have seen that modulation rate one bit
one signal type of things. So, we can have different models and rate for different type of
encoding things right. So, we with more complex encoding we have a better modulation
rate, but what is more difficult in this type of cases. Now here we the your circuitry will
be complex right.

So, if you use only 0 and 1 that is one thing, but if you want to detect the transition not
only that you need to transit at the middle of the things or at the beginning of the things
your circuit becomes more complex. So, that your electronics part becomes more
complex never the let us you get more advantage out of it.

1204
(Refer Slide Time: 15:07)

Digital data analog signal so modulation involves operation of 3 characteristic of signal


into one or more like what we say; there is amplitude shift key frequency shift key. So,
there are 2 variant the most that popular one is that; binary FSK. So and other one is
multiple F S K and then we have the phase shift keying that is on the phase.

So, one is on the based on the amplitude another on the frequency another on the phase
right. And there is a another thing or QAM which is combination of ASK and FSK, like
what we see that public telephonic system design to transmit a data from 300 hertz to
3400 hertz right.

So, use modem digital modulator or this to put the signal on a higher thing because those
will be highly degraded right 300 hertz to 3400 hertz. This type or this frequency
bandwidth low frequency band would be high deteriorated or the there will be fall in S N
R. So, we can modulate the data into higher things.

1205
(Refer Slide Time: 16:23)

So, if we look at if we this is my data that 0 0 1 1 0 1 0 0; so it is 0 is represented by high


and 1 is represented by 0 voltage. And if it is ASK so, what we say it is a 0 frequency is
sorry the amplitude is 0 for 0 and amplitude is 1 a particular value for when the data is 1.

So, we see that it is like this ASK is transmitted like this right. This is easy to implement,
but on the other sense other end. So, so long you have this type of flat signals or what we
say DC signal. It is difficult to maintain those things right difficult to maintain those
things over a media or difficult to identify, where things are there where how many 0s
and 1s type of things are there.

Variant of or the other part is when we do a frequency division multiplication key or


frequency shift key or to be more specific binary shift key; that means, we are using 2
frequency, 1 for 0 and 1 like if you see here is 1 for 0 a particular frequency f 1 another
frequency f 2 for 1 and go so and so forth right. So, this is based on the frequency shift
key or FSK right.

So, first one is the ASK where the amplitude of the things are considered here the
frequency and the finally, we have a PSK or phase shift key more importantly what we
say; here B P S K means there are 2 phases are used, like if you in this case one phase for
the 0 next phase for the 1 right and again for the 0 and 1 and so and so forth. This is
based on the phase of the thing the phase of the signal is considered or 2 phases are

1206
considered for doing that. So, which are 180 degree apart so the sorry, 90 degree apart so
that you have 2 distinct things so there is there.

(Refer Slide Time: 18:33)

So, what we see that amplitude shift keying values are represented by different amplitude
of the carrier frequency usually 1 amplitude is 0 in the presence and absence of the
things inefficient, up to 1200 bps on voice grade signal is possible. And ASK is used to
transmit digital data over optical fiber.

(Refer Slide Time: 18:58)

1207
Binary frequency shift keying the most common form of FSK is a binary FSK or BFSK.
2 binary value represented by 2 different frequency, near the carrier frequencies right. So,
that instead of one you have we have 2 things.

Now, carrier frequency is important because the carrier frequency is decided based on the
frequency range of the channel which can which it can faithfully transmit right. So, 2
frequencies are selected, near the carrier frequency what we expect that the variations are
able to these 2 are also able to faithfully transmitted along then region.

So, BFSK is less susceptible to error than ASK and up to 1200 bps voice grade line also
use for high frequency to 3 to 3 megahertz radio things right. So, it is less susceptible to
error than ASK that amplitude shift keying.

(Refer Slide Time: 19:53)

And phase shift keying the phase of the carrier signal is shifted to represent the data
alright. So, binary PSK that is binary phase shifting keying 2 phase represent 2 binary
digits, right, differential PSK. So, phase shifted relative to the previous transmission
rather than some constant reference signal right.

So, it is based on the previous transmission the phase is shifted rather than following a
constant reference signal to do them. So, these are the 3 predominant techniques.

1208
(Refer Slide Time: 20:36)

There is a another technique which is called QAM, that is quadrature amplitude


modulation right or QAM which is a mix of ASK and PSK. And this QAM is used for
asymmetric digital subscriber ADSL or some incase of some wireless standards right.

So, combination of ASK and PSK, logical extension of QPSK, that quadrature PSK. So,
this amplitude mixed with the quadrature PSK, send 2 different signals simultaneously
on the same career right use 2 copies of the carrier once shifted by 90 degree. Two
independent each carrier is ASK modulated alright, two independent signal over the
same medium demodulation and combination of the binary things.

So, if I have 2 binary things then I can have totally 180 degree apart as I was mentioning
that 90 degree. So, it should be out of phase that is one 80 degree apart, where as in this
case we have a quadrature like 90 degree apart right. So, quadrature QPSK, so it is
carrier modulated by thing. So, I can have independent of the amplitude I can have either
2 or quadrature 4 in the PSK type of things like, 4 type of 4 phases out of this within that
signal length. So, I can have multiple level of thing so to say right.

So, 2 independent single can be same medium modulated and combination if the binary
origin and binary output.

1209
(Refer Slide Time: 22:29)

So, these are these are the some of the techniques where we have those these sets of
things, where we have this digital data analog signal conversion; with the things and
primarily looking at different these are the prominent ASK, BPFSK and BPSK or binary
frequency 2 frequency 2 level of amplitude here, we have 2 signal at 180 degree apart.

And then we can have a quadrature FSK along with that quadrature PSK, and along with
the ASK to have a QAM which is pretty popular and we can have multi-level of
transmission.

And we have finally, not finally, that analog data to digital signal there is another
conversion that is the analog digital signal. So, it is a process of digitization I have
analog data I want to digitize that signal right. So, that data can be transmitted using
conversion to analog data to a digital data and data can be transmitted using NRZL, data
digital data can be transmitted using other than NRZL and so and so forth.

Analog to digital conversion is using some a concept called codec coder and an decoder.
So, what we say codec there are 2 principal codec one is pulse code modulation and delta
modulation again core communication techniques those who are from the
communication background have studied this so there is 2 techniques to convert.

1210
(Refer Slide Time: 24:02)

So, I have a analog signal digital digitizer and a digital signal.

(Refer Slide Time: 24:08)

So, in the PCM it is a sampling theorem if the signal is sampled at a regularly at a rate
higher than twice the highest frequency, signal frequency then it can be faithfully
regenerated. In other sense, if I have a voice great thing of 1000 hertz or 4 kilo hertz my
sample should be somewhat the rate of the 8000 samples per second; for efficient
reproduction of the voice signal right.

1211
So, samples are analog samples called PAM samples that is pulse amplitude modulated
samples. To convert to digital data analog must be assigned a binary code right. So, all
analog signal that should have a binary code alright.

(Refer Slide Time: 24:58)

So, this is sample is quantized to some level right. So, if I have a sample like quantized
in the some level. So, I may so a digitized value then I have a quantization value the
original signal is now only approximated.

And cannot be recovered exactly, the effect the effect is called quantization error or
quantizing noise. So, what we are doing? We have a analog signal converted to a digital
signal, but the these values is going to be quantized right to be in some levels.

So, that the more finer the quantization better is the reconstruction, but there is always a
challenge of that how much data load can be there. So, say for 8 bit it gives a 256 levels
for 8000 samples per 8 bit we can gives a 6 kbps for a singing voice channel right. So,
this is for faithful reconstruction of the things right.

1212
(Refer Slide Time: 25:51)

So, PCM block continuous time data is coming, so a sampler is there discrete continuous
this a quantizer which quantized into 2 different PCM pulses a encoder digital bit streams
out to the signal. So, this is where the analog to digital conversion is there.

(Refer Slide Time: 26:10)

The variant of that or a another thing is a delta modulation. So, a analog signal is
approximately by a staircase function that moves up or down based on the thing, based
on the movement of the analog signal. If the value of the sample waveform of the

1213
staircase one is generated otherwise 0 is this 0 is generated. So, step and the sampling
rate also plays a important thing again you people are picture you see in the things.

(Refer Slide Time: 26:36)

So, this is where it is follow this step or staircases. And it goes on generating this 1 and
series of 0’s and 1 type of things based on the staircase phenomenon. So, one it is here
this is 0 to 1 and then it is 0 again, then it goes on up and down and type of things.

(Refer Slide Time: 26:58)

So, analog data to analog signal so modulation combining an input signal carrier
frequency. To a carrier frequency they are telling that it is a modulation and what we

1214
have. So, we have on a carrier frequency we have a carrier frequency the analog signal is
the carrier frequency is modulated based on the analog signal.

So, can be amplitude modulated where the amplitude is changed, it can be frequency
modulated frequency of the carrier frequency is changed and phase modulation phase for
the carrier frequency is changed. Why carrier frequency because we want to use the
range of allowed frequency on the things right.

And the usually the your normal data may be very low frequency data in a low range
which is which may not be faithfully transmitted to the transmission medium or prone to
several attenuation effects.

(Refer Slide Time: 27:50)

So, what we see few observations both analog digital form can be encoded either analog
or digital signal. The particular encoding is chosen for the specific purpose, then we have
seen the digital data digital signal we have looked into digital data analog signal, analog
data digital signal, analog data and analog signal.

1215
(Refer Slide Time: 28:06)

So, these are the different variants of these are the different possibilities. And as I
mentioned these are code communication what we are looking and is more overview, if
you those who are interested can go deep into the any standard communication book or
literature.

(Refer Slide Time: 28:24)

Other part what we thought that you are mentioning is the multiplexing and the
demultiplexing. So, is a way of sending multiple signal or stream of information over

1216
communication link in the same time in a form of a single complex signal and Demuxing
the reverse of the things.

(Refer Slide Time: 28:42)

In most of the cases what happened I need there is several signal that need to be pumped
through a S N R medium. So, there is a need of multiplexing the signal and sending the
things and demux at the other end right. So, provided this signal is able to carry the
things or in another sense if I say; like it for say conversing say I have different type of
different carrier frequencies.

And things are being say modulated at different carrier frequency and pumped to the
things and I extract every a carrier frequency and extract the data out of things. So, that if
the channel capacity is there then I can multiplex the data into the things right this is a
frequency division.

1217
(Refer Slide Time: 29:20)

I can have different type of like that multiplexing. Frequency division multiplexing is
one of the popular thing. Wavelength division multiplexing is sort of a frequency the
philosophy is same, but at the wavelength level. Other than other 2 a Time division
multiplexing and Code division multiplexing right; TDM and FDM are widely used.
WDM is a form of FDM used for optic in optical purpose where the wavelength is
important CDM is a mathematical approach for cell thing so it is encoded.

(Refer Slide Time: 29:52)

1218
So, frequency as I mentioned there are different channel or so to say different carrier
frequency which are thing. So, these are different channels what I have separate channel.
I can plus them into different carrier frequency and carry and the receiver does that.

(Refer Slide Time: 30:10)

In case of WDM, it is same the conceptually same instead of different frequency we are
using different wavelength.

(Refer Slide Time: 30:17)

In time division multiplexing we have different sender and the data flow time slots are
given and the every data is this time slot 1 2 3 4 and type of things.

1219
(Refer Slide Time: 30:31)

And there is a concept of synchronous TDM, where even that every time slot for every
station like this is no data C 1 C 2 A 3 D 2 then no data no data A 3 and like that. So,
every fixed time slot that is synchronous easy to detect and type of at the other end.

Where are you have statistical TDM what we send where the data is there. So, it is more
better utilization is a easy lot of blank data or underutilized data sets will be there, but in
this case we have a more compact representation. And that helps us in better utilization
of the chair length so, that is a statistical TDM time variation multiplexing.

(Refer Slide Time: 31:14)

1220
And there is a concept of code division multiplexing it is a more mathematically
formulation; that means, a code is generated which is which we called a chip, which is
encoded based on the code which is decoded at the things it is more used in our mobile
technology.

So, used in the part of the cell telephone system and some satellite communication
specific version of CDM is called say used in CDMA in cell phone, called code division
multiple access or CDMA technique. CDMA technique does not rely on physical
properties such as frequency or time CDMA relies on a mathematical idea value for the
orthogonal vectors of the things; like if you see that if the each sender is assigned to a
unique code or sometimes called chip is C 1.

So, there is a known chip sequence for when you every sender is assigned a chip right.
So, these are orthogonal vectors and; that means, that their dot product will be 0; that
means, that the other end as we know, the this chip sequence that can be extracted. So,
this is a very interesting phenomenon that handling 3 handling the different data set with
orthogonal binary code sequences right. So, that is exploited in the in case of in for code
division multiplexing or CDMA technique.

So, what we try to see today is that different type of encoding modulation and
multiplexing techniques which helps in faithful communication or of the data through
these communication channel right. So, though again I mentioned though is a
communication related phenomenon, but it is we tried to have a overview of the what are
the different aspects which are there. So, with these let us conclude our discussion today.

Thank you.

1221
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 58
Network Security – Overview

Hi. So, we will be continuing our discussion on Computer Networks and Internet
Protocol. Today we will be discussing on a topic of called Network Security; or per se
rather initially we will be discussing as a security of the Computing System per se what
we mean, and then we will look at the Network Security. So, to say we as per as the
course is concerned, it may not be within the very core of the overall course of computer
networks and internet protocol, and but what we thought that without talking or
discussing something on network security, the overall phenomenon may not be complete,
alright.

So, we thought that we will add one if possible 2 lectures on computer per se this
network security, right. And but for your convenience that will be most likely not
including these in your exam per se. So, that is more of a thing what we like to say that
to see the security aspects and what are the approaches things, but do not bother about
the exams.

So, what why this is becoming important? Because see today’s world or today’s
enterprises or today’s day to day interaction are all becoming dependent on not only the
computers, but more dependent on the network level activities or computer networks,
right whether you are booking a ticket, or even paying your different your utility bills
like electricity bills and water bills and type of things.

Even sending messages or looking for things, looking from information for some aspects
and everywhere what we see this is a omnipresent; like, if you even look at the banking
sectors. So, a more or less we are going to a scenario where you do not have to visit bank
at any point of time, everything you are doing on the system. So, in other sense that
becomes a this become a becoming one of part and per sell of our not only the enterprise
network or organisation. It is also a becoming part and per sell of our day to day life right
whether it is requirement or infotainment, where we see the security become the this
network become a important aspects.

1222
And in several as several activities, they are there is some sort of financial transaction is
involved, right. And whenever there is a financial transaction involve, that becomes
important to make it secured, right, or weather at all loopholes are there. I can say that
the network is per se is secured network. Then there is no loophole right. So, whether
there is a loop hole is there, where is a chance of loop hole is there, or what sort of quote
unquote attacks can be there on the overall our network infrastructure; whether it is only
affect the network or also the systems things, and different aspects of the things.

So, security is becoming a necessity rather than a yet another subject type of things,
right. If you look at the overall academic courses, this network security, computer
security, information security, these are becoming a not only a subject a line of vertical
quotes altogether.

So it is not possible to cover everything, but we will try to open up or look at the thing
that different aspects of the security aspect. So, in this lecture we will initially will try to
look at that what are the different aspects of security, which is related to computer and
information security, and network security also and then what specifically we need to
look at the, how what are the mechanisms and way we can make our infrastructure or the
network secured.

(Refer Slide Time: 04:35)

So, what we see that, when we look at the security per se, then what we are trying to look
at? Primarily 3 aspects we want to look at confidentiality, integrity and availability,

1223
alright. So, these are the things if these are bridged we say that the security is bridged
right. So, confidentially deals with keeping the data and the resource hidden alright, so
that is confidential. So, if you are if I am sending a message to you, or you’re sending a
message to me, so if it is mean for me only so it should be kept confidential. There
should not be anybody who is listening to this message or reading this message, right.

So, confidentiality keeping the data and resources hidden or confidential integrity, what
we say that data level integrity is that the message what I am sending should be reaching
to the destination the same fashion. So, that the data is not being tampered right. If I am
sending a message, so the data level integrity is there. There is another issue of origin
integrity or what we say authentication; like, how do I know that who is sending is a
correct person, alright. So, if I am say getting a message that today there will be a
something say power cut and shut down the system, or something, then I how do I know
that it is from the correct authenticate that thing, right.

So, this is also a question of integrity and then availability, enabling access to the data
and resources right. I say that there is nobody looking at the data, no body tempering the
data, no there is a message is coming on the same thing, but what I do there is a huge
amount there is some way or other I not make the thing available to you, right. Like what
I mean to say that, I if there is a attack like this by which you cannot access the internet.
Otherwise everything is working fine. There is no question of integrity or confidentiality,
but the internet is not accessible due to some problem, right. There may be physical
problem of disrupting the things or there can be some other problem of say lot of traffic
increases congestion etcetera.

So, there is what we say a attack on availability the resource is not available, enabling
access to the data and resources this is the availablity. So, if you see this CIA, primarily
rules the all above things whether it is network related, whether it is computer related, for
that matter any type of document related.

1224
(Refer Slide Time: 07:18)

Now, what are the different types of security attacks can be there? So, if you see there
can be typically 4 category of the things. One is interruption like, so if I interruption,
interception, modification, fabrication, right.

(Refer Slide Time: 07:36)

So, these are the 4 type, basic model is that a message is being sent to source to
destination. So, interruption is the attack on availability right; so it is blocked some way
or other, either physically or through congestion or something that so that message
cannot reach to the destination.

1225
So, sometimes we can say that this is a type of denial of service. So, if you cannot this to
the things. There is a attack on another kind what is interception right. So, attack on
confidentiality A C sending to D, but that intercepted and it is also I is listening, or a
attacker is listening to the things, so it is a attack on confidentiality.

(Refer Slide Time: 08:19)

There can be a attack on modification. S is sending something to D, it is being


intercepted and modified by I and send to D. So, it is a attack on integrity, integrity of
data is there. And there can be a fabrication, I is sending to D pretending to be S right.
So, I is sending to D pretending to be S; that means, there is a attack on authenticity of
that particular origin. So, I cannot somebody else is pretending to be somebody else. So,
these are the type of attacks which can be there.

1226
(Refer Slide Time: 09:06)

And if you look at the type of disclosures, so one is disclosure is a type of threats, one is
disclosure that is snooping. Deception, modification, spoofing, repudiation of origin,
denial of receipt and type of things are deception, right.

So, this can be deception. There is a threat of disruption of services; that is that can be a
threat of disruption. And there can be a threat of usurpation, that modification spoofing
delay denial of service. So, these are the different category of threat. So, what you are
trying to see? What are the different types of attack, what are the different types of
security attack, what are the different types of security concerns, and what are the
different types of security threats, right.

1227
(Refer Slide Time: 09:57)

And then what we try to do? We try to make some policies and mechanisms which will
enforce my mechanism which will enforce my policy. Like, so I have some security
policy, this may happen this may not happen etcetera, etcetera and there should be a
mechanism to enforce. So, policy says what is not allowed. So, what is allowed and what
is not allowed. This defines the security of the site system etcetera right. Mechanism is
enforce on the policy enforcement of the policies is by through mechanism, and there can
be composition of policies, policy conflicts, discrepancies may create security
vulnerabilities right.

So, there can be if there are I have a policy and there is a mechanism to implement the
things, if there is a conflicting policies, then there may be a security vulnerabilities may
arise right. So, it becomes system becomes vulnerable right. So, why policy may
conflict? Because sometimes the in a large organisation or large system, the policies may
not be all globally decided, this is piecewise decided. But when you piece wise decide,
when you integrate the things, there may be a problem in the conflict of the policy.

There can be other way the policy may not be a conflicting, but while implemented in a
distributed manner that can be conflicting the things. Like I will give you one example,
suppose IIT Kharagpur policy says that during a time period say, class hours or at mid
night, there should not be any internet connection from the hall to internet, right.

1228
However, this is a policy however the same in the same policy document that is there;
however, that connects in from labs to the internet it is not restricted, because that is
allowed. So from the hall of residences or students hostilities may be restricted say this is
the; now policy wise this is documented by when implementing implemented the policy
in the hall particular security server or your switch which is say security enabled. And
another thing we implement at in the departmental switch or departmental say they are 4
plus switch.

Now, see I can way this does not restrict the hall to access the departmental server, and
make a hop from the departmental server to the internet. So, in a sense I have violated
the policy. But as such the overall implementing mechanism may not be that tough to do
that, right. Now it is may not be that straight forward to do in that, but there is a way to
create this what we say it is a vulnerability, right. Vulnerability may also crop up if there
is a something where policies are conflicting. We will see some of the things.

(Refer Slide Time: 13:00)

Now, well what goal of security, what we do we want first of all we want to prevent,
right prevent attackers from violating security policies. If I have a security policies,
prevent.

So, it is even if we look at our normal say what we say security of our particular
building, particular campus, etcetera forget about the network that is also things are
there. So, it is a prevention to prevent the violating security policy, if there is a another

1229
thing is that, it is a detection, if there is a attack the detect attacker violation of the
security policy, I should be able to find out that where that attacker things are there. And
then another aspect is the recovery, stop attack, access and repair the damage, continue to
function correctly, even if the attack has success.

So, that is a case of continuing with the function even there is a attack on the thing, so
this is a called a recovery. So, prevention, detection, recovery are 3 components of a
typical security goal.

(Refer Slide Time: 14:05)

Now there is other co things comes up. There is a concept of there is a concept of trust
and assumption. Underlie all aspects of security. So, say in our normal thing if I am
having a security guard at the entrance of the building, I trust that guard, alright. And
also I assume some of the things right. Like the attacker is likely to enter through this, I
think that the attacker will be this category, this category of guard or mechanism able to
solve it and type of things.

So, there are underlying any security things, whether it is network security or computer
security or any other security, I have some sort of a trust on some of the things. And also
I assume that this is the overall environment where the things are need to work, right. So,
the based on that we want to formulate policies unambiguously partitioning, the system
state right. So, I say this is the security state, this is non security state, correctly capturing
the security requirements right. So, if I want to see that the a particular building or say

1230
IIT Kharagpur what are the security requirement network infrastructure of IIT
Kharagpur, first of all I need to know that what are the requirement.

And then if I want to implement divide or partition them into particular system state, that
if this system is going to this system, and this state to the state and type of things, then it
is; what are the security consequences. And finally, I should be have some mechanisms
which assume to enforce this policy. Support mechanism work correctly. So, I have
policies and mechanisms and there based on the trust and assumption.

(Refer Slide Time: 15:49)

So, types of mechanisms. Suppose these are set of reachable states. So so what you see?
That any system or network is a dynamic and active system, right.

So, in the sense that, every activities it is going on the things we can think of the system
is going from one state to another right, say for example, for simplicity I have a laptop.
So, I install say particular operating system, then I put the security patches. So, while I
install the operating system, it is in some state S1, when I do a patch the security patches,
it goes to some state S2, then I put another application over on the same system, so it
may bring some vulnerability, may not bring some vulnerability, but goes to some S3.
And so that means, and I go on working with the things put pen drive etcetera, etcetera it
go on what we say at different level of or different type of security states, right.

1231
Same is true for the network right, you have different modules add devices, add network
level devices, change the network level operating system, enhance those things, patch
with new type of things, and it goes on going to the state. So, if I look at the IIT
Kharagpur overall network, so it is a, what we say? Lively thing, right it is goes on the
different state. So, I say state S1 S2 and S3. So, our goal is that that if it is it should be
within the secure state. So, I say that set of reachable state is identified by this diagram,
and set of secured state is this. So, these are set of reachable state, so if I say whatever I
do I am always within the secured state.

So, if the secured state is a super set of the reachable state, then I am secure. It can be
directly precise like, whatever is it is on the directly mapping on the things or one to one
making (Refer Time: 18:09) precise state. It can be brought like some of the some of the
reachable state outside the security perimeter then what we say? It is some broad level
security, but there are some security things which are beyond this type of things. So, this
is true for definitely for network security it is true for any type of security aspects right;
so our basic thing that it should be hovering around this two; if it is always good if I can
put it like this right. But as we understand, security is a costly affair right. So, whenever
you want to put security, you are first of all putting more cost on it.

Secondly, you are basically making it more what we say time consuming things. So, it
perform a degradation may be there like, I say that if I can enter a building or a particular
campus straight away. So, I go on a particular level of flow is there, but everything is
being checked with ID card scanning etcetera, it goes on a of obstructions ways things
are there right. So, that means, not only it did not cause cost in terms of monetary it also
have lot of mechanism into place which may affect the overall performance.

1232
(Refer Slide Time: 19:23)

Then above all doing said all those things, what I want to guarantee is the assurance. So,
specification though assurance has a specification, requirement, analysis, statement of
desire, functionality, design and implementation. So, given, so when I implement a
security infrastructure say, particular this building or IIT Kharagpur by somebody, it
maybe is whole team of IIT Kharagpur or from external third party, what I want to look
at, that after doing this after investing this much of amount and this type of thing what is
the assurance that I should get that it will not be breached, or in up to what level it is
secured right. So, I can need to know say 1 to 10 scale or there are different security
standards upto on that basis of that out level I have secured right.

So, what I require a set of specification right; so design constant how system will meet
the specification; so requirement analysis statement of desired functionality and
implementation; programs systems that carry out the design. So, there is a thing of this
implementation.

1233
(Refer Slide Time: 20:32)

And of course, there are operation issues, cost benefit analysis, whether investing so
much whether it is becoming a cost benefit there is a return on investment. There issues
of risk analysis should we protect something how much should we protect the thing
etcetera. Like we can say that protecting instead of there are say 20,000 odd system in
the IIT Kharagpur campus or within the academic campus or even all the campus.

But those all are not important to the authority for the IIT Kharagpur authority or smooth
functioning, maybe 100 out systems are more critical. So, whether to protect everything
or I have different level of security for the things, I have a very cool level security or
very strong security for those things which are which matters, and which are maybe
some other thought of security. And above and all we should have low customs. And also
standardization guidelines, which has to go into or desired security measure illegal will
people do with them or something whether those are things which are legality there.

1234
(Refer Slide Time: 21:36)

And of course, there are human issues organisation problems, people related issues those
are there.

(Refer Slide Time: 21:42)

So, putting them together; so what we have we have threats based on the threats we
frame policies. To implement policies, we design specification. Specification are with the
help of specification we design the overall security scheme or mechanisms, and
implement those mechanism and then I operationalise right. And then if there is and it
goes on in different loop. So, from there it goes on implementation or design change or

1235
specification change or policy change, or while operating it may generate new threats
right. So, this is a very dynamic and some sort of a lively thing. I should not say fully
real time, or some sort of in your real time or a lively thing which is very dynamic and
mutable things right type of things.

(Refer Slide Time: 02:35)

Setting all set is means giving all those things. So, if we look at the attacks, so there are
broadly 2 category of attack. One is passive attack; another is active attack. So, passive
attack obtain information that is transmitted, so some of a eavesdropping. So, there are
there about we say that it is sniffing and doing and information gathering, but it is not
involving active attack. They are more information gathering type of information. So,
that can be a some software which is residing and carrying information about network
which is etcetera, etcetera and go on transmitting to the somebody, so that it can launch a
active attack.

So, 2 type of release of message content, it may be desirable to prevent the opponent
from land landing the content of a transmission system. So, that it is clamped on the
things traffic analysis. Opponent can determine the location and identity of the
communicating host, observe the frequency and length of the messages etcetera. So, it
can analyse the traffic and try to see that what sort of things are there. So, it can be 2
things very difficult to attack detect this type of passive attacks, because they are not per
se, so any manifests on the system. So, they has to gather on gather information and pass

1236
it to somebody else and that goes for a active attack. So, they are not immediately
involved in the thing. So, some sort of a spying and type of things on the network at the
network level.

(Refer Slide Time: 24:10)

So, active attack on the other hand involves some modification of the data stream or
creates any false stream and type of things. So, that is a active attack 4 categories are
replay may be there that is masquerade, one identity pretends to be a different identity,
replay passive capture of the data units. And it is subsequent retransmission to produce
an unauthorised effect. So, it is replay type of attack it can be modification, some portion
of the legitimate message is altered. So, it is modified, it can be denial of service,
prevents the normal use of the communication facilities.

So, there can be a denial of service right. So, dos attack very, what we say quote unquote
popular attack so to say to create a denial of service everything is in place, but you
cannot access the information. So, there is a denial of service attack.

1237
(Refer Slide Time: 25:06)

So, what are the based on this? If you look at the difference security services; so it is
confidentiality. So, some sort of a service call privacy, authentication who created or
send the data to find that authenticate? Integrity has the data has been not been message
has not been altered, non-repudiation the order is final this is this is a typical thing like,
like if I say instruction over the over the internet over a message to the bank.

And say transfer x amount of money from my account to some mister something, abc’s
account alright. So, some (Refer Time: 25:49) the bank transfer based on the thing, then
next I later I say I never told this, right I never told that to transfer the things. Right how
do you created the things right. So, that requires a some sort of a non-repudiation. That is
weather how can I guarantee the order is final. I buy a ticket, air ticket or l ticket or bus
ticket through some internet service, and then I say I never bought that right.

So, how do I say that I only did, somebody else has not this, whether the bank has itself
not did right. So, then the bank there are different mechanisms like one is going to digital
signature. If you recollect that now it is not that required otherwise we need to do some
while purchasing something from is a departmental source swiping your credit card or
debit card, they will give a paper where you sign and they will keep that sign thing and
give the things.

So, why that is whether you think that they are it is not possible that thousands of slips
are going to banks and type of things. It is basically if there is some allegation that it is

1238
not then they will show that see this is a sign thing right. So, this is a case of non-
repudiation. So, what we use method of OTP, or sometimes that active the mean spin to
enter the things. So, it is says that the order what I have given is final, you can go ahead
with the things. There is another aspect what is we call access control mechanisms right.

So, they are while you are accessing things over net internet it set that so that is what will
be the access control mechanism right. So, there are different type of access control
mechanism like mandatory access control, discretionary access control, very popular is a
role based access control, based on my role what I can access is defined like based on the
role I can access this type of data set or this part of the network and type of things right.
So, this is access control also prevent misuse of the sources.

Then finally, we have the availability. So, permanence on non-erasure of the things like.
So, if I am able to access something over the internet. So, and if I have a right to do that,
then it should be available to me, right. So, if any attack on this availability there will be
a denial of service attacks right. So, the you these services are some sort of a dos attacks
right. So, there can be viruses which deletes a file right this is also attack on availability
right. So, there are these are different security services which tries to prevent this type of
attack, or give this type of things like availability ensured, confidentiality ensured,
authenticity ensured, etcetera, etcetera. Access control is ensured and so and so forth.

(Refer Slide Time: 28:58)

1239
So, role of security: a security infrastructure provides confidentiality, protection against
loss of privacy, integrity, availability, authenticity, authorisation, non-repudiation and
safety protection against tempering damage and theft. So, these are the role of security
features which is true for other computing system, also true for our network systems.

(Refer Slide Time: 29:19)

And also we have seen type of attacks. A very popular one this days is a social
engineering or phishing. Physical break ins theft curb etcetera is there physical attack
password attack. Buffer overflow attack, right overflowing the buffer and going to the
other segment and type of things.

Command injection type of things like a we or that SQL injection type of stuff. Denial of
services, exploitation of faulty application logic, if there is a faulty application logic in
the systems, if it is there then I can do a attack on the type of things. Snooping, packet
manipulation and fabrication, backdoors and these are the different type of attacks what
is possible.

1240
(Refer Slide Time: 30:10)

So, with this thing if we try to look at that what is our network security outline. So, it
works like that determine the network security policy. Say, if I take a IT infrastructure,
what is the network security policies? Implement network security policy. So and there
are other that, so one is determining then implementing, then other aspect is
reconnaissance, then vulnerability scanning, penetration testing, post attack
investigation.

So, these are the different; these are the different what we say steps towards securing a
network. So, will look at step one by one that what are the different aspects of the
network security right. So, how to go about it this network security aspects?

1241
(Refer Slide Time: 31:12)

So, state step one is determine the security policy. So, security policy is a full security
roadmap, right usage policy for networks servers etcetera, user training about password
sharing etcetera. So, what we say making the user aware of these are the things. There
can be privacy policy of maintained data.

So, if I storing the data, what is the privacy policy a scheduled of updates, audits etcetera
that is also important. So, there is user’s policy of the network server etcetera. So, user
training about user making the user aware of the things; privacy policy of the data
maintained data or the stored data, scheduling the updates laptops things will be there.
So, it should be there the network design should reflect this policy. So, whenever we
design should reflect, replacement production of database file servers. Placement and
protection of the database, file servers why it will be placed, whether it will be in the
DMZ zone or where location of the demilitarized zone.

So, there is a concept of demilitarized zone. We will see later. So, what we say that see if
IIT Kharagpur is a secure network; if you want to make this IIT Kharagpur network
secure. So, what are my exit point? Typically, the exit points are the routers by which
things are connected at to the external world. So, what I mean what is my basic goal, I
want to basically secure these exit things. Or and so, in other sense I want to make this
militarized zone.

1242
So, to say right so these are my militarized zone. So, but some of the things I want to
expose right like my web server I want to expose, people should see that my webpage
and other things. There can be different other some of the applications which people can
want to work from the outside that is to be exposed. So, these are to be put into
somewhere what we say demilitarized zone alright. So, this is important to look at that
what are the different scenarios of this demilitarized zone. So, the network design should
reflect this policy should this policy placement of rules and firewalls; the deployment of
intrusion detection systems.

So, where do I put the firewall? What should be the fire wall rules? And there should be
a deployment of intrusion detection system. So, if there is a intrusion is there how to
detect that system, rather there is a another sort of systems called IPS intrusion protection
system.

(Refer Slide Time: 34:02)

So, implementation of security policy; so implementing a security policy include


installing and configuring firewalls. It may there are different way of handling this. So,
we are not going to the details of the things. So, IP tables is a common free firewall
configuration for Linux, some of you may be worked on it or knowing it. Rules for
incoming traffic should be created. Rules for outgoing traffic should be created. Like, I
can say that incoming traffic only http is allowed, where as outgoing I can allow we
allow telnet ftp type of things.

1243
So, both the rules should be should be there in the firewall. We will try to see those
things when we look at that little aspect some aspects of firewall configuration. Installing
and configuring IDSes like so or that intrusion system detection systems. So, there are
different tools some freewares are available, some are paid things are available, right. So,
one is not is a free and upgradable IDSes for several platforms. Most IDSes are send
alerts to the log files regularly. So, it is logged serious events anti guard paging email and
telephone right.

So, by these 2 things what we are trying to look at is the one aspect is that determining
the security policy. Say, what will be the different de security policies. Another aspect is
how to implement the security policies right. So, these are 2 things are important, other
than other miss will come to that other aspects of the things. So, when we frame a
network right. So, when we try to trying to design a network. So, along with
performance, efficiency, reachability, scalability, we need to also keep in to mind that
what should be my security policy, while implementing, or deploying the network
whether those security policies are implemented into the system or not that needs to be
looked into right.

So, what we will do? We will continue our discussion on network security in our
subsequent lecture, and with keeping in mind that our basic network infrastructure into
thing. Also we will try to see some aspects of the things like whatever we have seen that,
in the TCP/IP layer, what we can do with those things with the security things, right.
Now we see the TCP/IP layer or OSI layer per se does not talk about the security aspects.

And security comes additionally in doing so we should be careful that intermediate


devices which gives this packet with there should not be any problem with the standard
right. If there is a problem or if there is a intervention or there is a interference with the
standard that the packet may not be forwarded to the next hop right. So, in there are lot
of consideration which need to be looked into. We will try to see some aspects and
overview of the things which keep as a overall feel of the what are the network security
aspects.

Thank you.

1244
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture – 59
Network Security – II

Hello. So, we will be continue our discussion on Computer Networks and Internet.
Actually we are discussing on Network Security in the last lecture; we will be continuing
our discussion on network security. So, what we are in the last lecture we are discussing
on some of the aspects of network security like determining network security policies,
implementing the security policies and there rest of the things are step by step what are
the things will be there.

(Refer Slide Time: 00:49)

So, actually we have seen that how to this thing that what are the issues related to
determining the network security policies.

1245
(Refer Slide Time: 00:57)

And also we have seen the issues related to implementation of the security policies, right.

(Refer Slide Time: 01:03)

And, today we will look at the other aspects. So, if you look at the implementation of the
security policies. So, we require other than our standard devices we require some more
stock right like one is that IDS intrusion detection system. And, there is a concept of
firewall like firewalling the thing and there is another thing called firewall or NAT will
come to those aspects and this is my internet network.

1246
So, what I am trying to do? I am trying to do a internet network secure from the rest of
the world or so to say the internet, right. So, what I am having a router to connect to the
internet and there are some of the devices which needs to be external to be needs to be
put some place where it will be accessed by the external world. So, that is the concept of
demilitarized zone or DMZ zone where the external server which need to be accessed
like a for example, web server or some other servers we need to be accessed they are in
the DMZ zone. So, there is a switch which connects this DMZ zone through the firewall
to a some sort of a hub to router and this hub as the whatever the packets comes in the
hub it is in the same broadcast and collision domain.

This idea is basically try to look at the intrusion detection system. So, it has protocols it
has a logic to look at that to detect the interface or it has a database of knowledge base
that how to detect. And, this firewall is basically to prevent to the thing from the external
world. Now, IDS cannot be inside firewall right then it cannot know that what is going
on inter the things right. And so, there that is DMZ zone if you see there are two category
or two firewalls one is which basically makes a isolated DMZ zone.

So, this network is protected through this firewall whereas, this firewall protect this the
systems in the DMZ zone and create a space where this type of systems can be there
whereas this is a more exposed things where we want to know that what are the different
type of net attacks etcetera are going on.

(Refer Slide Time: 03:25)

1247
So, implementing security policies one is the firewall is one of the major aspects other is
the intrusion detection system or IDS and also there is a concept of honeypot or
honeynet, right. So, it is something which are which attracts as the name suggest attracts
this attackers to attack on the things.

By that it the signatures of the attacks are learned which may update the knowledge base
of the IDS or something IDS detection systems and other things. So, that is important to
have those type of things in large installation which are things. Now, there can be a
network of this honeypots and to share the information and it can be across different
organisations also. So, that there is a other information. So, simulates a decoy host or
network with services which are exposed to the attack where the attack signatures are
learned.

(Refer Slide Time: 04:21)

The next step is to learn about the network. I need to know that what the networks IP
address of the host on the network, key servers on the critical data, services running on
those host and server, vulnerabilities on those server. So, two form, one maybe a passive
or active. Passive thing is that undetectable as I will say and active are by active attack
on the things or which can be detectable by the intrusion detection system.

1248
(Refer Slide Time: 04:57)

So, another aspect what we want to look at the network that is the vulnerability scanning
next step is the. So, I want to scan that how vulnerable I am. What are the vulnerabilities
inside the thing? So, list of host and services that and many scanners will detect
vulnerabilities like there is a scanner called nessus, other scanner will allow you to
exploit them right. So, there is a metasploit source cannot exploit. So, if the vulnerability
is there how to exploit them. Like I say there is a vulnerability in the user level login
case, right. So, that is exploited to generate a higher level access right to the things. So,
this is a one is that one the attack happens then you detect and learn other is that I can do
a self scanning of the things.

That what are the different vulnerabilities viz a viz with my exploit database and try to
find out what sort of vulnerabilities are there. So, there are scanners which are updatable
that is for few vulnerabilities install write new plugins. So, nessus attack scripting
language and there are several language is there. So, that is means scanning the
vulnerabilities.

1249
(Refer Slide Time: 06:13)

So, if I have the vulnerabilities whether I can do some sort of a penetration testing like I
want to do some sort of a what we say non-lethal attack on my system and see that how
much I can penetrate and type of things or some sort of a ethical hacking on the systems
right identify the vulnerabilities once the vulnerability identify we can exploit them to
gain access using a framework like metasploit is a simple as selecting a payload to
execute otherwise we manufacture a exploit or we generate an exploit and type of thing.
So, there are different exploit for which there is no per se prevention on the things. So,
these are these are what we say this zero day exploit type of things.

So, there are with there are so to say quote unquote costly exploits. So, that things are
there, but once we learn then we go on patching. So, we may have also try to find out
new vulnerabilities, this involves writing code testing function etcetera. So, these are this
is a separate activity of the security group of a organisation to look at that what are the
different well known vulnerabilities and type of things do a sec self exploitation of my
network or ethical hacking on my network, find out that what are the possible attacks
which are possible in to the systems and then try to recommend or find out what are the
mechanisms will help in the detecting a in preventing those, right. So, these are the
different aspects of this exploits vulnerability scanning and what we say penetration
testing.

1250
(Refer Slide Time: 07:45)

Now finally, we have the post attack investigation. So, forensic of the attack so, like if
there is a attack then we have to investigate and do the some forensic or post mortem of
the attacks, right. This process is heavily guided by law like what we have to do and
what are allowed etcetera and there can be different guidelines from the organisation to
organisations like the type of things which is true for academic organisation may not be
true for a banking or financial organisation.

So, retain chain of evidences. This evidence is the case in this case is the data on the
host. So, that is a what are the different evidences log files of the compromised host to
hold the footstep or the fingerprints of that attacker to find out that how that attacker
came. Every minute with that host must be accounted for. For legal reason you should
also examine a low level copy of the disk and not modify the original thing, right. So,
type of things that for legal later on some litigation etcetera we need to do specially
commercial organisation, organisation giving services to other organisation and type of
things.

So, in some cases your data is in some other place and type of things and need to be
handled appropriately. So, what we see these type of steps are not a onetime things, it has
to be executed on a routine basis because the system is evaluating or having different
state at different point of time. There are different updates applications attacks and type

1251
of scenarios are changing both the system scenarios are changing on the other side these
attack scenarios are changing, right.

(Refer Slide Time: 09:33)

So, vulnerability assessment of any network is very important, right that I need to a priori
know that how vulnerable I am, right. So, though it say something which is difficult to
say that I fully charged, but never the less there should be always a way of or always
looking at the vulnerabilities. So, today’s enterprise are fully or mostly IT enabled, right.
So, any enterprise any organisation any even academic institution or any government
federal organisations are all IT enabled, right or heavily dependent on IT infrastructure
where the networking plays a major role in making things connected. So, need for self
security that is vulnerability assessment is a order of the day, right. You need to do
vulnerability assessment. So, there are content aware intrusion protection system. So, it
is content aware IPS, file system scanning, penetration testing. So, these are the different
aspects which we need to be looked into.

1252
(Refer Slide Time: 10:53)

Now, this penetration testing sometimes also called the tiger team attack or red team
attack that test for evaluating the strength of all security controls on the computer
systems. Goal, violate the site security policies. So, the I have a security policy a
mechanism to implement those policies then I what I want to know that whether I can
basically compromise this policy and attack this the system, right. So, not a replacement
for careful design and implementation with structured testing. So, it is independent of
what the best practices you are having. So, it is a careful design implementation structure
testing in spite of that whether there is a loop hole or not need to be looked into.

So, methodology for testing the system in toto right once it is in so, system in place. So,
the system is in place I have a mechanism to testing that whether the system is working
faithfully or not.

Examine procedural operational control as well as technological control, alright. So, it


tries to look at procedural operation control and as well as the technological control in
the things.

1253
(Refer Slide Time: 12:05)

So, there are different tools some are proprietary tool which are pretty costly public
domain tools, but good, but others also knows that you are doing like this and there are
integration problem and issues like that. Need to evolve our own framework - proprietary
to the organisations etcetera that maybe a need, but is not may not be always followable
nevertheless there are price product always there.

(Refer Slide Time: 12:27)

So, system vulnerability is in a hole or weakness in the application design flow


implementation vulnerability type can be different SQL injection, buffer overflow.

1254
Penetration testing - method of evaluating vulnerabilities of a computer system on
network by simulating the attack of the malicious hacker.

(Refer Slide Time: 12:47)

So, methods again it falls in that same line we are not again discussing.

(Refer Slide Time: 12:53)

So, if you if you look at the penetration testing things. So, location of the target, block IP,
network setup, vulnerability is in open services. So, enumeration vulnerability
identification then whether we can exploit from the using the exploit database gain
access of the system. Escalation and advancement stage to exploit the other targets,

1255
information gathering and reconnaissance so, to look into this whole loop. So, this is the
way it goes on that you first learn about the system, get the footprint of the different
devices and type of things then accordingly whether they are exploitable consulting the
exploit database then try to escalate and advancement and then again information
gathering and so and so forth, it goes in a loop.

(Refer Slide Time: 13:45)

Or if you look at the typical architectural model of a penetration testing tool, so, there is
a system characteristic knowledge base and system vulnerabilities right. So, these are the
things. So, obtain footprint fingerprint services enumerator. So, that is fingerprint OS
scan reports. So, it is a these are the things which go to find out the system
characteristics. So, this from these the scan vulnerability is to find out what are the
vulnerabilities consulting the knowledge base whether the system vulnerabilities then
exploit targets can be there, right. On the other hand this thing can be used to patch the
target also. So, some of the processes some of the data stores where things are there.

So, it is a not that very straightforward process the requires lot of expertise on the system
level or wage level it also need good exploit database which and which are up to good
and up updated exploit database which allows you to this exploit the system, but
everything done in a quote unquote ethical manner that is non destructive manner. So,
that the system is not goes off rather try to find out that what are the different

1256
vulnerabilities and other things so that the patchwork can be or appropriate patches can
be deployed.

So, with these mechanisms we will try to look at now that different system level things
like as if you just recollect this one. So, there are different type of things right, one is
your router, firewall or NAT there is IDS and type of things. So, we try to see that the
what are the different properties whether something can help us in achieving better
security features.

(Refer Slide Time: 15:49)

So, some of the things like proxy server, network address translator, firewall are some of
the features or the things. To be very to be on at the beginning so, say that these are the
things which are not primarily some not all the things are primarily meant for the
security etcetera. So, they have other purposes also, but also can be looked into as a
security measure.

As these are nowadays common for at all the network and it has some of the property to
isolate the incoming or expose the or can handle the exposing of the internal host to the
external things. So, this can be utilized by the things. Some of the things has been
already discussed in our in your in this lecture series also. But for the say sake of
generality and to continue our discussion we are looking into some aspects again with
the first; that means, we say so, that it is easy to correlate with the what we are
discussing.

1257
(Refer Slide Time: 16:31)

So, what is a proxy or proxy server? Acts on behalf of other clients and presents requests
from the other clients to the server, right. So, proxy is as the name suggest proxy is for
the other clients, right. Acts as a server while talking to a client and acts as a client while
talking to the server. So, it is a intermediate system with this proxying for the other.

So, the primary need maybe I like IIT Kharagpur we may be private IP block which are
not routable. So, somebody is proxing for me and type of things or actually proxy can
have much higher levels like or different type of aspects of the things even do content
based filtering etcetera and type of and allows to do some of the things like caching and
like caching and giving a better accessibility and type of things. So, commonly used
HTTP for this squid, mostly available in most of the systems.

1258
(Refer Slide Time: 17:57)

Proxy server it is a server that sits between the client application for example, web
browser and a real server. So, I am accessing something like for typically for IIT
Kharagpur, if I want to access say any external surface IIT Bombay page, IIT
Bhuvaneshwar page or IIT something or some any other page say some networking or
IEEE standard page. So, what I am doing I am sending a request as I am generating from
the IP a particular private IP even not that we have a proxy server which it hits the proxy
takes that observe that IP and the port and in turn send a request on behalf for me, right.
How the things maintained I have a IP and port proxy has a IP and port and this and the
protocol this proof and this particular tuple is unique for our connections, right.

So, even if I have two browser say Mozilla or something, two instances do the same page
if the things, but they have a different port right going out the thing. So, it intercepts it a
it intercepts all requests to the real server to see if the fulfills the request itself if not it
forward the request to the real server, right. So, what happened that as it is accessing the
things it is also caching the content, somebody requesting it may check there where is
fulfilling the request or not.

1259
(Refer Slide Time: 19:29)

So, there are many servers this two types of servers this works up improve the primary to
improve performance can dramatically improve performance for a group of users. It
saves all the results of request in a cache can generally conserve bandwidth. So, I we
have a thing which is of replying the proxy in turn replying if the already it is in cache
there is filter request that is another types is there or if instead of type I should say that
basic purpose of the proxy server. So, it is not the proxy server types it is rather purposes
of the proxy server.

One is that input performance because it is sending on the cache another it has a property
of filter request right when a request comes checking it that the whether request can be
sent or not there filter the request, in turn it gives a some sort of a security feature. Like
prevent users from accessing a specific set of website IIT Kharagpur, the organisation
think that these set of website cannot be accessed by the inside by means it is own users,
so, it can prevent. Prevent user from accessing pages containing some specified things
even the higher level proxy where the content can be seen where which can prevent user
from specified pages which having a string.

Prevent user from accessing video files for example, the type of things, right and it also
have apart from that the caching effect that we have discussed that to give you things. So,
these are different mechanisms what we can do with this proxy things.

1260
(Refer Slide Time: 21:19)

There is a concept of anonymous proxy hide the users IP thereby preventing


unauthorised access to the user’s computer to the internet. So, it is anonymous proxy
hides the user IP, right and all request to the outside world original with the IP address of
the proxy server, right. So, what are the external IP address of the proxy server the
original routers original this it basically the hides the users IP right. So, all request of the
outside world originate with the IP address. So, the IP address of the proxy becomes the
IP address which is gone to the external server.

It is sometimes very convenient like online subscription of channel like IIT Kharagpur
have online subscription of various journals IEEE, AICE, (Refer Time: 22:05) and type
of things, right I do not know the exact list immediately with me. But, what happened
that instead of while accessing it gives the proxy IP for the access of authentication to
access the journal. Whoever has going using this proxy will be able to authenticate the
get a access to this general things then digital libraries these are the things which we are
which we are benefited here at sitting at IIT Kharagpur and that must be doing we must
be doing in several other organizations.

1261
(Refer Slide Time: 22:33)

So, where the it is located. So, somewhere in between right one side that original server
where it accessing all these user agents are is request come to this proxy server. It has a
access control list or access rules that by which the proxy that particular page can be
requested and all the cache if it is already there, it will reply from the cache. So, that is
the basic bottom line of the proxy server.

(Refer Slide Time: 23:01)

So, function of HTTP proxy request forwarding primary function acts as a rudimentary
fire wall of taking care of that which can be filter. Access control allow or deny access is

1262
based on contents and locations, right. It can do if it is if the proxy is able to look at up to
the content at a higher level then you can it look at the it can open up the packet at the
application layer or the message itself and check that what whether there is a any access
control restriction based on content or based on the location. Cache management utilised
efficient utilisation of the bandwidth for first hour access that is the cache management.

(Refer Slide Time: 23:55)

So, this is broadly the how a proxy works, but it though we are primarily looking at the
HTTP proxy there can be other type of proxy also, right. So, it is proxing for other
services and type of things.

1263
(Refer Slide Time: 24:13)

The next is network address translator. Now, this has been I believe this has been already
has been discussed during the in this course specially, when we discussed about the IP
and type of things. But, I thought that it may be good to have a quick review of the things
to look at the things.

(Refer Slide Time: 24:31)

The as the name suggest allows a single device router or dedicated box to access agent
between the internet, public network and the local or the private network. So, the it
allows it is sort of a single box and it basically map the one IP set to another IP set, right

1264
for that matter IP and proxy to port to another IP an port, so that it can a seamless
connection.

So, tries to address the IP address distribution problem so that that you know that to of
the IP address like IIT Kharagpur is running on a private IP blocks like that several
organisation writing on their private reverse these are non routable. So, this network at
this translate a change this IP to a valid IP which is routable and go on and remember that
who has connected to this for the particular IP. So, that when the requested come from
the client IP plus port and also with the IP port and things goes on. Several variants of
this network address translators are possible.

(Refer Slide Time: 25:35)

So, this private address space like these are on the LAN see this is a private IP space, this
is also private IP space. Incidentally they are using same IP blocks and, but so, if it is on
the in a routable scenario this could have been IP class and it would have been gone for a
spin. But, here what we are doing from there is there is something which translate this IP
to a valid IP is goes on and if it is going there it also take a IP translate the IP and get that
equivalent or the translated IP to access the private IP of the other network.

So, this will be this there is some again small type of there should have been private IP
network 1 private IP network 2, so, that it access. So, the H 1 accessing H 3. So, 10 dot 0
dot 1 dot 2 are mapped to this IP, this carries over this IP again remap to H 3 means to

1265
this particular IP address right. So, though both are 10 dot 0 dot 1 dot 2, but there are
different IP blocks.

Now, so, while communicating across the network. So, these are NATed or translated to
this particular IP which is a routable and cross there and this also IP of this interface and
goes into the thing. Now, multiple things like H 1, H 3, H 2 can simultaneously do
because of their having that mapping with the port number. So, it is it is mapped
appropriately at the by the NATer. So, when the request comes back it knows that where
to be delivered.

(Refer Slide Time: 27:23)

Now, basic operation of the net as we are discussing. So, this source IP, destination IP
goes on. So, it is the mapping goes on and it goes on into the system. So, this is private
IP, public IP NATing is being done out here, right. So, it comes with a 10 dot 0 dot 1 dot
2 this one and goes out with a 128 143 73 21. While it is coming up looking at this public
IP stuff it map it to that particular IP like here 10 dot 1 dot. So, it comes with 128 143 73
21. So, it was having a mapping of this and goes on doing this. So, it is a mapping.

1266
(Refer Slide Time: 28:07)

So, IP device had address translation table so or ATT like typically this is address
translated table source is computer A, source IP this one, source destination NATing IP is
this one at port number 1. So, it is NATed and this stable is maintained and so that it can
basically this differ where from the request came and who will get the thing.

(Refer Slide Time: 28:27)

So, capability of NATing maximum number of concurrent translator is a one thing, like it
can concurrently do typically mainly determined by the size of the memory to store
typically determine ATT takes over 160 entry of a 160 bits. So, memory size 8 bit we

1267
will support around so much concurrent connection which say pretty high for any
organisation.

(Refer Slide Time: 28:51)

Main uses pooling of IP address supporting migration from network service providers.
So, when IIT, Kharagpur today change the IP it does not have to change the internal IP
block. So, it is a private IP and still there and IP masquerading is another challenge, load
balancing of the server is definitely need of the hour.

(Refer Slide Time: 29:15)

1268
There are some of the concern performance as there is a one hop, there is a performance
issue. Fragmentation care must be taken to datagram for fragmented before reaching the
device. It is not design for different IP address different port number etcetera. So, that the
fragmentation is a challenge.

(Refer Slide Time: 29:33)

End-to-end connectivity is destroyed by the thing, right. So, you have a another hop into
the things. So, NAT destroys the universal end-to-end reachability of the hosts in the
internet a host in the public internet often cannot initiate communication to the host in
the private internet. The problem is worse. So, in the two hosts are in the private internet
need the communication with each other. So, there are two hops as we have seen right
here the NATer at the other end.

1269
(Refer Slide Time: 29:57)

So, IP address in application if it is there. So, that it the application carries the IP address
this NATer is destroyed application to carry IP address in the payload of the application
generally do not work well with this public private NATing thing.

(Refer Slide Time: 30:13)

And, there are several other benefits use of NAT automatically creates a firewall between
the internal. So, it is a security benefit. So, this IPs and never exposed NAT will allow
only the connection that are originated from within the internal to NAT you can device
that method on this that approach; an outside host cannot initiate a connection with the

1270
internal host right directly. So, inbound mapping required say static NATing. So, if you
want to this IP to think we require static NATing.

(Refer Slide Time: 30:43)

So, finally, is NATing a proxy server? No, ideally no. NAT is a transparent to both the
source and destination host, but proxy is not always transparent to the things, right. You
know that where the proxy server, NAT is primarily a layer 3 device it is a network at
this protocol though we have a port number, but it is a primary NAT 3 NATing IP
addresses, right. So, in contrast proxy is primarily layer 4 or layer 4 plus device. So, it is
more at the other end of the things, right.

So, with this let us conclude our discussion today. Finally, we will like to see at on the
security network security part that what are the different aspects with respect to the
different layers of the TCP/IP or OSI layer and some aspects of firewall and so and so
forth.

Thank you.

1271
Computer Networks and Internet Protocol
Prof. Soumya Kanti Ghosh
Department of Computer Science and Engineering
Indian Institute of Technology, Kharagpur

Lecture - 60
Network Security – III [TCP/IP Security]

Hello. So, we will be discussing on Network Security or rather we will be continuing our
discussion on network security; for last couple of lectures we are discussing about
network security what are the different aspects of the security. So, today we will see
some of the things which are more related to TCP/IP layer alright. So, as we mentioned
that security per say is a phenomena which need to be ensured across the layer right like
it; like they are stacked in at different levels like starting from top from application layer
to the physical layer.

However, security comes as a vertical type of things right it is some sort of a end to end
phenomena should be there otherwise it is; making it fully effective will be very difficult
right. So, and as also we understand that when we the TCP/IP or OSI model came up and
when or the devices or which are communicating based on these protocols which are
defined for different layers, they are not initially made for security purpose right; they
are made to communicate.

And whenever we put any security aspects, that becomes more as a hindrance to that
things right. Once you any say for physical security also if you go on checking, the
traffic flow decreases, the number of processes increases and type of things. So, that is
need of more computational power, need to handle this congestion and type of things
will come into play right.

So, so there may be some devices which are security enabled; that means, they
understand that what is a security, some devices which are still not security enabled right.
So that means, if you if you if we change the basic protocol stack or the format; then
some of the intermediate devices may fail to understand that what is what is their
interventions; in others sense it may drop the packet like say IP packet. IP packet has a
specific format or specification based on the guideline or the protocol standardized
standard protocol. Now for the security purpose embedding the security if I change this

1272
IP packet; some of the routers may not able to understand that what is there in the IP
packet.

In other sense it may drop; it will drop the packet it will not recognise the IP packet. So,
whatever we do with this stack protocol stack whether OSI or TCP/IP; we need to keep
in mind that a device which is not able to decipher these security information should able
to forward this packet right; as it was doing earlier right. So, the whole process came up
like that.

Another thing we will see slowly another thing is important see; if we look at the whole
protocol stack; so, there are different layers right known application layer if I look at the
TCP/IP protocol stack what say, so there is a application layer, then transport, then IP,
then data link and physical layer right. So, these are have a peer to peer connectivity
right transport layer of system 1 when we are communicating to a system 6 in something
that is a peer to peer connectivity.

So, the security at that level should have a also a peer to peer way of handling that or
connectivity or handling those security things that has to be there right. So, with this
notion let us look at that what are the different aspects of security of means today’s
networking and the need of security need not to be explained again. And we do under
means from a personal day to day experiences or working experiences in office and other
eplatforms we understand there is a security is a must phenomena which need to be
there.

So, today mostly we will be concentrating on TCP/IP security has to have it has a back to
back things for the OSI. So, if we look at our common OSI TCP/IP protocol stack; so
there are here 7 layers or here 5 layers now.

1273
(Refer Slide Time: 05:03)

Now see what we try to say that one is that there should be a end to end phenomena if
you want to put security in the things. Another thing you see physical layer is basically a
connectivity right; in some of the cases physical layer is not in some (Refer Time: 05:23)
is not considering the protocol stack; it is more of a communication phenomena right.

So, any way that it is a point to point means hop to hop connectivity here also data link
layer hop to hop connectivity. So, per se the security of this traffic is something under the
jurisdiction of some authority right like if the; if the physical layer layout in the IIT,
Kharagpur; so, that is a within the administrative control of the IIT Kharagpur authority
and there is a more physical security is most required that it is not tempered and type of
thing. Similarly data link layer is also hop to hop connectivity; so, as such the security of
this is also not what we say a wide concerned as such because it is a only hop to hop
things type of things it can be ensured by the 2 communicating party right.

The challenge has come from the network here right because you have a path which is
not exactly in your control; it is outside the your network and it you do not know that the
path which are the routers and other devices intermediate devices it is following. So,
from that context what we see that from network layer transport layer application layer;
here the security phenomena are more predominant. So, our discussion will be more
concentrating on this that what are the different phenomena or what are the things we put
it in different literature and so and so forth right.

1274
(Refer Slide Time: 06:51)

So, if you look at the generic protocol stack. So, there should be these are the different
standard layer that IP, TCP, SMTP is the application layer and type of things and below
that there is a MAC is there and the trailer security protocol and things. So, this is this
MAC is not yours; this MAC is not basically the MAC what we have seen in the layer 2.
So, this is more message authentication code or the code which is required to
authenticate this message and type of thing right.

So, in other sense what we say this becomes encapsulated in a bigger packet; which has a
header for the security protocol trailer for the security protocol, but the overall packet
when moves along a layer it should be able to decipher by a router or a device which is
not security enabled right; which is not able to understand this what is this high header
security protocol or trailer security protocol, but still it is able to able to forward this
packet otherwise it will drop the packet right.

So, any layer any layer say it whether it is IP or transport or application has to follow this
philosophy. So; that means, the actual packet is somewhere encapsulated along with the
wrapped along the security things.

1275
(Refer Slide Time: 08:25)

So, IP level the IP security or IPSec is the predominant protocol is a collection of


protocol designed by the IETF to provide security packets to the network level; so, this is
IPSec designed to provide security level. In other sense it is instead of IP it is IPSec and
the other layers basically able to intercept interpret that things in the similar fashion.

(Refer Slide Time: 08:53)

So, there are 2 mode of 2 modes for IPSec one what is called transport mode, another is
the tunnel mode; so, these 2 mode of communication. So, in case of transport mode the
transport this is this transport mode is related to the IP layer not the transport layer per se.

1276
So, these becomes a payload to the thing right and it is if the actual IP header comes in
the form (Refer Time: 09:22) and the IPSec header and trailer are added.

So, primarily it protects the payload or in the transport layer payload of the things right.
So, it is transported across the network so, but the IP header is not protected; in a in case
of a IPSec tunnel mode here the IPSec header IP header is updated to a new IP header;
so, that is also protected. So, it is sort of a virtual tunnel is made between these 2 parties
and the things goes to the things right.

So, only thing we need to take care there are some of the fields which are mutable or
some of the fields that is source destination etcetera has to be taken care at the new IP
header. We are not going to the details of the protocol it is left to you to those who are
interested can look into the things, but we this is the basic philosophy.

(Refer Slide Time: 10:15)

So, in transport mode IPSec in the transport mode does not protect the IP header; it only
protects the information coming from the transport layer or the payload which is getting
from the things right here the it is structure is like this; so, it is there at the host B it is
deciphered or extracted in this per se.

1277
(Refer Slide Time: 10:35)

Whereas, in case of tunnel mode protects the original IP header because it comes with a
new IP header and moves like that; so, it is a form a tunnel thing between the 2 devices
or 2 parties.

(Refer Slide Time: 10:49)

So, there are different services access control, message authentication or message
integrity, entity authenticity confidentiality, replay attack protection these are supported
by this. So, this AH and ESP we are not going into details; so, the things that those are

1278
some of the things like authenticated; authentication header and encapsulated security
protocol header ESP header.

So, these are the things two type of headers what the IPSec will have; we are not going
into those formatting, but there are different services which can provide and ESP can
provide. But if we even keep this part aloof; so we can see these are the IPSec related
services which are provided by the IPSec right.

(Refer Slide Time: 11:35)

Next come transport layer security or SSL or TLS. So, we are used to the SL SSL; so this
was the generic version or the IETF supported version or standardized version is the TLS
its of the of the SSL basic protocol. So, it acts on the TCP; so, it basically provides
security at the TCP level. So, it is designed to provide security at the transport layer. So,
it goes on and at the peer transport layer should understand that how to extract the
secured information; so, this is the SSL or TLS type of traffic security.

1279
(Refer Slide Time: 12:19)

So, there also 4 protocols or sub protocols are there. Handshaking protocol so have some
negotiation between the parties; there is a change cipherspec protocol for finding out that
which is the what sort of cipher parameters or the things will be there. There is alert
protocol for any type of alert generation things and finally, the record protocol which
basically handles the thing and talk with the what we say integrate with the basic
transport layer.

So, again we are not going details into those things. So, these are the different type of 4
protocols; 4 sub protocols as you say that the at the SSL or TSL level which allows it to
handle the security right; so, 4 SSL protocols.

1280
(Refer Slide Time: 13:11)

So, this provides a security at the transport layer the other thing is the application layer or
PGP protocol. Like PGP is a example scenario that is say in application layer; these are
the applications which are talking to each other right. So, there is a server application,
there is a client application which talks to each other this can be mail application this can
be something say FTP type of file transfer application, this can be something which is
DHCP or type of DNS type of application; so, there can be different sort of applications
which can be there. Now, this the application is there has the different type of
requirement at there in. Now in order to handle those requirements; so, there are way it
handles the security aspects may differ from one to another right.

And the other the major one of the I should not say means I should; I it maybe
advantages or convenience for the application layer is the application layer talks to the
application layer it has a more resourceful layer where you can do security decipher at
the other end type of things right. So, at the; at the top it is a layer 7 or layer 5 in the
TCP/IP protocol OSI or TCP/IP protocol.

So, that way application layer may be more resourceful thing. So, in these case it is a
reference is from the pretty good privacy that is a PGP protocol for mail transfer. So,
PGP designed to create authenticate and confidential emails right; so, pretty good
privacy email transfer the PGP protocol is there. So, this is a example scenario or typical

1281
scenario where these security can be and the security of the of the application layer can
be demonstrated.

(Refer Slide Time: 15:21)

So, if you if you look at that PGP protocol per se; so, there are email message is
authenticated and encrypted. So, it is a something at the at the email message it is hashed
and a digest is created over that the encryption thing is there; that there is a session key
which is passed to the which is generated. So, it is Alice and Bob are communicated; so,
to communicating. So, Alice private key is embedded or encrypted with a onetime
session key and pass to the other end and the on the other end Bob decrypt it and work
with that protocol with the key.

So, what we see here that I can basically create a message and encrypt it or encapsulate it
with appropriate crypto phenomena and then communicate to the other end to decrypt it
the thing. Now this is possible at the application layer because the application layer has
lot of resource and the things and it can be guaranteed, it can be shown that these 2 what
level of security it provides that the message cannot be deciphered right. So, this is at the
application layer and if there are different other type of application layer protocols; they
may have some variant of the thing, but the basic philosophy remains the same.

1282
(Refer Slide Time: 17:03)

Now, with this thing we come to a phenomena like. So, we have the standard layers from
one end the standard layers at the intermediate sources. So, I I need to put the security at
the layer wise because the whole protocol understands via the peer to peer connectivity.

Now the intermediate devices say I have a router which is not IPSec enabled right; so,
either it has to drop the packet if it does not understand what is the header or it need to
handle the packet as the as it is going through the things. Now, the if the router it may
understand this is the packet, but it may not be able to decipher what is inside because
that is the payload it may be encapsulated. But if the header is tampered or header is
changed in such a way that the intermediate router does not understand; if it is not IPSec
enabled then it will drop the packet. So, those are things need to be taken care at every
layer that what it is done.

So, another thing what we have seen that on the network layer onwards the things are
more externally or what we say in a more in a distributed fashion or distributed control
things are there right. So, there is more security is more important whereas, in the data
link layer or the physical layer that is more internal controls are there right. So, these are
the 2 things with this we come to another phenomena called firewall which are we are
accustomed with we here at the layout say a network or a organisation network should
have firewalls.

1283
So, firewall as the name suggest it protects the internal network from the external attack
right; it can be both way also some of the things going out of this firewall also can be
handled. So, it is a something a logical wall between the 2 networks right.

(Refer Slide Time: 19:13)

So, if we look at in a broad sense; so there are outgoing traffic (Refer Time: 19:17) to the
global internet and this is my internal network and there is a traffic which is coming to
the internal network. So, these are the 2 broader way of looking at it.

(Refer Slide Time: 19:29)

1284
Now, firewall are effective to protect local systems or meant to protect local systems,
protects network based security threats, provide secured and controlled access to internet
provide restricted and controlled access to the internet to the local thing right. So, all all
type of things; try to protect the local system, protect network based security threats
which are network enabled security threats provide security and controlled access to the
internet right.

So, that is for outgoing traffic for incoming traffic provide restricted and controlled
access from the internet to the local servers or systems right. So, this is the overall the
how the firewall as supposed to do right. Now, obvious question may come that which
layer the firewall works right; whether it is works in the IP layer, transport layer or some
other layers etcetera.

(Refer Slide Time: 20:29)

So, accordingly if we look at that there can be different variety or flavours of firewall.
One is packet filter one is application level gateway or sometimes also a proxy firewall,
another is circuit level gateways or circuit level firewalls here we will see one by one.

1285
(Refer Slide Time: 20:49)

So, if in case of a packet filter we want what we want to do? We want to filter the IP
packet based on my policies. So, firewall say if we if I say that it filters traffic between
this outgoing and internet on what basis? So, there should be some policy. So, there
should be some policy some implementation of that policies in this firewall by based on
which it filters the traffic right; so, that that is the thing we need to have.

So, in case of a packet filter firewall; so, traffic is filtered based on the specific rules
right including source and destination IP address, packet type, port type etcetera. So,
these are things which are filtered based on the this rule. Now if we if you see it is not
only IP layer, it also have some thing do with the transport layer. So, nevertheless, but it
does not look at the application type of things; so, IP plus transport gives me the things.
So, unknown traffic is only allowed to a level particular level in the network stack
etcetera. So, it is allowed up to this and it is checked either it is blocked or passed to the
outgoing traffic.

1286
(Refer Slide Time: 21:59)

So, if you if we see that there are 2 interfaces of a particular packet filter firewall and this
is the maybe the rule. So, any source IP this one anything is allowed or this anything
coming from these are allowed or say blocked; so, which way the things are there it is
allow or block or anything coming for destination port 23 are blocked anything coming
for source port, so, let us see that this is the allow list.

So, anything coming from IP address source it is allowed, anything coming from the for
destination 23 is allowed anything any; request coming from this destination is allowed
or IP port any source IPs port 80 is allowed; that means, if it is allowed that the HTTP
traffic.

So, it allows the HTTP traffic to go out nothing else; it allows any type of traffic to goes
in and type of things. So, that the thing is that is the this is the allow metric though it
allow the things. The other way in this form I can basically restrict the how things are
going. So, it is something which is called which is also synonymous to this access
control lists like so, how this access to this internal systems will be done this access
control list.

1287
(Refer Slide Time: 23:25)

Now, packet filter router packet filter router or packer filter firewall a applies set of rules
for incoming IP traffic and then forward the and discard traffics filter traffics on both
direction. The packet filter typically setup for a list of list of rules based on the matches
with the IP or the TCP header; that means, IP address port number etcetera; so, it can
discard or allow or forward.

(Refer Slide Time: 23:53)

So, advantages simplicity transparency to user, higher transparent to user, higher speed
disadvantage difficult for setting up packet filter rules right; so, what should be the

1288
packet filters rules a large organisation may have, huge amount of IP or subnet blocks
and then setting these rules are cumbersome and lack of authentication whether the
source is authenticated source authenticated etcetera are not there.

(Refer Slide Time: 24:19)

The next come the application level gateway or at the higher level. So, it is also
something proxing or the proxy firewall as relay of application level traffic right. It is
service specific like telnet FTP SMTP HTTP has different type of requirement and things
so that so it is service specific. So, similarly traffic is filtered based on specified
application rules such as specified applications; such as a browser or a protocol FTP and
combination of those things and type of things; so, that is at the higher level.

1289
(Refer Slide Time: 25:03)

So, if we see that a typical HTTP firewall; so, if it request comes it goes to that all HTTP
packets to this thing; if there is a error it goes to the return back to the firewall or it is not
allowed otherwise it is accepted packet to the HTTP server to serve the things. So, that is
every traffic coming for this HTTP is pushed into the HTTP firewall right; like we look
at the mail security every traffic come to that that mail security firewall which takes a
call that whether it is a correct traffic or not right; so, that is the way it works.

(Refer Slide Time: 25:41)

1290
So, application level firewall also proxy server or proxy firewall relay of application
traffic, acts as a relay. (Refer Time: 25:50) Advantages, higher security than packet filters
only need to scrutinize a few allowable applications easy to log and audit all incoming
traffic right. So, disadvantages additional processing overhead on connection gateway as
its spike point etcetera. So, that is the more application more processing things are
required.

(Refer Slide Time: 26:13)

There is another type of things circuit level gateway. So, may not be very popular;
popular in the sense we may not be seen this very everywhere, but that there is a thing
this can be a standalone system or specialized system. So, it does not permit an end to
end TCP connections right; so, usually TCP connections are end to end phenomena. So,
this circuit level gateway it does not permit TCP connection rather gateway sets up 2
TCP connections; once the TCP connection are established, the gateway relays TCP
segment from one connection to the other without examining the contents. So, that is it
breaks the things and create a connection like this so, that it moves like that.

1291
(Refer Slide Time: 27:01)

So, it is again it acts at a transport layer; traffic is filtered based on the specific session
rules such as when a session is initiated or by a recognised computer and type of things;
so, based on that TCP session. So, as it is a phenomena of the transport layer it is mostly
controlled by the transport layer.

(Refer Slide Time: 27:23)

So, stand alone system set up 2 TCP connection; security function consists of
determining which connections will be allowed. Typically use situation in which system
administrator trusts the internal user; so this socks package is one of such example.

1292
(Refer Slide Time: 27:39)

Now regarding firewall configuration in addition to use simple configuration of a single


system, more complex configurations are possible 3 common there are very popular
uses.

(Refer Slide Time: 27:55)

So, one is the screened firewall like here the traffic comes and then it goes to this packet
filtering router and goes to the things right. So, the traffic is connection like this sorry;
so, there is a bastion host which is more controlled system the controlled host; where the
services which are only needed are enabled the it goes to that traffic for filtering there is

1293
a information server which says that what sort of security filtering or security feature
needs to be energized.

(Refer Slide Time: 28:39)

So, as we have seen that it consists of 2 system one is the packet filtering router and the
bastion host and the bastion host perform authentication and the proxy function. The
greater security than single configuration because of 2 reason implements both packet
filter and application filter filtering intruder must generally penetrate to systems to and to
compromise the firewall.

So, other one is a screened host firewall dual homed; so, the configuration physically
prevents security breach right here the breach is there. So, it goes there and it goes to be
there; so it is a physically it is not logically forwarding the packet it is physically protects
the things.

1294
(Refer Slide Time: 29:25)

And the packet filtering router is not completely compromised and traffic between the
internet and other host on the private network has to flow through the bastion host cannot
avoid that things; so, that is the way it looks that.

(Refer Slide Time: 29:43)

And another is the screened subnet firewall where there we have another internal router
so; that means, dual home things are there. So, it is a private and a this is the external and
this is the internal router so; that means, 2 layer protection is there. So, a screened

1295
subnet; so I can have now 3 domain right one is the external one is the intermediate and
in the another is the on the private network or the internal network on the things right.

This helps us in keeping several severs like say DMZ zone etcetera can be created out
here right which need not only goes through these outer firewall; also while connecting
to the internal thing has to be connect has to be goes to a internal firewall. So, this is a
this is a much better configuration, but as we see that it requires more hardware
specification and more configuration issues and increases the host cost and management
of the whole system.

(Refer Slide Time: 30:51)

And finally, if we try to look at a typical scenario that what today’s systems tries to do.
One side is that internet connectivity with a ideas that is your intrusion detection
systems. Another side is the internal network where things are; there are 2 firewall outer
firewall and inner firewall in between there are several things. One the things one the
things which are should be in the DMZ row like DNS server, mail server, web server or
any other server with that DMZ zone.

It also has a intrusion detection things which are which could have compromise these or
pass this, but there is a intrusion detection based on the whatever it receive in the switch.
There is a honeypot as we discussed sometime back; so that it is a where you are
expecting the attacks and learn the signatures of the things. So, this is in the DMZ zone
and then we have this inner firewall for the external connectivity.

1296
So, with this let us conclude our discussion on this network security. As I mentioned the
network security per se is not part a core part of the course. So, may not be important for
your exam point of view, but it is a important for our networking concepts or look means
or for practical implementation on it. So, that is why we thought that we should have
couple of lectures on the network security to give you some the pointers. Because this is
much deep into the things every subject some pointers those who are interested can go
into the things. So, as this is the last lecture of our series of courses.

So, first of all let me thank you that you have taken up this course. So, what we tried that
too look at different aspects of the computer networks and internet protocols at layer
wise. We followed a top down approach starting from the application and going coming
down the things and I tried to see that important factor at a different level. Nevertheless
to say that is there are lot of things which are still need to be explored what we believe
that this will give you a means as I was mentioning some pointers to look into different
aspects of the things.

And all with these days several simulators etcetera available and also some many of you
having some practical implementation at your workplace or college and type of things.
So, it will be nice to explore some of the things, but be careful that you should not do
something which bring harm to the network because after all we make this network to
have resources shared and able to work together or have that more accessibility to the
resource.

So, with this let us conclude this today’s talk and also let me thank you again for the
taking up this course.

Thank you.

1297
THIS BOOK IS NOT FOR SALE
NOR COMMERCIAL USE

PH : (044) 2257 5905/08 nptel.ac.in swayam.gov.in

You might also like