Computer Networking Fundamentals Course
By freeCodeCamp.org
Summary
Topics Covered
- 2D Parity Corrects Single-Bit Errors
- Binary Memorization Speeds IP Calculations
- Classful IP Wastes Addresses Like Oversized Cakes
- CIDR Fixes Wastage with Custom Blocks
- Subnetting Isolates for Security, Raises Costs
Full Transcript
This course covers the fundamental concepts, protocols, and architectures of computer networking. You'll journey
through the entire networking stack, exploring how data travels from physical media access control up to complex application layer protocols like HTTP
and DNS. You'll learn about technical
and DNS. You'll learn about technical mechanisms including error detection through CRC flow control strategies and advanced IPv4 addressing techniques like
cider and VLSM. By mastering topics such as TCP congestion control and routing algorithms, you'll gain the deep theoretical foundation and practical
problem solving skills necessary to navigate modern internet communications.
>> Okay. So, this will be an orientation class. I'll be discussing the curriculum
class. I'll be discussing the curriculum and the methodology we which we are going to follow and what I expect from you what are the prerequisite you require to attend the course. So I'll be
discussing all these things in this orientation class and I'll also give you the basic idea what is computer network and how the course is going to proceed. what
things which you are going to study in this course. I'll give you that basic
this course. I'll give you that basic idea. For the first 10 minutes, I'll be
idea. For the first 10 minutes, I'll be just overviewing the syllabus. Okay. So,
let's move forward. This is me. You all
know me from the operating system course which we uh which you all people attended last semester. So, I'll be your sailor for the journey through the
network fundamentals. I'm Shatter Sharma
network fundamentals. I'm Shatter Sharma and we will going to discuss all the major concept included in the computer network course from physical media access to the application layer protocol
and I also added a bonus module of security.
So we'll explore how data travels across network. We'll examine the protocols
network. We'll examine the protocols involved, how error is handled, routing mechanisms and the security consideration that make more internet
communication possible. And one more
communication possible. And one more thing before I move forward that I'll be sharing these lectures online too recorded lectures the polished and
edited ones obviously and I'll be removing the message which you all share.
So the people online on YouTube or Udemy or Udemy won't be able to see that. So
won't be able to see that. So you can you can ask your doubts without any ask your doubts without any hesitation.
hesitation.
Now Now for whom this course is meant for first for whom this course is meant for first of all this is absolutely enough for of all this is absolutely enough for GATE. If you are a GATE aspirant then
GATE. If you are a GATE aspirant then GATE. If you are a GATE aspirant then
GATE. If you are a GATE aspirant then you can blindly follow this course. I
you can blindly follow this course. I
have completed each and everything which have completed each and everything which is included in the GATE service in this is included in the GATE service in this course. So the people online on YouTube
course. So the people online on YouTube course. If you are a university
course. If you are a university university university student who have computer science major you can attend this course or if you are preparing for any job interview courses like computer
networks DBMS operating system these are very very critical. Now for people who don't know how I teach or what is my methodology then let's discuss that
first I'll be discussing you theory but I don't like slides and all so I'll be teaching you raw pen and paper style and
I'll also give you the reading material notes slides DBP reading material you will uh you'll be provided so firstly we will discuss the theory and then we will
practice I will solve some problems in front of And then you have to solve the problem which is given in DPP. Now you will not attend the class without solving the
DPP. You have to solve the DPP first.
DPP. You have to solve the DPP first.
Ask the doubt in the class itself and then we will move forward. And before
moving to the next topic, we are going to revise it with the help of a short notes.
So this is the method which we are going to follow theory practice DVP and revision. Okay. Now
revision. Okay. Now
in this class I'll be teaching you the basics of computer networks and so that you will get an idea what you are going to study in that course and in the next lecture we will begin
with the core computer network which is IP4 addressing architecture. We will be learning the foundational concept the IP addressing fundamental structure what is classful addressing classless addressing
what is uniccast multiccast broadcast communication how subnet marks mask work how networks are segmented we'll learn about classless interd domain routing a
variable length subnet masking supernetting and efficient IP address allocation strategies this will be a big module okay the next module which is a bit shorter than the
first is error detection and correction.
We'll begin with a simple concept like a simp simple parity. Then we'll move toward more advanced concept like 2D parity check some CRC and Hamming code.
Okay. The third module will include flow control mechanisms. Okay. So that a synchronicity is uh
Okay. So that a synchronicity is uh maintained between sender and receiver that sender do not increase the speed that receiver cannot handle. or these
kind of things which we are going to study in the flow control mechanism.
We'll study the three three important protocols stop and wait, go back end and selective repeat or selective reject.
Then the biggest module of computer network transport layer protocols we are going to study TCP and UDP. Then the
next module of media control protocol media access we'll be discussing three type of media access control protocols.
MAC protocols, random access, controlled access and generalization.
In random access we are going to study Aloha, CSMS CD, CSMS CA, controlled access reservation pooling token passing and in generalization, FDMA, TDMA and CDMMA.
I'll be telling you the important concept which you have to focus more then the routing and switching fundamentals.
Okay. Now regarding that prerequisite I was talking about the prerequisite is data structures and algorithm course is there anyone in the class who have
not attended the DSA course from the previous semester okay so most of the people have attended the course so I'll be discussing some of
the algorithms like belman Ford Dra algorithm and all these things you should know what is a Q what is stack and all these things. Then we'll move toward the switching techniques, circuit switching, packet switching, what are
virtual circuits and datagramgrams. We'll be discussing these things in this module. The next module is of
module. The next module is of application and support protocols.
We'll be discussing protocols like DNS, SMTP, FTP, HTTP, ARP and DHCP and then ICMP.
Okay. So this was the complete module which we are going to discuss in the computer network course. So this was what is in your curriculum. Now the
bonus module will also include the cyber security part. How security is
security part. How security is maintained among them among the networks.
We will be discussing all these things also. So first we will learn about the
also. So first we will learn about the IP4 addressing. The next module contains
IP4 addressing. The next module contains error detection and correction. The
third is flow control mechanism. Fourth
one is transport layer protocol. Fifth
one is media access protocol and the sixth one is routing and switching fundamentals circuit switching packet switching. These are important
switching. These are important application and support protocols and then in the end we will discuss the security part as a bonus module.
Now the resources or the references I have taken for making this course is the primary textbook will be foren. This is
the bible.
You should have a copy of frozen with you if you want a more better understanding. For the people who have
understanding. For the people who have time and are planning to build a career in this, they can also read tenbomb in that in-depth theoretical foundation
is there. And for people who are like
is there. And for people who are like absolutely crazy and want to read all these three books, you can also read the alternative perspective book top down approach. Okay. So
approach. Okay. So
this was all the curriculum which we are going to follow and know if you have any doubt regarding the curriculum or you want to ask anything you can ask now.
Okay. So no doubt we are going to move toward the actual learning. Here is our pen and paper setup. So we will learn computer network basics in this lecture.
This will be a lecture zero and from the next lecture we are beginning the IPv4 addressing.
What is computer network?
Yes.
Yes. Okay. So, let me give you a bit of formal definition. We call it as a
formal definition. We call it as a telecommunication framework.
Telecommunication framework.
Framework for what? Framework which
allow digital devices which allow digital devices to interact. We call it as nodes also. Digital devices or nodes to interact.
And the interaction can be either wired or it could be wireless also.
Now interaction for what? Why do they interact? To share resources to share
interact? To share resources to share resources which could be either hardware or software. So this is a formal definition
software. So this is a formal definition of computer network that it is a telecommunication framework which allow digital devices or nodes to interact
which could be in a wired medium or can be in a wireless medium to share resources which could be hardware or software. Internet can be example of
software. Internet can be example of internet is a prominent example of computer network. Okay. Now
computer network. Okay. Now
in computer network we let these nodes interact and share data. So data
communication is a very important part.
Data communication.
Now if I ask you the component of data communication what would you say? Let me give you a hint. First component can be the sender.
hint. First component can be the sender.
What could be the second component?
Tell me. Receiver obviously.
The third can be content or we can also call it as message. Fourth
message. Fourth the medium, the transmission medium.
Tell me the fifth one. Think we have a sender, we have a receiver, there is a transmission medium, we have a message.
Think what else is required that they can communicate with each other effectively.
Correct. Michael said it. Rules. We call
it as protocols.
Protocols for what? For synchronization.
What is synchronization? I told you the definition in OS course.
Yes. To do something which is already agreed upon.
So these are the five components of data communication. We need a sender, we need
communication. We need a sender, we need a receiver, there should be message that need to be communicated, medium and protocols for synchronization that
governs the data communication. Now
third thing effectiveness.
When do we say that one network is more effective than the other?
This is reliability. No reliability is not considered to be uh a metric for effectiveness. Why? For example, in
effectiveness. Why? For example, in transport layer in in transport layer, we are going to read about two protocols TCP and UDP.
There you will learn that UDP is not reliable but still it is uh significantly used. So reliability is
significantly used. So reliability is not a metric for effectiveness. Think
something other.
Yes. Delivery. Rebecca said it right.
Delivery.
What do you mean by delivery? That the
data must be delivered to the correct destination.
Correct destination.
Okay. Second thing,
integrity or you can also call it as accuracy.
That data should not be modified in between because integrity is a word used for
intentional modification done by some uh some person with mal intentions.
Intentional modification while accuracy is a term used to prevent errors. So
data must be delivered accurately.
Delivered accurately without errors.
Modification is not considered an error.
That's why we don't use the term integrity which you have mentioned there.
Third, what else can be the property?
Time constraint or we can call it as timeliness.
Data reached after the deadline may be useless. So data must be delivered in
useless. So data must be delivered in timely manner. Delivered in timely
timely manner. Delivered in timely manner.
Timely manner.
Fourth point.
Let me tell you the fourth point. It is
jitter. What is jitter?
You may have noticed that sometime there's a mismatch between audio and the video. when you are watching a movie
video. when you are watching a movie there could be a mismatch between audio and video. So the uneven delay uneven
and video. So the uneven delay uneven delay is what jitter is. So uneven delay should not be there. Okay. So these are the four matrix for effectiveness. Now
let's learn about transmission modes mode. Simplex,
mode. Simplex, duplex and you can write it as half duplex and full duplex.
What is simplex mode?
Try to guess with the name. What is
simplex mode?
What is half duplex and what is full duplex? Okay, someone has written
duplex? Okay, someone has written simplex is unidirectional.
That's right. Then what is half duplex?
They are writing birectional. Then what
is full duplex?
Again birectional. Then what is the difference between half duplex and full duplex?
H they have written it correctly.
Birection half duplex is birectional. But it is like a single lane that either you can talk like this is sender one, this is
receiver or you can call it as person one or person two. They are talking over a walkie-talkie.
So while you talk over a walkie-talkie, you cannot both talk simultaneously.
That's why you use the word like over and out so that the other person may know that the first person is not going to speak in between. Are you getting the point? Unidirectional transmission means
point? Unidirectional transmission means you are watching a TV. You're listening
to a radio.
Half duplex means you are talking over a walkie-talkie.
Each station both can transmit but not at the same time. So when one device is sending the other can only receive and vice versa. While what is full duplex?
vice versa. While what is full duplex?
The telephone that we use the telephone uh during talking over a telephone both the person can speak simultaneously. So this is what full
simultaneously. So this is what full duplex is. I hope you are getting the
duplex is. I hope you are getting the point. In simplex there's only one lane
point. In simplex there's only one lane and only one directional movement is allowed. In half duplex there's only one
allowed. In half duplex there's only one lane and one direction movement is allowed at a time.
While in full duplex it is like a two-lane system.
Okay. So this was all about transmission mode. Now network criteria,
mode. Now network criteria, network criteria.
Here we discuss about the reliability factor.
Reliability.
What is reliability? Can you can someone give me a formal definition? We all know the meaning of being reliable and all but what is reliability according to a definition
lesser failures we we call it as lesser frequency of failures failures and one more point should be added.
Yeah, failure thing has been already mentioned. What should be another thing
mentioned. What should be another thing which reliability have in its definition?
H resolution of failures. You have
written correctly. Lesser time in resol resolving the failure. Time taken to resolve these failures should be less should be less.
The second point is performance.
Performance can be measured using there are different metrics you can use transit time, you can use uh response time,
number of users, transmission medium, there are multiple metrics. The security
metrics. The security okay what about security?
Protecting the data from unauthorized access. You must have name, you must
access. You must have name, you must have heard the name of CIA triad. What
is CIA in security? In context of security,
in security? In context of security, what is CIA? Can someone give me the full form?
Yes, correctly. Confidentiality,
integrity and this is authorization or authentication. What is it? And what is
authentication. What is it? And what is the difference between both? Is it
authorization or authentication? Author
authorization or authentication?
Because some people are mentioning authentication, some are mentioning authorization. What is it and what is
authorization. What is it and what is the difference? This is your homework.
the difference? This is your homework.
So what is security? Includes protected
protecting data from unauthorized access from damage and modification.
Okay. Now there are different types of connections connections. It could be uh
connections. It could be uh pointto-point.
It could be point to multipoint.
What is multipoint connection?
What is multipoint connection?
That one computer is sending data to different other computers. Is it
necessary that all all of them should be in the same network? No, it's not necessary. One computer from one network
necessary. One computer from one network can send to multiple computers in a different network. This is also included in
network. This is also included in multipoint. We are going to read more
multipoint. We are going to read more about it when the time will come. Okay.
And what should more be taught in the basics thing? Well, you can learn about
basics thing? Well, you can learn about uh topology. You can learn about
uh topology. You can learn about topology.
What is topology? Have you heard of this name before?
Yes. Perfect word layout.
Layout or you can also write it as uh geometric representation.
Geometric representation.
What are the different type of topologies? There could be pointto-point
topologies? There could be pointto-point topology. There could be a bus topology
topology. There could be a bus topology in such manner. There could be a ring topology.
This is ring topology. There could be star topology.
There could be a tree topology you know in a hierarchal fashion. Tree topology
like in this manner.
This is tree topology. What is mesh?
Mesh topology.
This one is mesh topology. And there
could be hybrid a mix of all of them.
So this is what uh topology is the physical layout or geometric representation. We can discuss more
representation. We can discuss more about it. Do you want me to discuss more
about it. Do you want me to discuss more about it or we can just move forward?
Yeah. So there's a one question that has been uh asked that in an exam of a mass topology uh the number of link was asked. Okay. So let let's discuss let's
asked. Okay. So let let's discuss let's discuss them one by one. So let's start with the mesh topology.
What is mesh topology?
Have you heard of the term connected graphs? Connected graph
graphs? Connected graph each vertex is connected to another vertex directly. Directly. So connected
vertex directly. Directly. So connected
graph is like from one vertex you can reach to another vertex. So this is what connected graph is. But this graph is also connected. We don't want connected
also connected. We don't want connected graph. We want completely connected
graph. We want completely connected graph or complete graph. What is
complete graph? That each vertex is connected to another vertex. For
example, if you take like this, then this vertex should be directly connected to other vertex present. So
this link, this link, this link, this link. So if there are five vertex
link. So if there are five vertex there are five vertex in this uh pentagon. So if there are five vertex
pentagon. So if there are five vertex each vertex can be connected to maximum of four vertice vertices. So if there
are n vertex each vertex can be connected to n minus one.
Okay. So
if each vertex can be connected to n minus one vertices, then how many total links will be there?
How many total links will be there? n c2
or you can write it as n into n - 1 by 2. So here in this case where we have n=
2. So here in this case where we have n= to 4, how many total links will be there?
4 into 3id 2 that's 12x2 equals to 6. So
six links will be there. In some very bas basic exams or easy exams these questions could be asked for fun marks.
So in my topology total NC2 links will be there where n is the number of vertices.
Okay. Now let's discuss what is the advantage? Why do we use different type
advantage? Why do we use different type of topology? Why can't just we remain to
of topology? Why can't just we remain to any arbitrary topology? Why we are using these specific ones? So because there are several advantages associated to each of them. For example, mesh
topology. What is the advantage of my
topology. What is the advantage of my topology? Why are we using? Can anyone
topology? Why are we using? Can anyone
guess the advantages?
Yes, correctly. So, we have one advantage mentioned traffic issues is less traffic issues not there. So, that's one advantage. What more advantage you can
advantage. What more advantage you can think of?
Yes, Rebecca mentioned fault tolerance or robustness.
Robustness anymore.
Okay. You can also for example for extra point you can write fault identification is also easy.
Is also easy.
Okay. So what is the disadvantage you are looking? What is the disadvantage
are looking? What is the disadvantage you can think of for me topology?
Disadvantage.
Yes. Expense.
Wiring bulk or expense. Same point. It's
been written. Wiring bulk.
Think of some other point.
Difficulty in installation. Yes, this
could be a point. Difficulty in
installation.
Okay. So this was for mesh topology. Now
this was mesh topology. Let me write mesh tree.
This is star ring bus pointtooint.
Let's move to next. Next star topology.
In star topology we use a device named hub. So no device is connected directly
hub. So no device is connected directly to each other. For example, this device D1 want to send data to device D3. Then
it won't send it directly.
It will use hub. So D1 will send to hub and then hub will forward it to D3.
Okay. So advantage could be it is easy to install, reconfigure. Fault
identification is easy.
You know it's it's it's robust also in a way if you look at that failure of one link will not going to affect the whole setup and it is less expensive than me
topology. But the biggest disadvantage
topology. But the biggest disadvantage which you can directly look at is if hub is gone then the whole system collapses.
Okay. Now next topology could be you you know bus topology.
must include a central backbone. Central
backbone.
So again the direct disadvantage is if something happens to the backbone the whole system collapses.
So so this is a long cable. This is a long cable which act which act as a backbone. And the from the point where
backbone. And the from the point where these are connected is known as drop line
or the this link is drop line. This
point is step. This is drop line. Well,
this is not so so important. You I'm
just uh explaining these topologies because so that you can get an idea otherwise it's not very much important.
Other could be a ring topology. Here it
is ring topology. What is ring topology advantage? Simpler installation
advantage? Simpler installation reconfiguration. A single point of
reconfiguration. A single point of failure can going to affect the whole system. So this could be a disadvantage.
system. So this could be a disadvantage.
Okay. Okay. So in ring topology what happens? Each device each device is
happens? Each device each device is connected directly to the two adjacent devices forming a closed loop. And the
one specific thing which is uh only associated with ring is data travel in one direction only.
So data signal travel in one direction through each device until they reach their destination.
Each device functions as repeater also.
So if data reaches to this for example D1 send want to send data to D3. So what
D2 will do? D2 will look at the data.
This data is not meant for me. It is
going to amplify the data. It will act as a repeater going to amplify data regenerate the signal before passing it to the next. So
this was about ring topology. Okay.
There are several topology you can look at it. You can search you'll understand
at it. You can search you'll understand it just by Google search you will notice. Okay. Now let's move to the
notice. Okay. Now let's move to the biggest problem is that is for example I have a system in some different architecture. I want to communicate with
architecture. I want to communicate with a system of some different architecture.
Can I communicate directly?
No. This doesn't happen. You won't be able to communicate directly.
So now what is the solution? We need a model. The OSI model proposed by ISO.
model. The OSI model proposed by ISO.
OSI model open system interconnection proposed by ISO international standards organization that model is going to enable communication between different system irrespective of their underlying
architecture.
So it will be a conceptual framework conceptual framework a conceptual framework for creating a robust and interoperable network
architecture. So this is not not some
architecture. So this is not not some kind of protocol. This is not a protocol. This is a model. It's a like a
protocol. This is a model. It's a like a framework. Okay. And it is a
framework. Okay. And it is a it work on a layered architecture.
Layered architecture.
So we will have a different different layers and we are going to study each layer in detail.
Okay. So there are different layer. Each
layer is going to communicate with the corresponding same layer of different system. For example, let me
different system. For example, let me draw a diagram so that you can understand better. For example, this is
understand better. For example, this is device A.
This is device A. This is device B. Both
have different architecture.
Okay. So, we will need uh let's say router one here, router two and they are connected like this. Now, what happens?
Device A have this layered architecture.
It have different type of layers like application layer, presentation layer, presentation layer, session layer,
transport layer, then network layer. You have to remember all these names in sequence too. Network
layer. You can create some pneummonic to learn data link layer and then in the end physical layer
physical layer. Now what's going to
physical layer. Now what's going to happen?
This device B also have the same set of layers. Now what happens? The
layers. Now what happens? The
application layer of device A is going to communicate with the application layer of device B.
We call it as peer-to-peer connection or peer-to-peer protocol. peer-to-peer
peer-to-peer protocol. peer-to-peer protocol.
Same happens with the presentation layer. Same happens with the session
layer. Same happens with the session layer. Same happens with the transport
layer. Same happens with the transport layer. And same happens with the this
layer. And same happens with the this device and the intermediary node. For
example, in router, we reach or we require the services till network layer only. We don't require the services of
only. We don't require the services of transport layer. So, let's make it a
transport layer. So, let's make it a single router.
R1 okay or R and then here the physical layer.
So network layer is going to communicate with the network layer of router and same happens like there.
Okay.
So what happens is when teacher teaches you can in the beginning can understand the OSI model you can go like this you understand the physical layer first and
then network data link layer network layer and then this okay so what approach we are going to follow is we'll first understand the services
provided by these layers application presentation services a session layer.
Okay. So what approach we are going to follow is we are going to first understand the services provided by these layers and then when we have clarity of what is
flow control, what is error control, what is framing, what is segmentation.
then you will better understand the functionalities of uh or the how these layer work as a whole to provide the OSI model how these layers coordinate with
each other okay so we are going to first understand the functionalities of these layers and then we'll understand how they communicate with each other how
they in share data with with each other and they become the OSI model as a whole is video clear and voice audible Okay then. So the last lecture was
Okay then. So the last lecture was lecture zero.
Today is the lecture one. Let's revise
what we have learned yesterday and then we'll continue for IPv4 addressing. So
what was computer network? It was a telecommunication framework.
It was a telecommunication framework which allow digital devices to interact with each other. interaction could be wired or wireless to share resources which could be hardware or software.
Regarding the components of data communication, we have sender, receiver, message, medium and protocols.
Effectiveness, four metrics were there.
Delivery, accuracy, timeliness and jitter.
And for transmission modes, we had simplex, half duplex and full duplex.
Simplex means unidirectional like TV or radio. Half duplex means birectional but
radio. Half duplex means birectional but only data can travel only in one directional at a time like a walkie-talkie and a full duplex means like a telephone. And
for network criteria we learned about reliability, performance and security, type of connection, pointto-oint and multipoint. And then we learned about
multipoint. And then we learned about topology which was the layout. We
learned about different topologies and then in the end we discussed the OSI model introduction the conceptual framework. It was a layered
framework. It was a layered architecture. We learned about different
architecture. We learned about different names of the we learned about the names of the different layer. And today we are going to start with the functionality of
network layer which is IPv4 addressing.
But before starting let me ask you do you know about binary numbers?
Yes most of the people know about binary numbers which include zero or one.
Do you know about the representation 0000 means 0 and 001 means 1.
Okay, I hope you all know that because the IPv4 addressing will be totally based upon the representation of binary numbers. If you do not know them, you
numbers. If you do not know them, you can leave the class first understand how binary representation is done and then watch the recorded session.
Okay. So 0 0 0 is 0 0 0 is 1 is 1 0 0 1 0 is 2 0 1 1 is 3 okay this is how it is representation
let me also explain how it is done for this place 2^0 for this place 2^ 1 for this place 2^ 2 and for this place
2^ 3 so if I write 1 0 0 0 this mean 1 into 2^ 3 plus 0 into 2^2 2 + 0 into 2^
1 + 0 into 2^0 this will be 8. Okay. For example, if I write like this
0 1 1 then this means 0 into 2^ 3 + 1 into 2^2 + 2^ 1 + 2^0 this is 4 this is
2 and this is 1. 4 into 6 + 1 7.
Okay. So when I had three 1's from the right side then the value is 2^ 3 - 1.
Let's say if I had four ones from the right side then I have value of 4^ 2 power 4 - 1 which is 15. Is it 15? Let's
check. So instead of zero here it will become 1. Now 8 will be added to 7. This
become 1. Now 8 will be added to 7. This
will become 15. So yeah. So let's say if I ask you what will be the value if I have continuous 8 ones
what will be the value of this 2^ 8 - 1 what is 2^ 8 256 - 1 means 255 so the maximum value with 8 once I can
reach is 255 so the range will become 0 to 255 I hope this point is Okay. Now I want you to remember these
Okay. Now I want you to remember these numbers and their binary representation.
So if I write 0 0 0 0 0 what is this? 0. If I write 1 then it will become 1. If I write 1 1 then it
will become three. If I write 1 1 then it will
three. If I write 1 1 then it will become 7 then it will become 15. Okay. So this
point I hope it's clear. Now what about if I start the one from left hand side?
This is very easy. You can just calculate like this 2^ n minus 1 where n represents number of one ones from right hand side. Okay. Now what about
this? What about number of ones from the
this? What about number of ones from the left hand side? We have seen from the right hand side the formula is 2^ n minus 1. What about the left hand side?
minus 1. What about the left hand side?
So you can calculate directly like this. For example, I have
like this. For example, I have this number. How am I going to
this number. How am I going to calculate?
Let's say we are talking in the octets.
Octates with 8digit binary numbers.
Now what is the value of this? You can
calculate like this. 2^0 2^ 1 2 power 2 2^ 3 2^ 4 2^ 5 2^ 6 and 2^ 7 so I have
to add these numbers and ignore these numbers why because here it is zero so 2^ 7 + 2^ 6 + 2^ 5 + 2^ 4 this will be
the value of this you can calculate this way the another way is 1 1 1 1 0 0 0 and 0. The another way is
the maximum value that this number can achieve is 255.
Now I can calculate this by subtracting 25 by subtracting the value of this from 255. So what is the maximum value this
255. So what is the maximum value this can achieve? 1111. This could be 15. So
can achieve? 1111. This could be 15. So
the value of this will be 240. Now you
can calculate from here also the value will be 240. Let me repeat the method again. For example, I have 1 1 1 and
again. For example, I have 1 1 1 and then 0 0 0 and 0.
Now, what could be the decimal value of this? 255 minus how many ones? It could
this? 255 minus how many ones? It could
have 1 2 3 4 5. So, what is the maximum value? 2^
value? 2^ 2 power 5 - 1. This is the formula which we have witnessed just here.
So 255 minus 255 - 2^ 5 this is 32 31 so this will be this will be 224
okay you can calculate like this or you can also calculate like this 128 64 32 and you can add all of them you will get 224
okay first of all I want to make sure that you know the table of is of the power of
two. 2^0 is 1. 2^ 1 is 2. 2^ 2 is 4. 2^
two. 2^0 is 1. 2^ 1 is 2. 2^ 2 is 4. 2^
3 is 8. 2^ 5 is 32. Oh, sorry. 2^ 4 is 16. 2^ 5 is 32. 2^ 6 is
16. 2^ 5 is 32. 2^ 6 is 64. 2^ 7 is 128. And 2^ 8 is 256. That's
64. 2^ 7 is 128. And 2^ 8 is 256. That's
all you will need. Okay.
3 4 5 6 7 8. What is the weight of each position? What is the weight of each
position? What is the weight of each position? The weight of this is 128 64
position? The weight of this is 128 64 32 16 8 4 2 and then 1. This is nothing
but 2^0 2^ 1 and all like this. So if I have the value 1 1 and rest all are 0 0 0.
So I will pick up this 32. I'll pick up the eight. I'll pick up the two.
the eight. I'll pick up the two.
This is what the decimal value of this number is 42.
Okay. So I hope now you know the conversion. You know the table of the
conversion. You know the table of the power of two. And then you know what does it signify to have the straight ones from the left hand side and the
straight ones from the right hand side.
Now what you have to remember is this 1 2 3 4 5 6 7 8. You have to remember this 1 one 1
5 1 and then 6 1's and then 7 1's and then 8 ones. Rest all will be zero.
You can fill up all of this with zeros.
Now just a single one from the beginning the value is 128.
When there are two ones, the value will be 128 + 64. This will become 192. When
you'll have three ones, then the value will be 128 + 64 + 32. The value will become 224 and then
32. The value will become 224 and then 240 and then 248 and then 252 and then 254
and then 255. If you remember this table especially in GATE exam it will be very beneficial for you. You won't have to think. There will be lesser chance of
think. There will be lesser chance of silly mistake and you will be quick. If
you do not remember this there's no problem. You can simply calculate like
problem. You can simply calculate like this.
Okay. And the more number of question you will solve you will get uh you will get better with these uh values.
Now if I have just one bit with me for example let's say zero or one bit position then how many number of bits I can form how many different addresses I
can form 0 and one that's it for example if I have two bits how many addresses I can form you can form 0 0 you can form 0 1 you can form 1 0 and you can form 1
one that's right so with two bit I can form four addresses four addresses Okay, what about three bits? With three
bits, I can form eight addresses. How
did I know?
2^ 1 = to 2. 2^2 = to 4. 2^ 3, which means 8. What are those eight addresses?
means 8. What are those eight addresses?
0 0 0 1 0 0 1 0 0 1 1 0 1 1 0 and 1 1. So
these are the eight addresses I can form with three bits.
What about n bits? with n bits I can form 2 raised to power n addresses.
I hope this point is clear. Now what I'm doing is I'm fixing the first bit. I'm
fixing the first bit. What do you mean?
What do I mean by fixing the bit which means that bit cannot be changed. For
example, if I for this case if I fixed this bit as zero, then how many address it can form? It can form either 0 0 or 0 1. That's it. Just two addresses.
1. That's it. Just two addresses.
This was the case one. As you know I have fixed the bit. I have not specified I have to fix it with zero or one. So
case two can be formed where I fix the bit with one. So the another set of addresses with case one will be 1 0 and 1 one again two addresses. So what I've
done is when I fixed a single bit the whole set of addresses are divided into two sets two subsets two subsets of addresses.
Okay, let's try here also. If I fix a single bit, the whole set of address will be again divided into two. Hey, did
I missed something? Yeah, I missed 1 0 0 1 0 0. Okay, now what happens? I again
fixed this bit. I fix this bit. Okay, so
with fixing I mean I can either fix it to zero or fix it to one. Again two
cases are formed. With 0 I can form 0 0 0 1 0 1 0 and 0 1 1. With one I can form 1 0 0 1 0 1 1 0 and 1 1. So I fix one
bit I form two subsets. What about if I fix two bits what will happen? So if I fix two bits
I can form like this. Case one will be 0 0. Case 2 will be Case 2 will be 0 1.
0. Case 2 will be Case 2 will be 0 1.
Case 3 will be 1 0. case score will be 1 one because I have fixed two bits. So
the number of cases will also increase.
So with 0 0 I can form 0 0 0 or 0 0 1.
These two are fixed. So with 0 1 I can form 0 1 0 or 0 1 1. With 1 0 I can form 1 0 0 or 1 0 1. With 1 1 I can form 1 0 or 1
1.
Are you getting the idea?
If I am fixing just one bit, the whole set of address is getting divided into two subsets. Like here, if I fixed two
two subsets. Like here, if I fixed two bits, the whole set of addresses are getting divided into four sets. Four
subsets. What if I fixed three bits?
If I fixed three bits, the whole set will be divided into eight part. Which
means all of them are different. Now all of them will act as a case. I hope you are getting the idea where I'm reaching. So
if I fixed from n bits from n bits if I fixed the initial k bits then total
number of cases will be 2^ k and each address in the subset will be of the size 2^ n minus k.
Are you getting the point? For example,
look here.
What is n? n is three. What is k? K is
2.
So with n= to 3 and k= to 2, how many number of cases are we forming? 2^ 2
equals to four cases. And what is the size of each? This is one 2^ 1 equals to 2. The size of each each subset is to 1
2. The size of each each subset is to 1 2 1 2 1 2 and 1 2. So
in the in the n bits if I fix the initial k bits 2^ k cases will be there and each subset have 2^ n minus k number
of addresses.
Okay. Now why I'm teaching you this you will understand in few minutes. Till now
if anyone have any doubt you can ask.
Is the concept clear?
Okay. Now we are moving to IP addressing. What is IP addressing?
addressing. What is IP addressing?
So IP address is like a logical address.
Logical address of size 32 bits.
Of size 32 bits. Okay. Now 1 2 3 4 1 2 3 4.
This is an octate.
of eight bits. This is an octate. So
we'll have four such octates in an IP address.
Octate 1, octate 2, octate 3 and octate 4. And we differentiate with them with a
4. And we differentiate with them with a dot. We differentiate them with a dot.
dot. We differentiate them with a dot.
So if I have an address of 32 bits total number of IP address will be if I have address of three bits the total if I have address of three bits total eight
addresses could be found with the formula of 2^ 3. So if I have total 32 bits the total number the total number of IP address will be 2^ 32. This is a very big number. This
2^ 32. This is a very big number. This
is a very big number. It's like 4 billion.
Okay. So initially it was a time of I think 1980s IP address were divided into two fixed part. The network ID
part. The network ID the network ID and the host ID.
The network ID and the host ID.
Okay. Who who was deciding this? I NA
internet assigned number authority.
Okay. So
out of 32 bits let's say I divided 32 into two parts of 8 bit and 24 bit. So this 8 bit let's
say name it as network ID and 24 bit as host ID. So 8 bit will be acting as
host ID. So 8 bit will be acting as network ID and H ID will be acting as host ID. So how many networks could be
host ID. So how many networks could be formed? 2^ 8 which means 256 networks
formed? 2^ 8 which means 256 networks could be formed could be formed and I have 24 bit of host ID. So in a single
network how many host could be there? 2^
24 host can be there. Are you getting the point why I explained you that concept?
So you can you can use the same analogy you can consider network as a case and post as a subset.
So I have 256 cases and each case have 2^ 24 members in the subset.
Okay. I have 256 network and each network have 2^ 24 hosts.
I hope the point is clear.
If anyone have doubt till now you can ask.
Okay. So you can uh express it like this network one let's let's name it as network one it has 2^ 24 IP addresses
each address is given to one host let's say IP address one is given to host one IP address 2 is given to host two so 2^
24 host could be given distinct addresses so network one they have 2^ 24 IP address network two similar network
three similar.
So there will be like 256 networks.
There are 256 networks. Each network
have 2^ 24 IP address. How many total IP address will be there? This is 2^ 8. So
this is 2^ 32 from where we started.
Okay. So with a single IP with a with 32 bits with the 32 bits we can create 2^ 32 addresses and we are dividing that
address by fixing the bits by fixing the bits. For example, if I fix the bit like this 0.
Now they are eight 0 0 0 1. This means
this is network one. And if I'm writing like this, okay, let me explain it again.
We are talking in octates not in a single uh we are talking about the whole IP address not about a single octate. So
let's say if I fixed this and I write like this 0 0 0 0 1
this means this is network 1. And if I write like this 0 0 0 0 0 0 and here 0 0 0 0
1 this means network one host one.
I hope you got the point. How are we dividing it?
Okay. Or I can explain more from that.
0 0 0 02.
This means network one host two. I hope
you're getting the point. Same thing we are doing here.
Fixing the bits.
Network. This was network one. This
could be network two. So this means network to host one. Host two. So what
is this? Tell me what is this.
Which tell me the network number and host number for let's say this.
What is the network number and host number?
Yes, if I have assigned this network one, this could be network two, this could be network three and this could be network four and the host will be host two, host number two. So in this way we are assigning the networks and the host.
Okay.
So what happened? Let's say there are only 256 networks.
There are only 256 networks and each network has 2^ 24 hosts. Are you getting
the point? How much 2^ 24 is
the point? How much 2^ 24 is 2^ 20 is approximated to a million
and 2^ 4 is 16. So it's still 16 million host in a single network. in a single network. Network one have 16 million
network. Network one have 16 million hosts which means 16 million computers could be present in network one.
So if there are only 256 network and even a small organization must buy 16 million host to purchase one network.
So this is a problem to us and the number of networks are very less.
The number of the number of networks are very less. So we have to come up with a
very less. So we have to come up with a solution. We call the solution as
solution. We call the solution as classful addressing.
Classful addressing.
I give you an analogy of classful addressing and then we will start the technical part of classful addressing in the next lecture. So what is classful addressing? We will understand with the
addressing? We will understand with the help of telephone networks.
Telephone networks.
I'll take the case of India as I'm from India.
In India, telephone network is 11digit number and this 11digit number has two parts STD and T. And each telephone number is
unique. Each telephone number is unique.
unique. Each telephone number is unique.
So what happens?
We'll take the case of city, town and villages.
In the case of city, in the case of city, the big cities, the number of cities are less, number of cities are less and the people living in
each city is more, people are more.
And about villages, the number of villages are more and the number of people are less.
So if I fixed something like this, if I fixed something like this that I NA did in 1980 that out of the four octates, let's give the
first octate for NID and the rest for HID. This will be a classic failure
HID. This will be a classic failure because the number of cities and the number of people same relation is not present with the
number of villages and number of people in those villages. In city people are more but the big cities are less. So
what I want is I want lesser number of bits to represent the cities. For
example, say we give three bit to std.
It's like an id to identify the network and eight bits for the tid to identify the phone number. For town what we do we
give four bits to tid for std sorry and seven bits to tid. And for villages what we do five bits for std and six bits for T.
Now what happens with the with three bits with three bits what we can do is we can represent
000000 to 9999 thousand cities thousand big cities and each city could have the number of people
1 2 3 4 9999 99999 these number of people each city can What about town?
How many town can be present?
9999. These could be number of towns which have the number of people ranging to maximum this much. What about the village? The
this much. What about the village? The
number of villages can be more. So
99999. This could be number of villages.
And in each village the maximum population a village can have will be this or the maximum number of phone numbers and village can have will be this.
Same telephoneonic concept will be applied into the area of computer networks for addressing IP addressing.
So what are we going to do?
like we divided the 11digit 11digit telephonic numbers into std n based on classes like cities, cities,
towns and villages.
Same way we are going to do with the IP address here IP address 32-bit IP address. We are going to divide these 32
address. We are going to divide these 32 bits into NID and HID based on the classes. Class A will have less number
classes. Class A will have less number of networks and more number of host.
Class C will have more number of networks and less number of hosts. Class
will be like a town in between. So what
happens?
The sum is 32 bits and the total IP address is 32 bits. So out of 32 bits, 8 bits will be given to NID and 24 bits will be given to HID. So there will be
256 networks and each network will have 2^ 24 host.
And this class A type networks are used for big organizations like NASA and ISRU.
Class B it's like the middle one 16 bits for NID and 16 bits for HID two 16 networks and each network have to rest
for 16 hosts. It's used for MNC's like TCS and VIPRO.
Class C network more number of networks less number of host 2^ 24 bits of NID which means there will be 2^ 24 networks
and each network will have 2^ 8 hosts it's used for small organizations like schools and colleges but you know the problem which I
discussed before that let's say if someone buy someone wants to buy let's say thousand hosts someone wants to by a network for
thousand hosts. Which class should he
thousand hosts. Which class should he approach? Should he approach class A?
approach? Should he approach class A?
No. Should he approach class B? Approach
class B because in class C, class C, the number of networks are 2^ 8, which is 256. So he has to approach class B. Now
256. So he has to approach class B. Now
the total number of host in a single network of class B, you know how many they are? 2^ 16 which means
they are? 2^ 16 which means 2 to power which means 6 5 53 6
and after these I'm only going to use 1,000 so how many will be wasted or how many extra host I have to buy these many extra host I have to buy so
the problem still remains let me give let's say you want to buy a cake you want to buy a cake for your friend okay and the friend said that I want a 3 kg cake
and and the shopkeeper have pieces of cake of this 2 kg. Friend wants 3 kg of cake. So you won't going to you are not
cake. So you won't going to you are not going to pick up the 2 kg piece. 3 kg
means 3 kg. So you have to pick up this 10 kg part which means 10 - 3= to 7 kg will be wasted. Now what is the solution? The solution is you go to
solution? The solution is you go to another shop which have not made the pieces of the cake already. it it cuts
the cake based on the need based on the demand. So when you say you want a 3 kg
demand. So when you say you want a 3 kg cake a 3 kg piece will be picked up and given to you a very less or no wastage. No
wastage. Here the wastage was 7 kg and here there's no wastage.
So this is what classless addressing is.
This is classless addressing and that was classful addressing. So which is better classful addressing or classless addressing? Obviously classless
addressing? Obviously classless addressing is better because classful was a older concept.
Okay. Class A has 8 bit of an ID and 24 bit of HID. 16 bit of NID for class B, 16 bit for HID and 24 bit ID of class C
and 8 bit of HID. So this was the theoretical concept which we came up similar to the telephonic uh concept
where we divided the std and tid hid and nid and j. So this was the theory. Now how we actually implemented
theory. Now how we actually implemented this now we are going to understand bit IP address.
What we did? We fixed the first bit 0 0 0 till the end and then 1 1 1 1. Okay.
So when first bit is fixed this 2^ 32 address space will be divided into two address space of 2^ 31 and 2^
31. So this address space is 2^ 31. This
31. So this address space is 2^ 31. This
is 2^ 31. We call this as class A.
And this is expanded here.
Okay. So one was already fixed.
We fixed another bit also. 0 0 0 0 0.
And then here 1 1 1 1.
We call it as class B. And this part is again expanded. We fix another bit here.
again expanded. We fix another bit here.
1 1 0 1 1 0 1 1 0 1 1 0. And here 11 one 1 11 one 11 one 11 one 11 one 11 one 11 one 11 one 11 one 11 one 11 one one one in this manner we call it as we call it
as class C and then let's expand it down 1 1 1 1 0
class D and 1 1 1 1 as E we did like this. So class A has fixed
bit of Class A has fixed bit of zero.
Class B has fixed bit of 1 and 0. So class B has fixed bit of 1 0. Class C has fixed bit of here 1 1 0.
0. Class C has fixed bit of here 1 1 0.
So class B has Class C has fixed bit of 1 1 0. Class D
1 1 0 and class E as 1 1 1 1.
Is the point clear? Now how we did? We
initially began with a 32-bit IP address address space. We divided into two
address space. We divided into two parts. The first one is class A and the
parts. The first one is class A and the remaining part is again divided into two parts and then the first part becomes the class B and the remaining part is again divided into two parts. The first
part became the class C and the remaining part is again divided into two parts class D and class E.
Is the point clear? Why we stopped here?
Because we just wanted five classes.
So for five classes what we did this was let's say 2^ 32 bit address space. So we
divided into first two parts 2^ 31 and 2^ 31 we call it as class A.
And then 2^ 31 is divided into two parts. Class B.
parts. Class B.
So this has 2^ 30 and this part has 2^ 30. Now this is again divided into two
30. Now this is again divided into two parts. This becomes class C. So the
parts. This becomes class C. So the
class C has 2^ 29 and the remaining part is 2^ 29. Now this remaining part is again divided into class D and class E.
So remaining part have 2^ 28 and 2^ 28 IP addresses.
So this is how it's actually implemented. This is how we bifurcated
implemented. This is how we bifurcated the cake. We divided the IP address
the cake. We divided the IP address space into classes. So the number of IP address present in class A will be 2^ 31. In class B it will be 2^ 30. In
31. In class B it will be 2^ 30. In
class C it will be 2^ 29. In class D it will be 2^ 28. And in class E also 2^ 28.
Okay. And the fixed bit of class this is fixed bit and this is class name.
Okay. So you have to remember 0 1 0 1 1 0 1 1 0 and 1 1.
So class A class A actually comprises of 20 50% of the total address space. Class
B 25%.
Class C 12.5%.
Class D 6.25% and class E also 6.25%.
Okay. Now let's understand the representation.
of IP addresses.
So we have three representation. The
first one is binary.
The second one is decimal and the third one is hexadimal.
Hexad decimal. Binary you already know 32 bits of four octates. Octate means 8 bit each. So it could be like this. So
bit each. So it could be like this. So
the full binary representation of IP address is like this 1 1 0 0 1 0 0 1 1 1 1 1 0 0
or you can write anything like 0 0 1 1 1 1 How many are there? 1 2 3 4 and 1 2 3 let's remove one these are okay and the
last could be 1 1 1 1 0 1 1 1 okay now what will be the decimal representation I have already taught you how to convert
this is 2^0 this is 2^ 1 2 power 2 2^ 3 4 5 6 and 7 you ignore the zero zero part and you
take the weight of one part and add them so this will become I think 200 this will be this will be 252. I taught
you to uh remember these values 1 2 3 4 5 6. If six ones are from the left the
5 6. If six ones are from the left the value is 252. If 7 1's then 254 8 1's 255. If only single one 192 sorry 128
255. If only single one 192 sorry 128 double ones 192 triple ones. Okay, let
me just write just single one 128, double ones 192, triple ones 224, four
ones 240, five ones 1 2 3 4 5 24 6 ones 252, 7 ones 1 2 3 4 5 6 74
and 8 ones 1 2 3 4 5 6 7 8 255.
Okay. So this is 255 and then this is 1 2 3 4 5 6 ones from the right. What was
six ones from the right? 2^ 6 - 1 which is 63. And then in the end
is 63. And then in the end see the full will be 255 and eighth
position the value of uh this the weight of this bit is 8. So 255 minus 8 is 247.
So this will be 247.
You can do this smartly also. You do not have to always calculate by just adding the weight of all. You can also use the trick of subtraction. 255 minus and then
8.
What will be the hexa decimal?
C8. I have already calculated this C8 F C 3 F and F
and it is seven. How did I did it?
See what I have done is I have divided these into four four bits and I have just converted them into hexadimal format. So
what is this? This is 12. So do you know how to convert from 0 to 9? It is same like binary
and from 10 11 12 13 14 15 it's like a b c d e f. So this is 12.
This is 12. That's why I've written C here. And 1 0 0 is 8. That's why 8
here. And 1 0 0 is 8. That's why 8 15. So 15 is F. So C and then again 12.
15. So 15 is F. So C and then again 12.
Then C 3 F. This is what three and then 11 1 is F. So in this way I have written hexadimal. So I hope you got the
hexadimal. So I hope you got the understanding of the representation of IP addresses.
Okay.
Now let's understand the class A in detail.
Class A it has 2^ 31 IP addresses. We have
already discussed this addresses.
How we got 2^ 31?
Class A has 8 bits of NID and 24 bits of HID.
And from the 8 bit I have fixed the first bit as zero. You know we have just discussed this thing fixed bit is zero.
So I have fixed the first bit as zero.
Now how many NID it has? Seven NIDs.
Seven bits. So from seven bits how many networks it can generate?
7 means 2^ 7 which means 128. So it can generate 128 networks.
Okay. So let's uh write here 7 bits and then remaining 24 bits. Here
0 is already fixed. 1 2 3 4 5 6 7 then 0 1 2 3 4 5 6 7 from 0 0 0
to 1 1 1 1 1. This could be the network ID of class A.
Okay. Now the thing is do you have you have to remember this that these two this one and this one these two network
addresses are not generally given because they have a specific purpose what specific purpose this address zero zero from network ID and all the ghost
values are also zero dot 0.0 zero. What does this mean? That
all the eight bits are zero.
This is not given to any of the network.
This is used as the default route.
Default route or DHCP client. We are
going to learn it later. But for now, you have to remember this that 0.0.0.0 is not given to any host DHCP client.
And what about this? This is not given and this is not given. What about this?
This is 127 127.x.x.x.
What does this mean? That host value can be anything.
Host value can be anything.
This is also not given to any network.
Why? Because this is used for loop back testing.
Loop back testing or self connectivity.
For self connectivity.
What is this? We are going to learn in few minutes. Self-connectivity
few minutes. Self-connectivity or you can also call it as inter for interprocess communication. For
interprocess communication. For interprocess communication.
Okay.
Now there's a specific node that you have to remember. What node is?
Whenever all the whenever we have all bits either zeros or one in network ID or host ID
they are not given to any of the host which means these IP address are not assigned not assigned.
What does this mean? This means that for these 24 bits if these 24 bits are all zero or all one then they will be not
assigned to any of the host. Okay. So
let me repeat whenever we have all zeros or all ones either in network ID or in host ID of any IP address these IP address are
reserved for special purpose. So we
cannot assign these IP address to any host which means the computer. Okay.
Okay. So whenever you see NID or HID, you have to deduct them from the valid addresses to be assigned to some host.
Okay. So we have 2 to^ 7 minus 2 which means 126 networks in class A.
Why 126? The first one was for DCP client and the second one was for loop back testing. What is loop back testing and
testing. What is loop back testing and DCP? We will learn later. You just have
DCP? We will learn later. You just have to remember why we have deducted these two. So 126 networks in class sorry a
two. So 126 networks in class sorry a and how many host 2^ 24 but you know we have reduced two all zero and all one
minus two. So these could be the number
minus two. So these could be the number of host in a network of class A.
Why we directed this? 0 0 0 not valid.
All ones also not valid. Okay. Which means
255.255.255 not valid. Similarly here X cannot be
not valid. Similarly here X cannot be all zero or 255.
Okay. Now what is what is this loop back testing I was discussing about and what was the default route this default route part we are going to learn in later lecture but for loop back testing we
will let's see here for example I have a computer A communicating with computer B
here let's say there's some intermediary node in between now what happens is computer B do not receive the message sent by computer A now what could be the
problem? So when we start testing what
problem? So when we start testing what we do, we check that whether the router has received the message or not.
The message has reached the router or not.
We check that is router okay or not. So the first check we do is of is router receiving the message or not. Is router forwarding
the packets, forwarding the packets or not? Then we check let's let's mark
not? Then we check let's let's mark them. Let's mark these problems. The
them. Let's mark these problems. The first problem we checked was is router receiving the packets. The second
problem we checked was is router forwarding the packets. Is there any problem in the link or not?
Okay. So these three things we have checked. The first thing is this link.
checked. The first thing is this link.
The second thing is this link and the third link is is router okay or not. Now
there are two different things that we have to check. The first one is is B receiving the message?
Is B receiving the message or A is able to send message or not?
So what they are going to do to check this the loop back testing loop back testing
how it's done? Suppose the IP address suppose the IP address of A is 10.31.92.57.
This is the IP address. Now sender IP address and destination source IP address and destination IP address. So
the source IP address will be 10.31.92.57 and the destination IP address it will not put of B. It will put 127.x.x.x
whatever value.
What is the point of doing this? The
point is whenever router is going to see Let's understand loop back testing. For
example, we have two computers A and B and we have intermediary node in between. Let's say this is router. Okay.
between. Let's say this is router. Okay.
Now B is not receiving the message sent by A.
How are we going to check where the problem is? So let's start. First thing
problem is? So let's start. First thing
is is the router okay? The second thing is is this link okay? Is this link okay?
Now fourth or fifth thing we are going to check is is Able to send the message or B is able to receive the message or not. So this is done using loop back
not. So this is done using loop back testing.
Loop back testing. What we do? Let's say
the IP address of class uh the IP address of this uh computer A is 10.31.92.57.
Okay. So source IP address will be this and the destination IP address will not be of B. It will be 127.x.x.x.
What does this mean? This means that A will send the message to itself.
And if it is able to receive the message, which means it's able to send the message also.
Same thing could be done by here B. if B
can receive the message sent by B itself which means it can also receive the message sent by A.
So this is where loop back testing is used. Now there's very important point
used. Now there's very important point you cannot use this address 127.x.x.x
as source IP. You cannot do this. You
must always be very careful that you always put this into the destination IP part. Okay. So 127.x.x.x
part. Okay. So 127.x.x.x
will always be destination IP.
Okay.
And cannot be assigned to any can't be assigned to any host.
So these two point you have to remember.
Okay.
Should we continue the class and and keep on understanding class B or we should do in the next lecture?
I'll do as you say.
We can understand class B, class C and we can also go forward like class D and class C and then we can end the class with a summary and then from the next lecture we will solve some of the
practice problem on this. Does this
sound okay or should I should explain this class B, C and D and E into the next lecture?
Okay. So, everyone is saying that we should continue in this lecture only.
So, let's continue here. Class B.
Okay. So, class B we have fixed in the NID 1 zero. So, this was the NI part.
Two octets more for the HID.
This was the NID part. So in class B we have fixed one zero bits from the first octate of NID. Now
how how many are remaining? Six from
here and eight from here. So 2 to^ 14 will be the total number of networks.
Total number of networks. Should should
I have to subtract something from there?
No. because 1 0 even if even if everything becomes zero also in that case also the NID is not completely zero not completely zero because of this 1 zero while in class A it was become
completely zero because the first bit which was fixed was also zero so here you do not have to subtract anything from the total number of networks
then what about HID what about HID so we have 8 bits 8 bits which means 16 bits for the HID which means 2^ about 16 addresses
for the HID.
Are these two power 16 address eligible to be assigned to some computer? No.
Why? Because here h I could be all zero and all one. So these two cases should be excluded.
Which means 2^ 16 minus 2 these will be number of host per network and what will
be the total number of network 2^ 14. Is the point clear?
2^ 14. Is the point clear?
Do anyone have to ask some doubt or something you are not able to grasp or any question everything okay? Okay. Let let me
everything okay? Okay. Let let me explain it in a different way. Suppose
I start with 128 because the first bit is 1 Z. So 1 Z and then this part is of N ID and this part is of HID
even if I put all zero here all zero all zero what is the value 128.0 0. Now what
comes the HID part?
HID part. So
this is the network ID. First network
ID. First network ID. Now what will the second network ID? 128.1.
What will be the third network ID?
128.2.
Second network ID. Third network ID. So
128.255 255 the maximum it can reach with the fixed value of 128. Now what
will happen? It will go towards 129 and then 129.0
and then 129.1 and then 129.2 2 till 255 and after that 130 from 0 to 255 and
then from 131 0 to 255 till till what's the maximum value it can reach can it can it reach 255 no it cannot
reach why why so the maximum it can reach is 255 minus
64 4 which is 191. How did I get this?
See here 1 0.
So the last last network of class B will be 1 one 1.
This is 255 minus this was 64. So equals to 191.
And from 191 0 to 255. So the last network will be 191.255.
Let me repeat again. We started with 128.0 reached till 255 and then 129.0 reached
till 255 and then 130.0 reached till 255 and then in the last the maximum value which can reach is 191.0 to 191.255.
So what is this 191 dot minus 128?
What is 191 minus 128?
63. But you know whenever you count for example how many numbers are there in 1 to 10? There are 10 numbers not nine.
to 10? There are 10 numbers not nine.
What how did I calculate it? 10 - 1 + 1.
Okay. So in the same way if someone askked how many numbers are there from A to B. I'm not asking between A to B. I'm
to B. I'm not asking between A to B. I'm
asking from A to B which means also calculating A and B. So this will be
B minus A + 1. Similarly 191 - 128 = to 63 + 1 will be 64. So from 128
also including 191 there are 64 numbers.
So 64 into each going from 0 to 255 each going from 0 to 255 which means total
256. So this is 2^ 6 sorry 2^ 8 this is
256. So this is 2^ 6 sorry 2^ 8 this is 256 and this is 2^ 6. If you multiply what is this 2^ 6 into 2^ 8 which is 2^
14. Isn't 2^ 14 is the number of
14. Isn't 2^ 14 is the number of networks in class B?
We just seen 2^ 14 is the total number of networks in class B. I hope you are getting the point. How are we calculating?
Let me repeat again. Again if you are if you have already understood you can just listen again. What are we doing here? We
listen again. What are we doing here? We
have in class A we have fixed the first bit zero and then we have just seven
bits. So 2^ 7 - 2 Y2 0 and the one part
bits. So 2^ 7 - 2 Y2 0 and the one part they are excluded. For class B we have 1 zero fixed 6 bits remaining and another
octed also given to NID 8 bits and then two octates for HID. So total 2^ 14 will be the total number of networks and each have 2^
16 - 2. Why minus 2? All zero and all one will be excluded.
Excluded. Okay. So till now we have completed class B. Now let's move toward class C.
Class C.
Should I write it here or class C?
In class C we have 8 bits, 8 bits and 8 bits. These are all given to NID. And
bits. These are all given to NID. And
the last octate is assigned to HID 8 bits, 8 bits and 8 bits. So there are 2^ 24 and this is 2^ 8. So the total
number of host in a single network will be 2^ 8 minus 2 it will be 62 this was 60
uh did I made a mistake 2^ 8 is 256 256 256 - 2 is 254 so total number of hosts
will be 254 okay total number of networks will be more how many will be there we fixed 1 1 0. So how many remaining
here? Five. So 8 and 5 13 and 8 21.
here? Five. So 8 and 5 13 and 8 21.
So 2 raised to power 21 will be the number of networks networks in class C and 254 will be the
number of host in a single network of class C.
Okay.
Is the point clear?
Let's move toward class D and then we will see the uh uh an identification trick that we we are going to just see the first octate and we can identify from which class does the IP address
belong. Okay. Now let's to move toward
belong. Okay. Now let's to move toward class D. Class D have 11 1 as fixed. And
class D. Class D have 11 1 as fixed. And
you know there's a special thing about class D and class E.
There is no concept of NID.
There is no concept of no N I no HID 11 1 is fixed. How many are remaining?
How many are remaining? 2^ 24 28 are remaining. Four are fixed, 28 are
remaining. Four are fixed, 28 are remaining. So these will be the number
remaining. So these will be the number of IP addresses. Similarly for class E 1 one how many are remaining? 2^ 28. So
these will be the number of IP addresses. There's no concept of an ID
addresses. There's no concept of an ID or HID in class D and E.
Okay. Class D is reserved for multiccasting and class E for research purposes or future purposes. Research and future
future purposes. Research and future purposes.
Research and future purposes.
Okay. Okay. Now let's see the identification trick.
Class A the first bit was zero and the rest was ranging from 0 0 0 from 1 till 1 1 1 1
and 0. You know
and 0. You know if it was all one then it was 127 which was used for loop back testing. So it
couldn't couldn't be all one so it has to be zero. Now if it was all zero then it was used for DCP. So it couldn't be all zero so it has to be one. So this is
one and this is 126. So class A has a range of 1 to 126 in the first octate.
Class B. So class A has a range of 1 to 126. Now what about class B? Class B has
126. Now what about class B? Class B has 1 0 already fixed. Now remaining six bits. They could range from 0 0 0 all 0
bits. They could range from 0 0 0 all 0 to all one 1 1 1 1. How class A was not given the privilege to become all zero
and all one? because
of this zero if everything became zero then it is used for DCP for 127 it was used for loop back testing but here it is 1 zero already so even if they all
become zero or all become one it's okay there the whole is not becoming zero or one okay so this value is 128 and this
value is 191 so class B has a range of 128 to 191 what about class C you're going to calculate in the similar fashion 110 it could be all zero and all
one. So this will become 192 to 223. How
one. So this will become 192 to 223. How
I'm going to how I'm calculating so fast? Because I have remembered this and
fast? Because I have remembered this and you also have to remember this. This
range is a must to remember. This range you should
to remember. This range you should remember.
Okay. What about class D? Class D have 224 to 239. And what about class E?
Class E have 240 to 255. Okay, let me draw the table again. Class A has a range from 1 to 126. Class B has a range
from 128 to 191. Class C has a range from 192 to 223. Class D has a range
from 224 to 239. And class E has a range from 240 to 255. If you have to remember this table and let let me also write the
number of IP address 2^ 31 2^ 30 2^ 29 2^ 28 and also 2^ 28
okay should I also write the number of host and number of uh networks networks and hosts so class A has 126
networks and host will be 2^ 24 - 2 class B have 2^ 14 network and host will be 2^ 16 - 2. Class C have 2^ 21
networks and the number of host will be 2^ 8US 2 and class D and class E do not have a concept of N ID or HID. No NID,
no HID.
Okay.
Now I have a DPP for you. You can try to solve that DPP and in the next lecture if you have any doubt you can ask me.
Okay. So before solving the DPP, let me tell you in few minutes what are the properties of IP address which will help you to solve the problems. So the first thing is uh there can be questions like
this from which among the following option the IP addresses of class B let's say. So how are you going to identify
say. So how are you going to identify from 32 bits of long IP addresses? You
are going to just see the first two bits. If it is 1 0 then it will be from
bits. If it is 1 0 then it will be from class B. If it is zero, it will become
class B. If it is zero, it will become class A in such manner. If it is 1 0, then class C. If it is not in decimal, if it is not in binary, then it may be
in the decimal format. So, how are you going to identify? Using this range.
Suppose it's like 163. Tell me from which class does it belong.
Yes, class B.
Okay. So, in this manner, you are going to identify. Now there may be some other
to identify. Now there may be some other questions like which of the following is not a valid IP address. How how are you going to identify? You have to see that no decimal value in IP address can
surpass 255.
If it is something like this like 10.25600 then this is not a valid IP address.
Okay. So each and every value of the socket will be from 0 to 255.
Okay.
This could be asked like which of the following address can be used for interprocess communication in a host or loop back or self-connectivity then 127.x.x.x
127.x.x.x
X this could be the answer and you have to very very careful that this can never be source IP address it will always be destination IP address okay we have
discussed this in the topic of loop back testing okay convergence questions could be there that suppose C22 F1582
this is the hexa decimal notation of an IP address now you have to convert into let's say decimal How are you going to convert? You can do it like this. You have to first convert
into binary and then you can convert into decimal.
I hope you all know this. How to convert hexodimal into binary. C. What is C?
Well, which means 1 1 0 0. What is 2? 0
1 0. What is two again? 0 0 1 0. So,
this will become the first octate. What
is this?
This is 192 and this is 2. So this will be 194 dot 1 1 f is 15. So what is this? This is I
think 47.
So the second octate have a decimal value of 47. So you have to do it for these two also in such manner. I hope
the point is clear.
Okay. You can try more questions. For
example, uh 172 A84 C8. Try to convert it into decimal.
You can do like this uh the method which I taught you. Just try it. Solve it. I'm
giving you 30 seconds to solve this and do not make some silly mistake of computation.
Keep the work neat and tidy.
Solve it systematically and you won't face any problem.
Okay. So you would have solved with a method of this. First you converted into binary and then decimal. You can also do like this and convert directly from hexadimal to
decimal.
Exit decimal to decimal direct conversion. How do we do that? Base is
conversion. How do we do that? Base is
16. So 16 raised ^0 into 7 + 16 raised to power 1 into 1. What is this? Just 7.
And what is this? 16. So this is 23. So
the first octate will be 23. The second
octate will be in the same manner. What
is a? a is 10. So 10 + 16 into 2 32.
This will become 42. And then in the same manner 4 + 16 into 8 this will become 132. And then again 12 into 16 +
become 132. And then again 12 into 16 + 8 this will become 200. So the
conversion value will be 23 42.132.200.
Okay. So these type of questions may be asked. This was all the easy part. And
asked. This was all the easy part. And
now let's go to more technical ones.
Suppose a question could be like this.
Suppose instead of using 16 bits for network part of class B class B and ID suppose instead of 16 bits I am using 20 bits.
Now tell me the number of class B networks and host networks and host.
20 seconds again. So
what we have done before before 16 bits were assigned 1 zero was fixed remaining were 14 bits. So we said 2^ 14 were the number of networks. Now
what are what are we doing? Instead of
16 bits we are assigning 20 bits 1 0 is again fixed. 18 bits are remaining. 2^
again fixed. 18 bits are remaining. 2^
18 will be the number of networks. What
about number of hosts? So out of 32 bits, 20 bits were assigned to an ID.
How many are remaining? 12 bits are remaining for HID. So how many host? 2^
12 minus 2. Why two? Because all zeros and all ones are not allowed. So this
will be the number of hosts. The simple
question may be asked.
You can make it something like this also that uh maybe number of networks uh 2^ m and the number of hosts 2^ n
minus 2 let's say in class b then what will be the relation between m and n you can solve like this again 10 second try to solve
this is a very easy Number of networks in class B will be 2^ m= to 2^ 14. So I will say m= to 14. And
number of hosts in class b will be 2^ n - 2= to 2^ 16 - 2. So I'll say n= to 16.
What is the relation?
A m= to 7 n. That's the relation.
Okay.
Anyone have any doubt? You can ask me.
You can also see questions like this that how many bits are allocated for NID and HID for an IP address like this 23.192.157.234.
How many bits are assigned for an ID and how many for HID?
You can see this number. This is 23.
What does that mean? That this belongs to class A. And in class A, eight bits are assigned for an ID and 24 bits are assigned for HID.
I hope the point is clear. So you have to remember the range. That's why I have told you. So when you say this, you can
told you. So when you say this, you can directly in a moment can tell that this IP address belongs to class A.
Okay. Anyone have any doubt? You have to remember this table where it is gone.
This table you should remember the number of IP addresses, the range, number of networks, number of hosts. They will
come handy if you directly remember them.
Okay. Now there is some important thing I want to tell you that you have to be very careful what is asked in the question. Read the question very
question. Read the question very carefully. whether they have asked the
carefully. whether they have asked the addresses or the hosts.
Whether they have asked the addresses or the host. For example, if I ask what is
the host. For example, if I ask what is the possible number of networks and addresses in each network under class B in IP4 addressing, what would you say?
Suppose uh in class B in class B 16 bits are assigned for NID and 16 bits are assigned for HID. Out of
16 bits, 10 is fixed. So 2^ 14 will be the number of networks and how many addresses? 2^ 16 and I have told you that you have to subtract two.
So is this the answer? No, this is wrong. This is the number of host for
wrong. This is the number of host for host you subtract two. But how many addresses are there? Addresses will be 2^ 16. So when you are asked that tell
2^ 16. So when you are asked that tell me the host then you have to subtract two. When you are asked tell me the
two. When you are asked tell me the addresses then you have to answer directly. So the
answer will be 2^ 14 and 2^ 16.
Okay.
Only subtract when you are asked about the host.
Things questions like this may be asked.
Tell me from which class does this belong 200.18.32.65.
You can directly see that this number lies between 192 to 223. So this is a range for class C. So it belongs to class C. An easy question.
class C. An easy question.
Okay. Percentage questions could be asked that uh class D network how percentage of address occupied by
class D will be how much? We have made a diagram here 50% are occupied by class A. 50% occupied by class A. Out of the
A. 50% occupied by class A. Out of the remaining 50% we divided into two part.
25% is occupied by class B. And out of the remaining 25% we divide it into two part. 12.5% is occupied by class C. And
part. 12.5% is occupied by class C. And
out of the remaining 12% we divided into two part D and E. So D will occupy 6.25%.
Okay.
These type of questions would be asked nothing more.
Okay.
again from loop back testing and all these could be asked and there's a there's a one thing which you should remember that for classful addressing classful addressing large part of IP
address are generally wasted because the needs are not exactly matched either you have to buy a lot more or you have to suffer
with a lesser uh available networks lesser number of available host okay for example if I wanted to buy a host 70,000 host
I have to buy a class A network and class A network offer a lot a lot more than 70,000. So those will be wasted.
than 70,000. So those will be wasted.
Okay. So I hope everything is clear now.
Wastage is a lot. Wastage is really a big concern in classful addressing. Let
me give you another example. In class A 2^ 24 IP addresses are there in one network. Class B 2^ 16 IP addresses are
network. Class B 2^ 16 IP addresses are there in one network. In class C 2^ 8 IP addresses in one network. Suppose an
organization need 2^ 20 IP addresses.
So which network it should buy?
Obviously class A network it should buy.
So out to 2^ 24 - 2^ 20. Now you may see that this number is not a such of big wastage. But when you are going to solve
wastage. But when you are going to solve this when you are going to solve this that this is 2^ 20 2^ 4 - 1. So this
will be like 2^ 20 into 15 these are 15 million. Are you getting the point? These are 15 million. 15
the point? These are 15 million. 15
million addresses were wasted.
This was when when we were using 1 million.
And what if we are just using like 70,000 then the wastage will be a lot more.
How are you going to solve this?
How are you going to solve this with the help of class less addressing? Okay.
Okay. Now that is enough for this lecture. You may solve the DBP now. And
lecture. You may solve the DBP now. And
whatever problem you encounter, you can ask in the next lecture.
By the way, all the problems are very easy. You will be able to solve them in
easy. You will be able to solve them in one go. Okay. Bye.
one go. Okay. Bye.
Good morning class. How are you all?
Everything good?
Okay. So if anyone have any doubt from the DPP or the lecture, you can ask now.
Okay. Okay. So
student has asked about the protocols.
protocols from the data communication part. From the first lecture
part. From the first lecture we discussed that data communication has five components sender, receiver, message, transmission medium and
protocols. Okay. So you want to know
protocols. Okay. So you want to know more about protocols like what are they or how do they work? Okay. So protocol
means rules already predefined and set among sender and receiver so that synchronization happens between them and why why we need synchronization
because let's say the sender has the capacity to send 100 Mbps but the receiver can only process 1 Mbps soon the receiver will be overloaded
and the data will be lost.
Another thing you know when receiver receives the data it receives in like this fashion. It doesn't know what is
this fashion. It doesn't know what is the meaning of each bit. What is address from where the message is started. It
knows nothing. So there must be some predefined rule that let's say these few bits are the source IP address. These
few bits are like the destination IP address. The remaining may be the
address. The remaining may be the messages. We need rules before
messages. We need rules before beforehand. Okay. So these protocols are
beforehand. Okay. So these protocols are the predefined rules set among receiver and the sender so that synchronization happens so that they can work upon which
is already agreed. Okay, protocols have you can define protocol or the key elements of the protocol will be the syntax the order like this that these few first
will be source IP then the destination IP and then the message. So the syntax will be a key element semantic like what is the meaning of each section of bit
you have said that these bits are fixed these bit are fixed this is what syntax was now this section of bit is the sip this section of bit is the destination
IP you are giving meaning to the section of bit this is called semantics and the third thing is time when the data will be sent and how fast
it will be And otherwise the receiver may be overloaded and data may be lost.
Okay.
So it was nice that you asked we have discussed protocol. Any other
doubts someone have?
Okay. Okay. For identification. Okay.
Let me discuss it very formally. So
another question or another doubt which was asked was how are you going to identify and uh from which computer which process has uh has requested for
the data. Okay. So we call it as the
the data. Okay. So we call it as the identification problem.
It was a very nice doubt identification problem. Okay. Let's discuss. So firstly
problem. Okay. Let's discuss. So firstly
you have to identify the network because there are so many networks and data or the host can be sitting in any of the networks. So you have to first identify
networks. So you have to first identify the network. Later we will study that
the network. Later we will study that there are subnets also. So if subnet is present then you have to identify the subnet too. But let's keep the case
subnet too. But let's keep the case simple. You have to first identify the
simple. You have to first identify the network and from the network you have to identify the host. There are many hosts.
So you have to identify the host and among the host there are many process. You so you have to identify the
process. You so you have to identify the process. How it is done? So firstly you
process. How it is done? So firstly you you have to identify the network and then the host and then the process.
So you have to identify the network using logical address or IP address.
You have to identify the host with the help of MAC address. Okay. How are you going to identify the IP address? How
will you know that what is the IP address? With the help of DNS. How are we going to identify the
DNS. How are we going to identify the MAC address? With the help of ARP. We
MAC address? With the help of ARP. We
will study these later. How are you going to identify the process? With the
help of port number.
Okay. So in such manner you will identify.
See this for the logical IP address.
Let's say if the network is of class A then we have N ID and HID. N IDs of 8 bits and HIDs of 24 bits. So how are you
going to identify the network? Let's
let's take an example. Suppose we have like this 10.32.15.73.
Okay. So this is the NID and this is the HID 10.0.0.0.
If you go to the first host or the zerooth host, which means you're going to the network and you know you know this is the zerooth host. It doesn't
actually exist because we start the numbering of the host from one. Are you
getting the point why we have said that all zeros are not allowed or not given to any of the host? Because all zeros are used to identify the network.
This will become zerooth host or you can say the network ID and then 10.0.0.1 was the first host. So when host ID
becomes zero and network ID remain as it is it gives us the network ID.
So the network we have identified 10.0.0.0.
Okay. So this was the network. Similar
thing let's take another example 157.30 uh anything 32. Identify the network ID.
I'll give you 10 seconds. Identify the
network ID.
Brother, brother, brother. Wait. Think
before you write. Why have you written 157.0.0?
Is it class A network?
Think before you write. This belongs to class B.
So in class B, two of the octates are given for the NID. So the answer will be 157.30.0.0.
Let's let me give you another example.
200.30.223.
What is the network ID?
Yes, now you have written correctly.
These three will be for the NID and this will be for the HID. So HID will be zero only. 90.0. zero. This is the network
only. 90.0. zero. This is the network ID.
Okay. Now you have got the IP address of the network. You have identified the network. How are you going to identify
network. How are you going to identify the host with the help of physical address which is the MAC address printed on the NIC card. But you don't know the NIC card.
card. But you don't know the NIC card.
But you do not have access to the NIC card of some other host in a different network. How are you going to identify
network. How are you going to identify the host address?
with the help of address resolution protocol.
We'll understand this when the time will come when the module will come. I'll
give you a very basic introduction for this ARP. You have to just remember
this ARP. You have to just remember these things that for ARP the request the ARP request is broadcasting. What is
broadcasting?
that you send the message to each and every host present there you you have got the IP address you have already got the IP address of the host
suppose I have got the IP address of this host now I will send an ARP request like this I'll leave the MAC address
empty for IP address I will write the IP address of the host 10.32.15.73 and I will send this message this ERP request to each and every host. Now what will
happen? Each and every host will look is
happen? Each and every host will look is this IP my IP? This will say no this is not my IP. So it will ignore. He will
see is this IP my IP?
He'll he'll say yes. So I have to send the MAC address to to the person who have asked. So
have asked. So source IP will be present. So we'll look at the source IP and he will fill up its MAC address whatever the MAC address is
48 bit MAC address and it will send it to the source. So in this manner the source will get an idea of what the MAC address of this person is or this
host is. Okay. Let me tell you one more
host is. Okay. Let me tell you one more thing. IP address is of 32 bits.
thing. IP address is of 32 bits.
MAC address is of 48 bits.
Okay.
So the ARP request ARP request it was broadcasting we sent it to everyone and the reply was uniccasting which
means only the person or only the host whose IP it's written only he will reply.
So the reply will be uniccasting and request will be broadcasting.
So we've got the MAC address also. We
have identified the network, identified the network, we have identified the host.
Now what about the process? Which
process is requesting the data? We will
identify using port number. And port
number is of 16 bits.
So what is the range of the port number if it is of 16 bits 0 to 2^ 16 - 1? If all were ones I have
told you if all are ones then the range is 2^ n - 1 like this is 8. This is 7
not 8. This is 15 not 16. So the maximum
not 8. This is 15 not 16. So the maximum value it can reach is 2^ 16 - 1 6 5535.
You can remember this number.
You can remember this number 655 335 it will come again and again. So out of these 0 to 65535
first 1024 which means from 0 to 1023 they are wellknown port number wellknown port number
these are assigned and controlled by AA internet assigned number authority.
Okay these are not given to the uh random processes. These are well
random processes. These are well definfined number. Let me give you an
definfined number. Let me give you an example. And you have to remember these
example. And you have to remember these port numbers. You have to remember this
port numbers. You have to remember this port number. Remember
port number. Remember SMTP the port number is 25. HTTP the
port number is 80. FTP
20 and 21.
DNS the port number is 53. POP port
number is 110. IMAP port number is 143.
Homework. What is the port number of HTTPS?
Search for it. Okay.
Do anyone have any more doubt? You can
ask. The more doubt you ask, the more information you will gain.
Okay. Another doubt came. He was asking we have heard about uniccasting, multiccasting and broadcasting. Can you explain more
and broadcasting. Can you explain more and how written?
Hey, please do not use short forms. I I'm not very good at the short forms. Write properly. You want to know more
Write properly. You want to know more about castings? Let's let's learn more
about castings? Let's let's learn more types of communication.
Okay. Uniccast. Uniccast means one to one broadcast.
Broadcasting means one to all and multiccast one to many. Now another homework learn more about anycasting.
What is anycast? Okay. Now how
uniccasting is done?
What is uniccasting? Again, transmitting
data from one computer to another computer is called uniccast. One:1
communication.
Okay. So, let's say we have two networks. This network is 10.0.0.0.
networks. This network is 10.0.0.0.
This is network ID. And another network like 22.0.0.0.
And we have a host with IP address of 10. 32.52.7
10. 32.52.7 anything. And here another host 22 let's
anything. And here another host 22 let's say 100.35.
Now data and the source IP will be 10.32.52.7 and the destination IP will be this IP
address simple 22.003.5 100.35 that's it okay and when the reply will come the reply will come like this this was source IP this was destination IP and the source and destination IP will be
swept for the reply okay see it is not necessary that you have to send it to some uh different network computer you can also send it to some
computer which belong to the same network like 33.52.7 can also send it like here so in uniccast communication both source and destination can be present in the same network or different network it doesn't
matter what about broadcasting can we broadcast in the same network and can we also broadcast in all the computers of a different network we can
do both let's understand it more when we do it in the same network like this and we can do it in the different network also
Okay. So when we are sending one to all
Okay. So when we are sending one to all one to all that one host is sending to all the host present in the same network and one host is sending to all the host
present in the different network.
We name it as limited broadcasting and we name it as like direct broadcasting.
Okay. So there are different methods of doing this. For example, if you're doing
doing this. For example, if you're doing like limited broadcasting that transmitting data from one computer to all the computer present in the same network. This is the same network.
network. This is the same network.
Then it is limited broadcasting. So what
what destination IP will you fill here?
For example, if you like write data here SIP and DIP, SIP is let's say 15.23.97.
What are you going to fill in the destination IP?
You remember I have told you that all ones are not allowed.
All ones are not allowed.
That's why we have reserved that for the limited broadcasting. We are here going
limited broadcasting. We are here going to write 255.255.255.251.
This means that this source IP is going to send to all the host present in the same network.
So whenever you see this like FF ff this is written in hexadimal format.
This means that a source IP is going to send to all the network present in the all the host present in the same network. Okay. So what about direct
network. Okay. So what about direct broadcasting?
Oh and one more thing and one more thing you cannot ever use this as a source IP.
This is not some this is not an IP address of a particular host. This is
reserved for limited broadcasting. So
you are not going to use it ever as a source IP and it will be always used as destination IP. Okay.
destination IP. Okay.
Is the point clear?
Now what about direct broadcasting? when
we are transmitting from one network to all the host of other network what will be the IP let's say
for the source IP and for the destination IP what will be here source source IP will be the IP of this let's put anything like 1532.9730
what will be the destination IP the network ID 150.0 0 and the host ID is and the network ID of this will be
112.0.0.0.
So what are you going to put in here?
No, no, no, no. You have mentioned we put like this 0.0.0. No, it doesn't work that way. It's already fixed. Source IP,
that way. It's already fixed. Source IP,
destination IP, source IP will be the same. But for
destination IP, we do not put the network ID. we write
network ID. we write and this will be all one host ids are all one
that's why I've told you not to allow any host with an IP address of all ones network ID and host ID cannot be all
ones now you're getting why all ones or all zeros because they are reserved So whenever you see like this
112.255.255.255 255 as as the destination IP address which means 112 is the class
A IP and these are the host IPs and all the host ids are ones which means it is a case of direct broadcasting which means someone from a some different
network is trying to send some message to all the people present in this network of class A. So this is how direct broadcasting is done. Let me
repeat again for limited broadcasting and for direct broadcasting for destination IP you're going to use 255.255.255.255 and for direct broadcasting you are
going to use network ID and then all host ids as well.
The source IP will will be the source IP of the person who is trying to send.
Okay. Again the same concept applies here. These two cannot be ever used as
here. These two cannot be ever used as the source IP. They will always be used as the destination IP.
Okay. So whenever we have all ones in the HID part of any IP address that IP address represent the direct broadcast address. So this is the reason we cannot
address. So this is the reason we cannot assign this IP to any host or computer.
Okay.
Let's discuss another case 113.0.0.0 157.132.0.0 There are several computers here in this network and 113.32.5.9
and this computer want to send the network send to all of the host present in this network the different one. What will be
the source IP and destination IP? Tell me
okay correct source IP is 113.32.5.9 and the destination IP will be as this is a class B address so network ID will be the two octates
157.32 this 132 this will remain as it is and the rest HID part will be all ones so the answer will be 157.132.255 255.255.
This is correct.
Okay.
Now let me make a table so that you may not get confused. Network ID,
host ID. If network the network ID is valid and the host are all zeros, which means this represent the network
ID of the full network like this.
If network ID is valid and host IDs are all ones, this represent direct broadcast address.
If network ID is also one and host ID is also one, then this represent limited broadcast address which was 255.255.255.255.
There's another concept of network mask.
Network mask.
Network mask always helps you to know which portion of the address identifies as NID and which portion of the address identifies it as HID. So class A, BC
network have default mask also known as natural mask like this.
For class A, the natural mask is 255.0.0.0.
For class B, the natural mask is 255.255.0.0.
For class C, the natural mask is 255.255.255.0.
So you can also add one thing here.
Then if that if network ID is all ones and host IDs are all zero, then this will become the natural mask.
Okay? Or network mask.
So now how are you going to identify?
Let's say I have given an IP address and suppose you do not remember the table. How are you going to identify
table. How are you going to identify that this IP address belongs to Okay, suppose I have an IP address
let's say 200.200.200.96.
I got the network mask as as this is a class C address. So the network mask will be this. So 200.200.200.96
200.96.
When we are doing bitwise ending with the subnet mask or the network mask, it will become 255 255 255.0.
So as you know that if some number let's say 1 one how do we do bitwise ending?
First let's understand that 11 1 bit wise ended with 11 1. The answer will be 1 1. 1 and 0 will become 0. 0 and 0 will
1 1. 1 and 0 will become 0. 0 and 0 will become 0. 0 and 1 will become 0. 1 one
become 0. 0 and 1 will become 0. 1 one
will become one. So for 200 how are you going to represent 200? 1 1 0 0 1 0 0 0.
This is 200 like this is this is 192 and this is 8. So this is 200. How are you going to represent 255?
200. How are you going to represent 255?
1 1 1 1.
So 1 and 0 0 1 and 0 0 1 and 0 again 0 1 and 1 1 0 0 1 1. What is this again?
192 and 8 which means 200 only. This was
also 200.
So if you are doing any number any number from the range of 0 to 255 when we are doing bitwise ending with 255 then the
same number will be here same number.
So the result will be 200.200.200 for 200 and if you do bitwise ending of any number with zero
zero will be there. So zero will be there. This is what the network ID of
there. This is what the network ID of the IP address of this IP address 200.
Okay, you can do it directly also as you know that this is a class C address and in class C the first three octates are given to network ID. So that those
octates will be same and the remaining will be zero. See this
if the network ID is valid then this octate and HID are all zeros then it represents the network ID of the full network.
Okay, now try this. You have to identify which type of IP address is this 192.192.192.255.
Is it direct broadcast address? It is
limited broadcast address. Is it host IP or it is network IP? Network address.
Tell me.
Okay. So, this is not limited broadcast address. You can directly tell because
address. You can directly tell because it is fixed 255.255.255.255.
Now this is a class C network and this is the network ID part and this is the host ID part. We see that host ID part is all one and network ID part is
valid. So this is a direct broadcast
valid. So this is a direct broadcast address.
Is it clear? Okay. Now I'll give you some uh more examples to solve. 200.200
200 let's say 10.1 19200 tell me which class does it belong 7.10.230.10 or 1 whatever 128.1.1.254 127.3.6.200
255.255.255.255 255 100.255.255.255 255. Now tell me this is class C
255. Now tell me this is class C network. This is
network. This is type quickly man. We don't have much time. Class A network. This is
time. Class A network. This is
class B network. This is
self connectivity.
This is limited broadcast address. This
is direct broadcast address. I hope now the point is clear. Anyone
have any doubt? Till now you can ask.
Okay. So we will end the class here.
I'll give you DVP you have to solve and in the next lecture we will start with a new topic name subnetting.
Okay.
So we'll end the class here. Good
morning class. The topic of our today's class is subnetting.
What do you think subnetting is? By the
name, can you guess?
Yes. Smaller networks or the process of dividing a big network into many smaller subnet is called subnetting. Subnet
means sub network and subnetting means dividing a big network into smaller parts. This is what subnetting is. Let's
parts. This is what subnetting is. Let's
say this is network one. So network
subnet one, subnet 2, subnet 3 and subnet four. And why do we do so? Let me
subnet four. And why do we do so? Let me
give you an example. Let's say your university have 2,000 computers.
Okay? You want to allocate 500 to engineering department, to some 500 to some humanities department, 500 to architecture
department and 500 to uh let's say math department. Okay. And they will be
department. Okay. And they will be managed with the help of router in between.
So what are the advantages? The first
advantage is maintenance and administration becomes easy. Maintenance
and administration becomes easy. When
you have divided subnets, then each subnet is isolated from other. So it
also provides security through isolation.
Security is also there.
For example, let's say in a company code of a developer department must not be accessed by some let's say HR department. So for those purposes we do
department. So for those purposes we do subnetting because maintenance and administration become easy and it also provides security to one network from
the other network. But you know there's always a trade-off. So what are the disadvantages of subnetting? Can anyone
tell?
Obviously the disadvantage is identification becomes a bit harder or one step increases. We you know we have discussed
increases. We you know we have discussed this while I was talking to you uh explaining the topic of identification.
Someone asked that out how are you going to identify some host in a particular network. In that case, I've told you
network. In that case, I've told you that usually there is a three-step process. You first identify the network,
process. You first identify the network, then you identify the host and then you identify the port. But now that step
is changed.
Now in a network you identify subnet also in which subnet your host is present. So firstly you have to identify
present. So firstly you have to identify the network. Then you have to identify
the network. Then you have to identify subnet within the network. then identify
the host within the subnet and then identify the process within the host.
Okay, I hope the point is clear.
So in case of a single network only two IP address are wasted to represent network ID and broadcast address. We
have discussed about this that all zeros and all ones are not allowed. Why?
Because all zero represent the network ID and all ones represent the direct broadcast address. We are talking about
broadcast address. We are talking about the HIDs. When HIDs are all zero which
the HIDs. When HIDs are all zero which means we are representing the network ID of a network and when HIDs are all ones then we are representing the direct
broadcast address.
So in case of single network two IP addresses are wasted because of this.
So when you increase the network the number of IP addresses for which could be allocated to a host will be wasted more. Let me repeat in case of a single
more. Let me repeat in case of a single network only two IP addresses were wasted to represent network ID and direct broadcast address but in case of
subnetting two more IP address will be wasted for each subnet.
Are you getting the point? So the first disadvantage was steps increases for identification.
Second was more IP address wastage wasted.
What could be the third disadvantage?
Obviously you you see here in the network there is no router present inside the network. But here you have to allocate some router or a hub to manage
these subnet. So expense will also
these subnet. So expense will also increase.
So cost of the overall overall network will increase. Subnetting requires
will increase. Subnetting requires internal routers, switches, hubs, bridges which are very costly. Okay. So you need some
costly. Okay. So you need some intermediary device to manage these subnets.
Okay. And one more thing is you require an uh what do I say an experienced network administrator to manage these subnet networks.
Okay. So this also adds to overall cost as well. So expense increases in buying
as well. So expense increases in buying these intermediary things and also an experienced network manager.
Okay. Now how do we create subnets? The
this thing also should be studied that how do we create subnets?
So subnet is created by borrowing the bits from host ID from borrowing the bit from host ID. Are
you getting the point why we are doing so? Let's say we have three bits for
so? Let's say we have three bits for that n ID. I'm just taking an example.
How many subnets I how many networks I can create? I can create eight networks.
can create? I can create eight networks.
Now I want to create more network. What
do I need? I need more bits.
And from where I have to get these more bits from the host ID part. So let's say if I borrowed one more bit then I can
create 16 networks 2^ 4 16 networks.
So if you create one bit if you if you borrow one bit then you can create multiplied by two double of that existing network. For
example here eight networks were there and I borrowed one bit. So now there are total of 16 networks. So the process of borrowing bits from HID
to generate the subnet ID or subnet bits is called subnetting.
The number of bits borrowed depends on our requirement how many subnets we want to create. Okay. Let me give an example
to create. Okay. Let me give an example so that you may understand better. Let's
say this is our network and our network ID will be 200.200.200.0.
Tell me from which class does this network belong?
Class C. Yes, here it is 200.
Okay. So, this network belongs to class C. This will be your NID and this will
C. This will be your NID and this will be your HID in the whole IP address.
Now, I want to create four subnet. How
many bits I have to borrow? Two bits
I have to create four subnets. So how
many bits I have to borrow? Two bits. So
two bits will be for subnets. We call it as subnet ID. So let's say this is the first subnet. This is the second. This
first subnet. This is the second. This
is the third and this is the fourth. How
are you going to represent this? Let's
say this is 0 0. This is 0 1. This is 1 0 and this is 1 1. Are you getting the point? So network ID remains as it is.
point? So network ID remains as it is.
From the host ID, we are going to borrow two bits which will act as the subnet ID. And while we are referring to this
ID. And while we are referring to this subnet, we will write it as 0 0. Network
ID remains the same. 200.200.200
and then the subnet ID remains 0. And
then whatever host we are referring to, we will write it like this. As you know that host ID cannot be all zero. So 1 2
3 4 5. So this will be one. So this is the first host of first subnet.
What about second host? 0 0 0 1 0. What
about third host? 0 0 0 1 1. What about
fourth host? 0 0 0 1 0 0.
I hope you are getting the point. Now if
I want to change the subnet, let's say I want third host of this subnet. This
subnet subnet two. This was subet one.
This was two. This was three. This was
four. What about third host of second subnet? So what I will do for second
subnet? So what I will do for second subnet? It will become 0 1. What about
subnet? It will become 0 1. What about
third host? 0 0 0 1 1. This is it. This is the third host
1 1. This is it. This is the third host of second subnet.
I hope you're getting the point. Okay.
Okay. How many host we can have in a single subnet?
So this will begin from 0 0 0 0 0 1. This is the first and then what will the last? As you know that all
cannot be one. So 1 1 1 1 and 0.
What is this?
What is the number?
All can be if all are if all were one then it will be 2^ 6 minus 1 which will be 63 and the last digit is 0 which
means minus one. So maximum it will be 62. So in in a single subnet in a single
62. So in in a single subnet in a single subnet there are 62 hosts as you know
it should have been 64 but all zeros and all ones are not allowed. So these are now 62 hosts. I hope the point is clear.
Let me repeat everything again so you can understand better.
Let's say this was our this was our network 200.200.200 and I want to create four subnets within the network. Okay, this time let's
the network. Okay, this time let's create just two subnets. So for just two subnets, how many bits I want to borrow from the HID? Just a single bit. So I
bit I borrowed a single bit from the HID.
0 0 0 0 0 1 2 3 4 5 6 7 and 8. Okay. Now
I borrowed a single bit from the HID. So
this will now act as the subnet ID. This
remains the network ID and these are now the host ID. Now you have to remember two things about host ID that all zeros
all zeros and all ones are not allowed.
Why not allowed? because all zeros were used to express the network ID or subnet ID and all ones are used to express the DBA.
That's why all zeros and all ones in the host ID are not allowed. This point is clear. Now if I want to represent this
clear. Now if I want to represent this subnet, how I'm going to represent? You
can write zero. And how are you going to represent this subnet? You can write one. Now if you want to represent some
one. Now if you want to represent some host of let's say the second subnet, how are you going to represent? You will
make this submit ID one and whatever host you are going you are trying to uh represent let's say you are trying to represent eth host how are you going to
represent you will just make eight out of these binary numbers so I have 0 0 0 1 0 0 0 what does this represent 8th
host of second subnet okay how I'm going to represent let's say the 16th host of first subnet so So
for 16th host I'll make this SID as 0 because we are talking about the first subnet and for the 16th host I'll what I'll write 0 0 0 1 0 0 0.
This is the 16th host of first subnet.
If I say I have to let's say there were uh n subnets.
Let's say there are n subnets and I want you to represent the kth host of mth subnet.
N mth subnet obviously m is less than n. How are you going to represent? So you are going to represent k in binary
and you are going to represent m minus one in binary. Why m minus one? Because
subnets start from zero.
You know we represented this subnet from zero because subnets start from zero and host start from one you know because all zeros can't be a host. Are you
getting the point? See here when we represented the eighth host of second subnet we created one here and we created eight here. When we represented 16th host of
here. When we represented 16th host of first subnet we created zero here and 16 here. When we represented
here. When we represented first host of first subnet we created one here and zero here. So when the subnet was one we were creating zero.
When host was one we were creating one.
When subnet was second we are creating one here. When subnet was first we are
one here. When subnet was first we are creating zero here. So when subnet will be m we will create m minus one. And
when the host is k we will create k only. Why so? Because subnet can start
only. Why so? Because subnet can start from zero while host cannot.
Okay, I hope the point is clear. So if
anyone have any doubt, you can ask me.
Let's take another example. Let's take
another example so you'll understand better. Uh this time let's increase the
better. Uh this time let's increase the number of subnet. I want to create let's say 512 subnets.
Tell me how many bits I have to borrow.
It's not eight, man. Think think before you type. Yes. Nine
you type. Yes. Nine
nine bits nine bits we have to borrow. When we
have to create four subnets, we will borrow two bits. When we have to create two subnets, we'll borrow one bit. When
we have to create let's say 1024 subnets, we will borrow 10 bits. 512
will borrow 9 bits. 256 we'll borrow 8 bits. 128 will borrow 7 bits. 64 we
bits. 128 will borrow 7 bits. 64 we
borrow six bits. Okay. So to create 512 subnets we will borrow 9 bits. So let's
let me erase all this and let me draw an example. Okay. So 157.153.0.0.
example. Okay. So 157.153.0.0.
Tell me from which class does this network belong.
Class B. Okay. So in class B these two act as NID and these two elect. That's
why I have told you to remember that table. If you do not know the class, how
table. If you do not know the class, how are you going to segregate the NID and HID part? And if you cannot segregate
HID part? And if you cannot segregate the NID and HID part, you don't know from where to borrow the subnet bits.
Okay. Now you know you have to create 512 subnets. So we are going to borrow
512 subnets. So we are going to borrow nine bits from the HID. So 1573
dot now one whole octate covered. And
from the last octed first bit, how many HID we have? 1 2 3 4 5 6 7 8 bits from here and one bit from here.
Okay, what will be the first host? The
first host will be 1. Second host, it will be 1 Z. So if I have to create Kth host, I'll create K here. Okay. Now
how many host could it be there in a single subnet? Let's say we have so many
single subnet? Let's say we have so many subnets here. In a single subnet maximum
subnets here. In a single subnet maximum number of hosts will be tell me what will be the maximum number of hosts in a single subnet.
Come on man it's not that hard. Try to
think you have been given the HID with this how many how many maximum you can create.
See still some people are typing 128 brother 128 minus 2 why 2 because this is not allowed and 1 2 3 4 5 6 7 this is also not allowed so the answer will be
126 so there will be 512 subnets and in each subnet there will be 126 host you'll
answer 128 when I ask about the addresses because these two are also addresses But they are not not given to host. So when
I ask you address, you reply 128. When I
ask you host, you reply 126.
Okay. Is the subnetting clear or do I need to take one more example?
Is it clear? Okay. Let me repeat it again from whatever I have written. What
is subnetting? Subnetting means you are dividing a full bigger network into smaller network. How are you going to
smaller network. How are you going to divide? by borrowing the bits from the
divide? by borrowing the bits from the host ID part. Okay. And why do we do so?
So that maintenance and administration becomes manageable and we are isolating the network to provide the security part. For example,
if attack happens at subnet 4, subnet one will remain safe.
And what are the problems? The problems
will be identification part become larger.
In the first case we first identify the network and then host. Now in this case in the network we have to identify the subnet also. The second disadvantage is
subnet also. The second disadvantage is more number of IP address will be wasted. And the third will be expense
wasted. And the third will be expense will increase for buying the machinery and experienced network manager. And how
do we do how how do we do subnetting? By
borrowing from the HID.
If we borrow n bits we can create 2^ n subnets.
So for the case if we want to create 512 subnets the n will be 9 bits.
Okay. So from the host ID part we create subnets and that host ID part will act as the subnet ID. Okay. So if I want to refer to the first subnet I'll create
zero. If I want to refer to the 10th
zero. If I want to refer to the 10th subnet, I'll create nine. If I want to refer to 123rd host, I'll create 123 in the binary.
For host, we create the same. For
subnet, we create one less because subnet can start from zero.
Okay, I hope the point is clear.
Anyone have any doubt? You can ask me now.
Hm very valid concern a valid doubt came. So student is asking when we are
came. So student is asking when we are representing the subnet with the help of subnet ID do weights change? Let me
explain what does he mean by this? For
example here, for example here, what is the weight of this? What is the weight of this bit?
this? What is the weight of this bit?
Is this one or 128? So the answer is it will be 128. So when you are going to represent the subnet ID, how are you going to represent the subnet ID?
By this let's say let's say what is the subnet ID of this network.
So you will write 200.200.200 128.
What is the subnet ID of this network?
200.200.200.0.
So is the network ID and the subnet ID of the first subnet same? Let me repeat.
Is the network ID of the full network and the subnet ID of the first subnet is it same? Because here we are getting the
it same? Because here we are getting the same number. This is 200.200.0
same number. This is 200.200.0 and this is again 200 200.200.0.
Did you get it?
Let me explain again. Let me explain again with a proper diagram.
Let's say we have divided a full network into two parts. 200.2 four parts 200.200.200.0.
Okay. This is the first subnet, second subnet, third subnet and the fourth subnet.
Okay. And to divide a full network into four subnets, we require two host IDs.
Two host ID bits. So
SID this these two host ID will will act as the subate ID and the remaining six bits will be the host ID. So this will act as the host ID. 0 0 and the 6 bit
HID. This will act as the 0 1 and the 6
HID. This will act as the 0 1 and the 6 bit HID. This will act as the 1 0 and 6
bit HID. This will act as the 1 0 and 6 bit HID. And this will act as a 1 and
bit HID. And this will act as a 1 and again the 6 bit HID. Now what is the
weight of this? 128 64 128 64 128 64 and 128 64 So what will be the subnet ID of this
zero? What will be the subnet ID of this
zero? What will be the subnet ID of this 64? What will the subnet ID of this 128
64? What will the subnet ID of this 128 and this 192? How 192? 128 + 64 and the rest will
192? How 192? 128 + 64 and the rest will be zero. for the subet ID network ID
be zero. for the subet ID network ID remains as it is network ID and SID remains as it is and host ID will become zero okay that's why
we ignored this part and we only calculated the ID from here okay so let's uh let discuss more about the properties of first subnet so in the
first subnet subnet ID will be 200200200.0 0. Okay. What will be the DB of this? Do
0. Okay. What will be the DB of this? Do
you remember how we calculated the DBA?
Yes, correct. Correctly.
They will remain as it is and the host ID will become one. So the first subnet subnet ID will become this. And what
about the DB?
200.200.200 0 and the rest will become 1 2 3 4 5 6.
And if you have continuous six ones from the right what will the value 2^ 6 - 1 become 63. So I can erase all this and I
become 63. So I can erase all this and I can just write 63. So this will become the DVA. Okay. Now calculate for the
the DVA. Okay. Now calculate for the second subnet.
What will be the subnet ID and what will be the DVA? Tell me.
Yes. Subnet ID 64 200.200 200.200.64 and what will be the DB?
200.200.200 plus 64 + 63 which will become 127. Why
we add it? Because they all will become 1 and the value of six bits continuous one is 63 and 64 from here 64 + 63 this will become 127. Okay. Now what about
third subnet SID and DVA?
Here is the third subnet. What about it?
The subnet ID is 200.200.200 128 from here.
And what about the DBA? 128 + 63 will become 191. This will remain same.
And you can similar similarly do for the fourth subnet SID and DB.
I hope the point is clear now.
Is the doubt clear about the weights?
So if anyone have any other doubt you can ask now.
Okay. So
consider this as homework. You solve
like this and I'm also giving you a DPP.
Try to solve. Ask if any doubt you have in the next lecture. And please I'm hoping that you're solving the DPP and making the notes. Although I have also given you solutions within the DPP. But
you have to first solve your own and then see the solution. And even if you don't understand the solution, you ask in the next lecture.
Okay bye.
Let's begin.
IPv4 addressing.
Here we have studied that we have an IP address of 32 bits and out of these 32 bits we divide it into NID and HID. And
sometimes we have to break the network into smaller sub networks. And how do we do that? By borrowing few bits
do that? By borrowing few bits from HID, we call those bits as SID, subnet ids. So we have learned about the
subnet ids. So we have learned about the network mask.
Network mask. In network mask, the number of ones indicate the network ID and number of zeros indicate the host
ID. What about subnet mask? Subnet mask.
ID. What about subnet mask? Subnet mask.
Here the number of one represent network ID plus host ID plus subnet ID and the number of zeros
represent host ID.
Okay. So let's say if I say 200 200 200.0 this is the network ID and I have a
subnet mask of 255.255.255 255 dot let's say 192 this is the subnet
mask then identify the number of bit borrowed from borrowed from host ID
tell me the number of subnets and also tell me the number of hosts per subnet this is an easy question All right,
most of you have answered correctly. The
number of bits followed are two. How?
This is a class C address. So, class C have three octates.
Three octates for the network ID part and the remaining for the host ID part.
And this is a subnet mask which means the number of ones will include network ID plus subnet ID. Now if you expand
like this 255.255.255 and 192 in binary 1 1 and then 1 2 3 4 5 6.
This is now the network ID plus subnet ID part. And as you know this is of
ID part. And as you know this is of class C. So network ID will be this and
class C. So network ID will be this and these two bits will represent the subnet ID and two bits are representing the subnet ID which means there will be four
subnets.
If there are four subnets then six bits will be used for host ID part. So the
number of host per subnet will be 2^ 6 - 2. Why two? Because all zeros and all
2. Why two? Because all zeros and all ones for the host ID are not allowed. So
the answer for number of subnets will be four and host per subnet will be 62.
Is it clear?
Is it clear? Okay. But let's explore it more for subnet ids.
See this 200.200.200 dot and then we have two bits for the subnet ID.
These are for the network ID and remaining six bits for host ID.
H ID. Now the weight of this is 128 and the weight of this is 64. So when you will write like this 200.200.200
192 which means you're talking about the fourth subnet ID.
Why? Because this is 1 one. It's forming
three which means fourth subnet ID.
If it was 0 0 which means it's forming zero which means first subnet ID.
What about 0 1? It's forming zero which means second subnet ID 1 0 forming two which means third subnet
ID.
Okay. So 200.200.200
dot 0 will be the first subnet ID. 64 will
be the second subnet ID. Then 128 will be the third subnet ID and then 192 will be the fourth subnet ID. I hope the
point is clear. Okay. So I have to focus upon the weight.
Is it clear? Do you have any doubt?
What if what if I changed the number from 192 to let's say 224? Then the
number of bits borrowed will be three.
The number of subnets will be eight and the number of host will be as you know three bits are borrowed from the eight bits of HID which means five bit are now remaining for the host ID which means 2^
5 - 2 which means 30 hosts per subnet.
Is the point clear? And here in this case 1 2 3 which means the weight will be 128 64 and then 32.
Now tell me the first subnet ID 0. The
second will be 01 which means 32. The third will be which means if I say the third subnet ID which means you have to form here two.
In binary you have to form two which means 64. What about fourth? Which means
means 64. What about fourth? Which means
you have to form three here which means 1 1.
What does it mean? 96. And then 1 0 0 which means 128. And then 101
160 and then 11 1 0 which means 192 and then 11 1 2.
First subnet, second, third subnet ID, fourth subnet ID, fifth subnet ID, sixth subnet ID, seventh and then eighth subnet ID.
You have to focus upon the weights of the SID bits.
Is it clear?
Do you have any doubt to ask?
Now you know it is not necessary that these subnet bits should be contiguous.
Are you getting let's say if I write here like 40 44 then when you will convert it into binary what you will see? Let's solve
here 200.200.200.0.
This was our network ID and the subnet mask let's say it is 44. This is our subnet mask. Now answer me the same
subnet mask. Now answer me the same question. Number of bits borrowed
question. Number of bits borrowed number of subnet possible and host per subnet.
Try to answer.
What will the first step that you will do? You will convert this 44 into binary
do? You will convert this 44 into binary which will be 0 0 1 0 1 1 0 0.
Let's check this is 12 and this is 32.
So 32 and 12 will be 44. Okay. Now in
subnet mask number of ones will represent the network ID and subnet ID.
What will be the network ID? This is a class C address. So network ID will be this which means these are the these ones.
These ones are the subnet ID. Now again
you have to focus on the weights. So
what is the weight of this? Four 8 and then 32.
Number of bits borrowed will be three.
Number of subnets will be eight and number of host will be again 30. But
what will be the subnet ID of these eight subnets? Can you can you tell me? You
subnets? Can you can you tell me? You
have to focus on the weights. 32 8 and 4 0 0 0
1 0 1 0 0 1 1 0 0 1 0 1 1 1 0 and 1 1.
Now what will be the ID of the first subnet? 0. Second subnet four. Third
subnet? 0. Second subnet four. Third
subnet 8. Fourth subnet 12. Fifth subnet
32 and then 36 and then 40 and then 44.
Is it clear? So you don't generally do like this that the first three contiguous bits will be taken. No, you
have to focus upon the subnet mask. In
subnet mask, the number of ones will be representing NID plus SID. And then look at the NID. It's a class C address. So
in subnet mass the first three octate will be covered by the NID and the remaining ones. What are the remaining
remaining ones. What are the remaining ones? These are the remaining ones in
ones? These are the remaining ones in the last update. They will be covering the SID.
So wherever be the position of these ones, we have to incorporate the weights also.
Okay.
Do you want to take another example?
Let's see what about 255.255.255 dot let's say 200.
Now tell me the same number of bits borrowed number of subnets and host per subnet. What you will do again? Convert
subnet. What you will do again? Convert
it into binary.
These are all ones. One.
These are all ones. Now what about 200?
You will need 128. You will need 64. And
then you will need eight.
Is this 200? This will become 192 and this will be 8. So yes, it is 200. Now
look at the position of ones. 1 2 3. So
three bits are borrowed. 8 will be the maximum subnets and then 30 will be the host per subnet. But what about subnet ID? Now again think of the weights. What
ID? Now again think of the weights. What
are the weights?
128 64 and 8. And then the same again. 0
0 0 1 0 1 0 0 1 1 0 0 1 0 1 1 0 and then 1 1
1 0 8 64 and then again 72 and then 128 136
192 and then all will be added which is 200.
This is the subnet ID of the first subnet.
subnet ID of the first subnet and this is the subnet ID of the eighth subnet.
You can also look here. So when you're talking about eighth subnet, you're forming seven in binary.
Why? Because they started from zero.
Is it clear?
Okay, I think this pattern is clear to you. Let's uh explore some other
you. Let's uh explore some other patterns.
Let's say we are given a class C network. Class C network is given to us
network. Class C network is given to us which has seven subnets and 25 hosts per subnet.
Now you have to create a subnet mask for this.
Create a subnet mask for this. And you
know it is not necessary that subnet mask need to be unique.
Why? Because position of ones can be anywhere.
Position of ones can be anywhere. Let me
explain.
Class C network 7 into 25. There are
seven subnets and each subnet has 25 host. What is this? The value is 175.
host. What is this? The value is 175.
Is it lesser than the available network in class C? What is the available not network but host? I require these number of host.
Is it lesser than the available host in a network of a class C? Yes,
this is 256. So 175 is lesser than 256, which means we can create some subnet mask. If it if it would be like
mask. If it if it would be like something like this, then subnet mask would not have been possible.
Okay.
Now as we are talking about class C network so 24 bits will be for the NID and 8 bits for the host ID part.
Okay. And we have to create seven subnets which means we will require three host ID bits.
With three host ID bits we can create eight subnet and we'll need seven only.
So yes it is feasible. If we have taken only just two HID then we we would have been created we would have created four network but we need seven. So this is not feasible that's why we have to take
three.
So with this eight HID bits three bits will be used for subnet ID and five bits will be used for host ID again.
Okay. Okay. So it will look like this.
One, two parts divided, four parts divided and then how many?
6 and 7 8. We will not use this. So 1 2 3 4 5 6 and 7.
Each subnet will have maximum capacity of 30 host. But we need only 25. That's okay. That's okay. So
only 25. That's okay. That's okay. So
first host first subnet how are you going to represent with 00 0. Second subnet
0. Second subnet 0 0 1. So you can write it here. Let me
remove this all.
0 0 0 1 0 1 0 0 1 1 0 0 1 0 1 and then 1 1 0. We don't
we do not require this 11 one. Okay.
Now number of ones number of ones in the subnet mask will be network ID plus subnet ID. What is
the network ID? 24. What is subnet ID?
Three bits. So 24 + 3 equals to 27. and
number of zeros number of zeros in subnet mask will will be represented host ID this is five so
what you can do 255 8 are covered 255 16 are covered now again 255 24 are covered how many we
require 27 then three more 1 2 3 now the rest could be the host ID Why I said in the beginning that subnet mask could be multiple because the
position of these three one need not to be contiguous. So I can also place
be contiguous. So I can also place eight. I can also place these ones like
eight. I can also place these ones like in this manner.
This is also a subnet mask a valid one.
I can place like this also one one. This
is also a subnet mask. So submit mask is not unique but you know the most appropriate one will be this one when these three ones are from the left hand
side and contiguous.
Okay. So what will be the submit mask?
255.255.255.224.
This will become the subnet mask. Let me
repeat again what we did.
We needed a class C network or we had a class C network with seven subnets and 25 host per subnet and we need to find the subnet mask. So firstly we check
that is it possible to create such subnet mask. So we did 7 into 25 from
subnet mask. So we did 7 into 25 from here to calculate the number of host subnet to subnet canceled. So this was
seven subnets and 25 host per subnet.
So 25 into 7 host are remaining. So 175
host are there in a single network of class C. Is it feasible? Yes. Why?
class C. Is it feasible? Yes. Why?
Because the maximum could be 256 and 175 is less than 256. So this is allowed.
Now what we what we are doing? We have a class C network. 24 bits will be for the NID and 8 bits for the HID by default.
Now we need to create seven networks.
Seven subnets.
will require three host ids. So from
eight host ids we'll borrow three bit to make them as subnet id and the remaining five will become the host ID.
So from the remaining five 2^ 5 - 2 which means each subnet will have 30 host and we require 25 that's again
feasible. So from this three bit we have
feasible. So from this three bit we have to borrow from the host ID part. So
number of ones in the subet ID will be NID plus SID. Three bits we have borrowed from the host ID part. So these
three will be also one. So 24 + 3 equals to 27. Now 27 bits need to be one in
to 27. Now 27 bits need to be one in subnet mask.
Initial 24 bits are one and then three or three more needed. So from the last update any three bits can be one.
Okay. So this will create a valid subnet ID but the most appropriate one will be when you are making those bits one which are from the left hand side and continuous.
Is it clear? So I could als I could have also done like this 0 0 0 1 1. So 7 is also allowed. 224 is also allowed. You
also allowed. 224 is also allowed. You
know 44 will also be allowed. 41 will
also be allowed. You can check they they all include three ones.
Okay.
Is it clear? Let's solve another question. This time we have a class B
question. This time we have a class B network. We want 180 subnets
network. We want 180 subnets and let's say 200 host per subnet.
Create subnet mask.
try to solve. What we'll do? What will
be the first step? We'll check for physibility. So check whether 180 into
physibility. So check whether 180 into 200 is less than the number of hosts in a single network of class B.
180 into 200 is it less than 2^ 16 - 2?
I told you to remember the value of this 65535.
6 it is 65536 but when you will subtract it will become 65534 and this is this is very less this is
just 36,000 this is around 65,000 and this is 36,000 perfectly feasible now let's see in a class B
network we have 16 bit for the NID and 16 bit for the HID how many subnets we want we want 180 subnet. So for 180
subnet, how many bits will require to borrow from the HID? See, if we borrow just two bits, we'll create four subnet.
If we borrow four bits, we'll create 16.
If we borrow six bits, we'll create 64.
What about seven bits? Just 128. 8 bits,
256. Yes, 256 is greater than 180. So we
have to require eight bits from from the HID to make them subnet ID and remaining eight will become the host ID. So the
initial initial ones 255.255 this will be consistent in any subnet mask. Now we want eight more bits out of
mask. Now we want eight more bits out of the out of the remaining two octates to be one. Now these eight bits could be
be one. Now these eight bits could be placed anywhere.
They could be placed anywhere. So
these eight bits they could be from the last octed also all of them and then let this be zero.
So this will become the HID now and this will become the SID now. Are you getting the point? Subnet mask are not unique.
the point? Subnet mask are not unique.
They could be different. So what is the most appropriate one? When you start from the left hand side and keep the ones continuous.
Now this will become the SID and this will become the HID and then zero. This
is the most appropriate one but these are also correct dot 0.255 you can also divide among the two
updates like four from here four from here 240.240 like this this is also correct you can also make
it like this 255.255.25 25 tot six from here and then two from there 192 and then 252.
So multiple could be possible. It's just
the arrangement of ones where you want to arrange 8 ones when you are given 16 available positions.
Okay, is the point clear? Let's solve another question. Uh let's pick up a class C and
question. Uh let's pick up a class C and we have we want 15 subnets and we require 20 host per subnet.
Create a subnet mask for this. Now you
have to solve this and I'll be waiting for your answer.
Perfect, perfect, perfect. All of you have written not possible. Why? 15 into
20 will be 300 hosts. But in a network of a class C only 250 four hosts are available. So this is not
possible.
Not possible.
Are you getting the point?
Okay, should we move forward?
Okay, let me give you another question.
Suppose again a class C network and this time I want three subnets and in the first subnet I want 60 host and in the second subnet I want 60 host
and the third subnet I want let's say 120 host.
Can you create a subnet mask for this?
Let's check 60 + 60 + 120 which means 240. Is it less than
240. Is it less than 254? Absolutely yes. So this is feasible
254? Absolutely yes. So this is feasible which means subnet mask is possible.
Subnet mask is possible.
Now you have to think in how many subnets we have to divide three subnets which means we have to divide it into four ones because there is no uh we have not learned how to divide into three subnets. Either we will borrow one bit
subnets. Either we will borrow one bit or we will borrow two bit. If you borrow one bit, it will be divided into two. If
you borrow two bits, it will be divided into four. So we will have to divide it
into four. So we will have to divide it into four subnet.
So if a class A network is divided into four subnets, how many host will each subnet would have just 62 host.
Okay. So this 60 could be allocated here. This 60 could be allocated here.
here. This 60 could be allocated here.
But what about this 120?
No, not possible.
That's where a new concept VLSM comes into picture. Variable
into picture. Variable length subnet masking. Variable length
subnet masking. How we are going to solve this.
See here we will go step by step. We
will go step by step. So actually how do we do subnetting? We borrow
from the HID part.
Let's say we have uh class C address. So 24 bits for the NID and 8 bits for the HID part. Okay. Now
what do I do? Instead of this HID instead of borrowing two bits directly I'll first borrow one bit. So one bit given for the SID part and the remaining
seven bits given for the HID part. Now
when I borrow one bit the whole network will be divided into two parts.
To represent the first network I'll use zero. To represent the second network
zero. To represent the second network I'll use one. Now I have seven bits to represent the host among these these subnets.
Okay.
So how many host will be there? 2^ 7 - 2. This will be 128 minus 2 which means
2. This will be 128 minus 2 which means 126. So 126 host will be present here.
126. So 126 host will be present here.
126 will be present here. Now what we are doing we are allocating the third one 120 with 120 host here
and we will assume this now as our network to focus.
We will consider this as HID now and now we are we want to divide it into again two parts. So we will borrow again from
two parts. So we will borrow again from here. So after seven bit one bit given
here. So after seven bit one bit given to SID and six bit will be remaining to us for
HID part. Now I will address now I will
HID part. Now I will address now I will address wait a minute one was fixed here. So and we are fixing
another W. So I'll address this with 1
another W. So I'll address this with 1 zero and the third one with as 1 one.
Now we have six bits remaining with us.
6 bits and six bits how many host will be there 2^ 6 - 2 which means 64 - 2 which means 62 host 62 host will be present here 62
will be present here how much we require we just require 60 and 60 so we will allocate them let me explain the whole thing again
what we are doing we have a class C network we want to divide it into three subnets First subnet will have 60, second will
have 60 and the third will have 120.
These many host per subnet I want.
So if we are directly borrowing two bits the whole subnet will be divided in the whole network will be divided into four
subnets each with 62 62 62 and 62 host.
Now what about 120? That's why this method is not feasible. What we will do?
we will borrow one by one.
So first we will fix one bit and I've told you in the first lecture that if we have n bit and if you borrow if you fix
the initial k bits then the network is divided into 2^ k parts. So if I'm fixing just one bit then the network will divided into two parts. So I fixed one bit and the network is divided into
two parts. I'll address the first part
two parts. I'll address the first part with zero and the second part is one.
Now I want to divide more this part. So
what I will do I'll bit I'll fix one more bit and I will address the first part with 1 zero and the second part with 1 one.
Is it clear?
So in this manner we will subnet of variable length. Now I have seven bits for this subnet which means 126
host per subnet. I have six bits for these two subnets which means
62 host per subnet. Is it clear?
You can also do like this.
Divide 0 1 and then you divide the first part into two halves. Fix again. Address the
first one with zero and the second one with one. This is also visible. This
with one. This is also visible. This
will have 62 62 and then 126. You assign
60 here, 60 here and then 121 here.
Suppose we are given with this time IP address 200.200.200 200 dot 126
and we are given with subnet mask dot 255 and then 192.
This time you have to tell me what is the subnet ID? What is the subnet ID and what is the host ID?
We have been given an IP address of a host from some subnet and subnet mask is given. Now you have to tell me from
given. Now you have to tell me from which subnet this host is.
You have to tell me the subnet ID and what is the host ID of this host.
Okay.
So first of all you will convert this 126 into binary. 0 1 1 1 0
and then 192 to binary 1 1. and then 1 2 3 4 5 6. Okay. Now
we are given with the IP address of class C which means three octate will be for the NID and two octate will be for the HID part. So from subnet mask 3
octate which means 255.255.255.
This is the NID part and this will 192 1 and then 1 2 3 4 5 6. This will
include the HID part. But now this is subnet mask not network mask. Which
means these two are SID and the remaining ones are HID.
Okay. So if these two are HID which means >> which means these two bits will give me the subnet ID which tell me from which
subnet does this IP belong. So 01 will be the subnet ID which means subnet ID will be 200.200.200 dot
01 and the rest as you know in subnet ID host ids are all zero. So this will become 64. So this is the subnet ID.
become 64. So this is the subnet ID.
What about host ID?
What about host ID?
You can calculate host ID from here also like this is what subnet ID was. So this will become the host ID. What is the host ID?
This is 62. You can also calculate like this that host ID equals to IP address
minus subnet ID. This is simple. This
was the full IP address.
which included SID plus HID.
So HID will equals to IP address minus SID the last octed. So what is the IP address last octed? 126 versus what is the SID? 64. So this will also give me
the SID? 64. So this will also give me 62.
So these are the methods from which you can solve. You can also do like this IP
can solve. You can also do like this IP address and bitwise ending obviously net mask.
What does this give me? Tell me in the chats.
Network ID. Yes.
What does this will give me? IP address
and subnet mask. This will give me SID. Yes. Subnet ID.
SID. Yes. Subnet ID.
So you can solve also like this that IP address was 200.200.200.011.
011 1 1 1 0 and what was the subnet mask?
255.255.255 255 192 which means 1 one and then rest 0 1 2 3 4 5 6. If we do the bitwise ending
this will remain same 200 same 200 200 and then so this will give me zero and then one
let me solve properly 0 1 again 0 then zero then zero then zero and then again 0
and then again zero. So this will give me 64. So what was subet ID
me 64. So what was subet ID 64.
Okay. Now you can solve like this. H ID
equals to IP address minus subnet ID which was 126 and subnet ID we just calculated 64. So this will give me 62.
calculated 64. So this will give me 62.
So HID will be 200 200.200.62.
Simple answer.
Okay.
Now another question if you are given with let's say subnet mask then can you tell me the number of subnets?
Can you tell me the number of subnet?
For example 255 255 255 224. Can you
tell me the number of subnets?
People are spamming eight but eight could be the wrong answer. If I
say the class is B, how did you already assume that this will be the N ID? I have not mentioned the class. So if only subnet mask is
the class. So if only subnet mask is given and you have been asked the number of subnets, then it is necessary that class must be mentioned otherwise you
won't be able to solve. See like this for class B this will become the NID and this will become the SID plus HID.
So how many subnets now? 8 and then three 11 bits. So 2 raised to power 11.
But if you just change the class to C then this will become an ID. This will
represent SID plus HID.
Three bits for the HID, five for the three bits for the SID, five for the HID. So 2^ 3. Now 8 is the answer when
HID. So 2^ 3. Now 8 is the answer when the class is C.
Okay.
So if subnet mask is given and you have to mention the number of subnets, you cannot if class is not present. But you
can mention the number of IP address per subnet.
This you can surely mention just with the help of subnet mask. Let's say
255.255.255 240.
240 means four ones and then zeros. Now
can you mention the number of subnets?
No. Because you do not know the class.
You do not know whether you have to consider this as an ID, this as an ID or this as an ID. Okay. Question number
two. Can you mention number of IP address per subnet?
Yes, you can. With the help of these zeros, with the help of these zeros. So, how
many IP address? 2^ 4.
You have four bits.
Four bits.
That's why 2^ 4 IPs can be possible. How
many number of host per subnet?
2^ 4 - 2 number of subnets now I'll ask you number of subnets in class A number of subnets in class B number of
subnets in class C consider this as homework okay I've just discussed how to do it everything clear you can don't consider this as homework
this is too easy you can directly solve of 2^ 20 and then 2^ 12 and then 2^ just four.
Okay.
Okay. Now let's solve some other type of questions. For example,
questions. For example, if you have been given DBA direct broadcast address like 200.200.20031 20031
and out of the given subnet mask can you tell me which will become the or which is a valid or appropriate subnet mask.
How will you do it? Let's say I've given you four subnet mask uh 255.255.255 192 and let's take just one another
option or let's take it three options 255.255.255.224 224 and then 248.
Now out of these three which one or which of them are valid subnet masks?
First of all tell me what DBA represents.
DBA represent that NID plus SID will remain as it is and HID will be all ones.
Okay.
Now if you convert it into binary, what is 31? 31 is 2^ 5 - 1, which means
is 31? 31 is 2^ 5 - 1, which means 1 2 3 4 5. These are all ones and then three zeros.
Now from here these are the HIDs which are all ones and this part will be NID plus SID.
Now HID could be maximum of five bits which means I can write like this HID
should be less than 5 bits. Now if you consider this submit mask like 192 in that case 255 or I can just write
this 1 and then 1 2 3 4 5 6.
In that case, HID is six bits, which is not the case. HID must be less than five bits. So, this is wrong. What about this
bits. So, this is wrong. What about this 224? 1 2 3 1 2 3 4 5. Here I is 5 bits.
224? 1 2 3 1 2 3 4 5. Here I is 5 bits.
Correct. What about this? 1 2 3 4 5 HD is three bits. Correct. Again.
So in whichever subnet mask HID is less than five bits that subnet mask is valid.
If I have given you something like this 255.255.255 and then 240 is this valid 1 2 3 4 1 2 3
4 just four bits while the maximum allowed is 5 bits. So yes it is valid.
Is the point clear?
Let's solve another question.
If the DB of a network is 168.17.7.255, what could be the network mask?
What could be the network mask? See,
this is a class B. This is class B address. So, this will be NID and the
address. So, this will be NID and the remaining will be SID plus HID. So if I want to convert 168 17 and then 7 will
be 1 2 3 4 5 1 2 3 this is 7 and then 1 2 3 4 1 2 3 4 this is 255.
So what is SID here?
This is SID and these continuous ones from the right hand side will be the HID. So what is the maximum value that
HID. So what is the maximum value that HID can reach? 1 2 3 4 5 6 7 8 9 10 11 bits.
So in whichever subnet mask in whichever subnet mask HID is less than 11 bits that is a valid mask. Let's see
255.255.248.0.
Now check is HID less than 11 bits. What
is 248? Five bits from the left hand side. 1 2 3 4 5 and then 1 2 3 1 2 3 4 5
side. 1 2 3 4 5 and then 1 2 3 1 2 3 4 5 6 7 8. This is exactly 11 bits. So this
is valid. What about let's say 252?
Again valid. What about 254? Again
valid. What about 240? Will that be valid? 1 2 3 4 1 2 3 4 and then 8 bits
valid? 1 2 3 4 1 2 3 4 and then 8 bits from here. So 8 and then four 12 bits
from here. So 8 and then four 12 bits greater than 11 bits. So this is not valid.
Are you getting the idea? These ones
must be continuous from the right hand side. For example, if this one is not
side. For example, if this one is not here, if something is like this
1 1 0 0 1 1 in that case, in that case these two ones won't be considered only contiguous ones should be present
from the right hand side. those will be considered in the HID and in whichever subnet mask HID is less than these number of HIDs that will be the valid ones.
Is it clear?
Now what about the opposite? If you are given with subnet mask and you have to find out the DBA.
See here suppose the subnet mask is 255.255.255.240.
Now among these options what could be the DBA
200 or 200 uh or 56.78.31 and then here 200.56.7815 and then 200567810
and then 200 5678 and then 47. Try to do it.
What's the first thing you're going to do? Convert this into binary. 255 255
do? Convert this into binary. 255 255
255 and then 1 2 3 4 1 2 3 4.
What does the subnet mask represent? It
represent that NID and SID will be ones and HID will be zeros. So what are the HID here? These are the HIDs.
HID here? These are the HIDs.
These are the HIDs. So in whichever DBA in whichever DBA there are four ones contiguous from the right hand side those will be the valid ones those will
be the valid ones in 31 is it valid 1 2 3 4 5 ones is 15 valid 1 2 3 4 just four ones and four is needed so yes yes is 10 valid it's 1 0 1 0 so it's not valid is
47 valid uh we need to convert it so what is 47
32 2 or 15 and then 32 I guess. So 0 0 1 0 1 1 1 again four ones. So yes it is valid. So
this one was not valid. Are you getting the point? How did we do? Let's solve
the point? How did we do? Let's solve
another question. What about 248? So in
248 1 2 3 4 5 and then 1 0 0. So they
will become the NID plus SID part and the number of zeros will represent the HID part. So HID is three bits. So in
HID part. So HID is three bits. So in
whichever DBA last three ones from RHS there are continuous three ones then those are valid. For example uh let's take some big numbers
135 240 207 231. For 135 how are we going to convert 135 into binary? will
be 1 0 0 0 and then I think we're going to need seven from the end. Yes. So
again three bits included 240 1 and then not is it valid? 1 1 and then 15 from
the end 11 1. So this is again valid. Is
231 valid? I'm going to need 128 64 32 and then 111. So this is also valid.
Did you get it?
Okay.
Now you remember the diagram in where we made like this. We have a router in between to manage the subnets. Let's
focus on that. How the router manages to which subnet it has to forward the packet. So let's say this was our
packet. So let's say this was our network 200.200.200.0.
This is the NID and this is the HID.
Okay. Now I want to divide it into four subnets. Let's we divide it into four
subnets. Let's we divide it into four subnets. 0 0 1 1 0 and then 1 1
subnets. 0 0 1 1 0 and then 1 1 6 bits 6 bits 6 bits 6 bits. So host per
subnet will be 2^ 6 - 2 which means 62.
So each one has 62 subnets.
So not subnets hosts. And
what will be the range if I ask 0 to 63 while 0 and 60 are not allowed? 0 and 63 won't be allowed. In between them there are 62
allowed. In between them there are 62 numbers. So they will be assigned to the
numbers. So they will be assigned to the hosts. for there each one has 62. So
hosts. for there each one has 62. So
again 64 to 127 and then 128 to I guess 191 and then 190 2 to 250 255.
Let me draw neatly.
0 to 63 and then 64 to 127, 128 to 191 and then 192 to 255.
This was 0 01 10 1 0 and 1.
Okay. 6 bits for HID, 6 bits HID, 6 bits and again six bits.
What will be the subnet mask? As you
know you have borrowed two bits. So
subnet mask will be 255 255 255 and then 1 and then 1 2 3 4 5 6. This is what 192. So I will direct directly write
192. So I will direct directly write 192.
Okay. Now what happens? There is a routing table. There is a routing table
routing table. There is a routing table which has network ID, subnet mask and interface.
So we have a router in between which has a routing table. network ID, subnet mask and interface. So let's say the network
and interface. So let's say the network ID will be 200 200 200 and then zero and subnet mask will be 255.255.255.1
255.1 192 and interface will be let's say A interface will be let's say A which means we are sending it to here A
B C D and there is one default route also E.
Now you remember that in class A addresses we have given this one as default route or DCB client that's
why we have not use this as a network default route.
Now you will understand in a few minutes why we are using this default route.
Let's say interface is a then we have some other 200.200 network ID 64 for this. What is the network ID of this
for this. What is the network ID of this subnet? 64. For this 128 for this 192
subnet? 64. For this 128 for this 192 for this it was zero. So 64 I'll just directly write 128 and then 192. What
will be the submit mask? They will
remain the same.
Okay. Now what about the interface B C and then D and for default route let's say E. Okay. Now what happens? A
packet comes to the router from the outside network with a destination IP of 200.200.200.160.
Now at which interface this will be forwarded at which interface this will be forwarded. Are you getting the point
forwarded. Are you getting the point what I'm trying to do here? We have we have divided a full network into four subnets with different subnet ID. We have
divided a network. This was a network 200.200.200.0.
This was our network. We have divided this into four network with a ID of 200 200 200 and then zero. This was the first subnet and then second subnet 200
200 200 and then 64 and then the third subnet with 128 and then the fourth subnet with 192. We
have divided our network into four subnet and the subnet mask is 255 255 255 and 192. This was the subnet mask.
How 192? Because we have borrowed two bits for the four networks, four subnets. Now what happens?
subnets. Now what happens?
A packet from some outside world comes to the router with a destination IP of 200.200.200.160.
So in which subnet does the router have to forward the packet?
In which subnet does the router has to forward the packet? Now what you may be thinking is we can check for the range.
While 160 lies here. So it must be forwarding the packet to interface C. Is
this logic correct? Yes, it is correct.
It is absolutely correct. But what is the formal way to do this? we do the bitwise ending of destination IP
and subnet mask. This will give me the NID destination IP and submit mask.
Let's say this is the destination IP and the subnet mask is 255.255.255.192.
Now if you do the bitwise ending of these two, what will you receive?
You will get 200.200.200 200 and only the first one will be matched which means 128. What is 128?
128 referring to interface C.
128 referring to interface C. Did you
get it? How did we or how does how does the router check at which interface it has to forward?
Okay, you can either calculate the range or you can just do a bitwise ending between whom? between destination IP and
between whom? between destination IP and subnet mask and whatever be the NID you have to match it you have to match it with the interface.
Now sometimes what happens is that when you do the ending of destination IP and subnet mask multiple NIDs are matched in that case
you will forward the packet with the subnet mask which has maximum number of ones. In this case it was the same. The
ones. In this case it was the same. The
subnet mask was same. What if the case in which subnet mask are different and multiple nids are matched? In that case you will forward it to longest subnet
mask.
Okay let's take an example so that you can understand better. longest subnet
mask case.
We have a routing table which have an ID, subnet mask and interface at which the router is going
to forward if N ID matches. Now you will be given destination IP. Let's say it is 128 754316.
Okay. Now what have you have to do?
Do the bitwise ending of destination IP and subnet mask. Let's do this.
We'll begin with let's say 128 75 43 16 and 255 255 255. So this this will give you the same one as we are ending with
255. So whatever number you end with 255
255. So whatever number you end with 255 same number will be returned. So this is 128 and this is something like 192. This
is clearcut wrong. So it won't be forwarded to interface 3. What about
the second one like 128? So this will be 255 255 255 and then 128.
So this will be zero obviously because this is one here.
And this is one at the beginning. So
they ending both of them will be zero.
And then this will give 128 75 43. As
you are ending with 255. So same will be return. So is this matching? Yes, it is
return. So is this matching? Yes, it is matching. 128 75 43. 128 75 43. It
matching. 128 75 43. 128 75 43. It
matched. Is it matching? You know it will be matched. Why? Because this is zero. If you and any number with zero,
zero. If you and any number with zero, zero will return. So 128 75 43 128 75 43. Now two nids are matched. So it
43. Now two nids are matched. So it
could be either forwarded to interface 0 or one. How what is the deciding factor?
or one. How what is the deciding factor?
The longest number of subnet mask. The
longest subnet mask.
What is the longest subnet mask? Which
has the more number of one?
More ones. So this has more ones. So it
will be forwarded to one.
So what have we learned in this example?
We have a routing table which has N ID, subnet mask and then interface and you will be given with a destination IP.
What you do? You do the bitwise ending of destination IP and subnet mask and whichever NIDs are matched you are going to note that and corresponding to them those NIDs whichever NID has the largest
subnet mask you will forward the packet to that interface.
Okay. You can also write a rule here like start checking with the largest subnet mask. Let's move on to the last category of subnetting. Suppose
we have two networks connected by a router.
This is network A and this is network B.
Let's say A is present here and we do not know where B is present in A's network or in some other B's network.
Let's say. So what are we going to do?
We have IP address of A and subnet mask of A and we have IP address of B. What
are we going to do? You know that doing bitwise ending of IP address and subnet mask is going to return me with N ID. So
I will do the bitwise ending of IP address of A and subnet mask of A. So I
will receive N ID of A with respect to A.
And if I do the bitwise ending of IP address of B with respect to the subnet mask of A or with the subnet mask of A, I will get the N ID of B with respect to
A.
N ID of B with respect to A. Now if
these two are same then A assumes A assumes that B is present in the same network and if are not same then A assumes
that B is present in a different network in different network.
Same could be done with B. Let's say if if you have been given like this IP address of B ending with subnet mask of B then you are going to receive the network ID of B
with respect to B. And here IP address of A subet ending with subnet mask of B then you're going to receive the N ID of
A with respect to B. And if both of them are equal which means A B assumes B assumes that A is present in the same network. And if not then B assumes A is
network. And if not then B assumes A is in the different network.
Well, this is not commonly asked. It's
it's not of that importance but you should know how they check whether uh it's present in same network or in the different network. Just we have seen an
different network. Just we have seen an example. Let's say you want to buy a
example. Let's say you want to buy a cake.
This is let's say 10 piece cake. This is
seven pieces and this is two pieces. And
you want to buy three piece cake. But
the shopkeeper has already divided the cake into these three parts. Now you
cannot buy just two piece cake because you want three pieces.
So what you're going to do buy the seven piece cake, waste the four pieces and keep the three pieces.
In this case four pieces are being wasted. So you do not go to that shop.
wasted. So you do not go to that shop.
You go to another shop where there is no segregation already done before. So what
you going to do? You say that please give me a three-piece cake out of this.
So three pieces exactly will be given to you.
Okay.
So this is the classless addressing. You
do not already make the classes classless addressing.
Okay. This was classful addressing.
So in C classless interdomain routing classless interd domain routing we use the slash notation slash notation what
is this we write like this a b c d slash n where this n will represent the nid or subnet
mask for example this is our 32-bit IP address N will be the prefix the NID part. So N
bits will be the NID part and the remaining bits will become the suffix or the HID part. This will become the NID
part. Okay. Now how many number of IP
part. Okay. Now how many number of IP address will be there in one block? 2^
32 minus N. How many host will be there?
Minus2. So when I ask you IP address, you'll answer this. When I ask you host, you'll minus two.
Okay. Now to find the first address, we'll keep the n leftmost bit and set the 32 - n right bit to all zeros. So
you'll keep it as it is and you'll set the hid to all zeros, you'll find the first address.
If you set the hid to all ones, you'll find the last address.
And about what about the host? The host
will lie here in between.
+ one will be the first host and minus one will be the last host.
I hope the idea is clear.
Okay.
Now there are some rules for C that must be followed.
So whenever any customer wants a block of IP address there I wanted a block of three piece cake three pastries
here we want a block of IP address. So
whenever any customer want a block of IP address or your internet service provider will create block and assign to the customer
like here we did on on the basis of demand we created the block. So here
also the INA or ISP will create the block for you and assign it to you.
Okay. Now there are some rules that must be followed by INA.
All the IP address in the block. So when
whatever block will be assigned to you all IP address in the block, all IP addresses should be contiguous.
You cannot do like this. One piece from here, one piece from here, one piece from here to make the three-piece cake.
No, it should be continuous. This is the rule. So all IP address should be
rule. So all IP address should be continuous.
The second rule, block size must be a power of two.
As soon as I have written this line, you would have guessed that wastage will be here also. For example, if I wanted
here also. For example, if I wanted let's say 476 IP addresses, I have to cut out the block of 512 IP address. The
remaining will be wasted. But the
wastage here is significantly less than the class P addressing.
Are you getting the point? So if you want for example three IP addresses, you have to create a block for four IP address. One will be pasted. If you want
address. One will be pasted. If you want let's say 780 IP addresses, you have to create a block of 1024 IP addresses. The
remaining will be wasted. But the
wastage here is significantly less.
Okay.
So the block size should be in the power of two.
Third condition, first IP address of the block, first IP address of the block must be divisible by the size of block.
Now how you are going to identify whether this is divisible or not? Let me
tell you a simple concept.
Let's say there is n bit number and you want to divide it with a let's say some block size. Let's say 2^ K. As you know
block size. Let's say 2^ K. As you know the block size must be in the power of two. So when you divide it with 2^ k if
two. So when you divide it with 2^ k if the last k bits if the last k bits are zero then it will be divisible.
Let me explain again. Here we have n bits and you are dividing with let's say 2^ k then the k bits from the right hand side
and n minus k bits. These k bits will represent the remainder and these n minus k bits will represent the quotient.
Okay. So
these k bits should be zero.
Okay. Is the idea clear? It should be like this. 0 0 0 K times
like this. 0 0 0 K times and first IP address of the block first IP address must be used as block ID.
It's similar that the first IP address should be used as the network ID in case of classful addressing. Here the first IP will be used as block ID in case of classless addressing because we are
creating blocks. So to identify the
creating blocks. So to identify the block we will use the first IP.
Okay, is it clear? Let's let's see which are the valid blocks. If I write 100
64 65 66 67 till 127 100.00 Do you think this is a valid block? I
have I've taught you these three conditions. Do you think this is a valid
conditions. Do you think this is a valid block?
The first condition is satisfied that these are continuous.
What was the second condition that the block size must be in a power of two? Is the block size power of two?
of two? Is the block size power of two?
Let's check. So 127 - 64 + 1. These are
the number of IP address present here.
This is 128 - 64. So it is 64. Is 64
power of two? Yes. 2^ 6. So second
condition is also satisfied. What about
the third condition? What is the block size? 2^ 6. Are the last six bits from
size? 2^ 6. Are the last six bits from the first IP zero? Let's check how do you write 64 in binary? 1 2 3 4 5 6 and
then 7 and then 8. This represent 18 128. This represents 64. So the last six
128. This represents 64. So the last six bits are zero. That's why we can say that first IP address of the block is
divisible by the size of the block. What
was the size of block? 2^ 6. And we have six bits from the right hand side zeros.
I've given you the concept. If you want to divide with 2^ K, you must look that if the K bits from the right hand side are zero. If yes, then it is perfectly
are zero. If yes, then it is perfectly divisible.
Okay.
Now let's understand the representation of C.
Representation of C.
If you have a block size let's say 2^ K then HID will be of 6 bits. N I will be of
bits. N I will be of 26 bits.
Okay. So we will represent 100 and then 64 because this was the first IP first IP and then 26 bits.
This will be acting as N. What was N? n
was representing the number of NID bits.
So we have 26 NID bits. So N will be 26.
Okay. So we will write like this 100 dotund.00.01
dotund.00.01 01 and then the last six bits will be HID 0 0 0. These are now HID. This
represents the block ID. Now what will be the first host? 0 0 0 1. What will be
the last host? 1 1 1 1 0 and in the end 1 1.
This will become like 127. But these
will be the host.
Why are we not using this? This will be used for DBA because in DBA in DBA, network ID
here we will have the block ID will remain as it is and HID will be all once.
Okay, is it clear?
Let's let's try another example. Do you
think this is valid?
Dot 128 and then 129 and then 130 till let's say 255. Do you think this is valid?
First of all, you have to check is this continuous?
Yes, it is continuous.
What was the second condition?
What is the block size? 255 - 128 + 1.
This is 256 - 128 = to 128. This is 2^ 7. Block size is in the power of 2. So
7. Block size is in the power of 2. So
yes, second condition also satisfied.
What was the third condition?
Is the first IP address of the block divisible by 2^ 7? How we are going to check? We will check if the last seven
check? We will check if the last seven bits if the last seven bits are zero or not.
So convert into binary. How you are going to represent 128? The first bit will be one and then remaining will be zero. And these seven bits are zero. So
zero. And these seven bits are zero. So
yes, it is divisible also. So this is a valid block. This is a valid block.
valid block. This is a valid block.
Check again. 100
1 2 3 till 32. Do you think this is a valid block?
Do you think this is a valid block?
Let's check. Is it continuous?
Yes, it is continuous. I think spelling is wrong. G O U S. This is continuous.
is wrong. G O U S. This is continuous.
What was the second condition? Size of
the block 32 minus 1 equals to 32 - 1 + 1 which is 32. This is 2^ 5. This is
also valid. What is the third condition?
Is the first IP divisible by the size of the block? Now we can directly see that
the block? Now we can directly see that it is not divisible because for this IP to be divisible the last five bits
last five bits should be zero. But is it zero? No. Because one is represented
zero? No. Because one is represented like this.
Last five bits are not zero. So we will say this is not a valid block.
This is not a valid block. Is it clear?
Do you have any doubt regarding this?
Okay, let's see more example.
Suppose we have 100.00 68 and then 27. You have to find the number of addresses in a block.
Addresses in this block. You have to find the range of IP, range of IP addresses. You have to find the block ID
addresses. You have to find the block ID or you can also call it as network ID.
You have to find the first host, last host and the DBA.
Try What you can directly see?
You can see that the NID is 27 bits. So
what will be the HID? Five bits because the sum should be 32 bits.
So the number of IP address will be 32.
What will be the range of IP address?
What will be the range of IP address?
Think and what will be the network ID or the block ID?
Why I'm not seeing answers in the chat?
Is it not? Simple
H.
Okay, I've given you enough time. Let's
solve. So, we have to find the range of IP address. First thing you do is
IP address. First thing you do is convert into binary.
So, it will be like 100.00 and then 68 will be 64 + 4. So, it will be 0 1 0 0 1 0 0.
Okay. And 27 bits from the left hand side will be the NID part. So these are 24 and then these are NID part and this
will be the become the HID part.
What will be the block id?
Block ID will be all HID part should be zero. So 100 dotund
zero. So 100 dotund dot just 64. This will not be there. So
what will be the block id? 100.00.64.
What will be the first host?
100.00.00.65.
What will be the last host?
To find the last host, you can like 1 1 1 0. What is the value of this?
1 0. What is the value of this?
0 1 0. What is the value of this for last host? This is 95 I guess. So last
last host? This is 95 I guess. So last
host will be 100.00 100 dot 100 dot no I guess it is 94 not 95
94 95 would be if it is also one 94 what will be the DBA now you know that in DBA all HID will be one so this will
be now become 95 so for DBA it will be 100.95 what is the range of IP the range of IP will be from 64 to 95
and you can write directly 64 to 95 while 64 represent the block ID and 95 represents the DBA and the host are in between here I thought one
example would be enough but you as you guys are facing problem in this let's solve another example uh one of the address of the block is given as 167 199
128 3 and then 20 now you have to find the same thing again number of address in block range
block id same same thing those same those parameters again solve first of all you convert it into binary
this is the first thing that you do from which class does it belong it doesn't belong to any class man this
is class less addressing you focus on this number Okay, try to solve as you know n ID is what? 20 bits. So
what will be the HID?
12 bits.
So how many number of IP addresses? 2^
12. Number of hosts 2^2 minus 2.
Okay. Now you convert into it into binary 167.19.128.3.
What is 20? This is 16 and four more. So
1.
This is what 128 is. And then three.
Okay. Now this was 16 17 18 19 20. This
will act as an ID and the remaining will act as the HID part. Now how you are going to represent the first address or the block ID? You will
convert all HID into zero. So this is what the block ID is. Now how you going to represent the first host?
This becomes the first host. What will
be the last host? All host ID is one except the last one. 1 2 3 4 1 2 3 and then this. What will be the DBA?
then this. What will be the DBA?
This is the DBA.
Is it clear? Now this is a simple thing, simple case.
Okay.
Anyone have any doubt? You can ask now.
Ran says that this concept is clear.
What about subnetting in this? This is
the next topic. Subnetting in C is the next topic. We are just going to study
next topic. We are just going to study that only. Okay, is it clear?
that only. Okay, is it clear?
Let's move. Subnetting in C.
Okay. Let's say the address is this dot uh let's say 14 and then 25. Okay.
Network ID is 25, host ID is 7 bits. So there will be 2^ 7
128 IP addresses and 126 hosts.
Okay. So if I convert it into binary 10000 0 and then this will be 15 and this will be 14. Okay. For 25 these are 24 and
be 14. Okay. For 25 these are 24 and this will be 25. These are NIDs and the remaining are HIDs. Now we have learned
in classical addressing how to do submitting. Anyone remember?
submitting. Anyone remember?
Yes. Borrowing. So what are we going to do? We we are going to borrow bits from
do? We we are going to borrow bits from the HID part. Let's say we borrow this bit and we name it as subnet ID SID bits. This will become the SI bit and
bits. This will become the SI bit and this could be zero or one. What we did now? We just divided the full network
now? We just divided the full network into two parts 0 and one. and the
remaining bits will be the HI bits.
Is it clear? So
100 dot.0 and then this will be the SID bit.
dot.0 and then this will be the SID bit.
Let's say this represents zero and the remaining six bits will be for the HID.
Okay. All zeros
going to represent the SID subnet ID 0000001.
This will become the first host.
0 0 0 1 0. This will become the second host. 1 1 1 1
host. 1 1 1 1 0. This will become the last host. And 1
0. This will become the last host. And 1
1 1. This will become the DBA. Is it
clear?
These are the host.
The last one is DBA and the first one is SID. Is it clear?
Now what about the second subnet? For
this you just change this bit to one and the rest remains same.
Okay. So for the first subnet we have SID 100.0 and now you know it will become 26.
Initially it was 25. We borrowed one bit and now it is 26. What about DBA?
100 dot 100 dot 100 dot and this was 63.
So 63 26. What about second subnet? What
about second subnet? It will become 64 because of this bit. And then here 64 + 63 which is 127.
64 will be added because of this bit.
And the rest remain same. Okay, is this clear how we do subnetting in C?
Now, what about variable length subnet masking? What about variable length?
masking? What about variable length?
Things remain same. For example, if you want to divide this, you borrow one more bit, name it as zero and then name it as one. Rest things remain same. Now, five
one. Rest things remain same. Now, five
bits, five bits will be for the HID part.
This will have 30 host. This will have 30 host.
one one and then five bits here. Now
again if all zeros then this will represent the subnet ID. If all ones this will represent the DBA and the host will be in between as we did the variable length subnet masking in the
classful addressing same concept applies here. Now one thing you must remember is
here. Now one thing you must remember is to increase this.
Now here the subnet here then n will be 26 and for these two n will become 27 because here you have borrowed two bits.
You have borrowed two bits. So n will become 27 from 25. Here you have borrowed one bit so n will become 26.
Is this clear or I should take a neater or neat example for the variable and subnet masking.
All clear.
Okay. So
let me give an example to test whether you have got the concept or not. If you
if you are not able to solve this, I'll take another example. If you are able to solve this, I'll move forward. Okay.
Let's say in a network we have 200.10.11.144 10.11.144 and then 27.
The fourth octate of the last IP address of the network which can be assigned to a host will be I want fourth octate
of the last IP of a network which can be assigned to a host will be I want a number. I want a number
in the chat.
think very carefully. Do not make the mistake because if you do I'll have to take another example.
Okay. 158 158
158. Okay. Let's see. People are saying 158. So 20010 what was the number we see
158. So 20010 what was the number we see it again 11.144 and then here it was 27. So firstly you
convert it into binary. So 20010100
01 0 0 0 is this correct this becomes 128 and this is 16 I guess. So 16 yes it is correct. Okay. Now, so 27 bits for
is correct. Okay. Now, so 27 bits for the NID 8 8 24 and then three more. So this is
become this has become the NID part. Now
you have five bits for the HID.
Okay. What I want the fourth update or the last IP address which could be assigned to a host. What could be the last IP address? 1 1 1 1 0 1 0 0. You
have just to convert this into decimal and it is 128. This is 128 and these are these are
30. So it is 158. You guys are correct.
30. So it is 158. You guys are correct.
You have got the concept.
Is it clear?
Okay. So we have learned about subnetting. In the next lecture we will
subnetting. In the next lecture we will learn about supernetting.
In the last lecture we discussed about subnetting.
In this lecture we will learn about supernetting. Supernetting in both
supernetting. Supernetting in both classful and classless addressing.
Let's begin with classless. So we'll
start with some examples. I'll solve few of them and then it will be your turn to
solve. 200.200 200 or let's say 96 86 0
solve. 200.200 200 or let's say 96 86 0
200 96 87 0 200 96 88 0 200 96 89 and then zero.
Okay. What are the conditions of supernetting? First of all, you have to
supernetting? First of all, you have to check whether the blocks these are block this is block one.
This is block four.
whether the blocks are continuous, whether the IP address and the blocks are contiguous.
Second part, the number of blocks that you are willing to combine should be in power of two number of blocks.
The third thing is size of supernet should be divisible by
first block ID which is this one. Okay. Now check is it continuous 86.
Okay. So first of all this is a class C network. So this is network ID and the
network. So this is network ID and the last octed is host ID. So we are going from 86 0 to 255 and then the next host
will be from the second block 87 0 to 255. The next will be from 88 and then
255. The next will be from 88 and then 89. So yes they are continuous. Are the
89. So yes they are continuous. Are the
number of blocks in power of two? Yes,
we have four blocks. So yes is the size of supernet divisible by the first block ID. What is the size of supernet? We
ID. What is the size of supernet? We
have host ID of one update. So 2^ 8 IP address in one network and we have four blocks. So 2^ 10. Do we have 10
blocks. So 2^ 10. Do we have 10 contiguous zeros from the right hand side in the first block ID?
96. Now we are converting 86. So it will be 0 1
1 no 0 1 and then 0 1 1 0 and then 0 0 0 8 zeros
8 and then 9 only nine zeros are present and we wanted 10 zeros because for the size of supernet for the full
supernet being completely divisible by the first block ID, we need 10 zeros from the right hand side in the IP address of the first first block ID. But we have nine
zeros only. So the third condition is
zeros only. So the third condition is not satisfied. Is it clear?
not satisfied. Is it clear?
Okay, let's solve some other
other question. 198 47 32 0 198 47 33 0
other question. 198 47 32 0 198 47 33 0 198 47 34 0
198 47 35 and then zero. Now first
condition is it continuous?
This is again this is class C. So this
is N ID. This is HID. This is
continuous. We are starting from 32 0 to 255 and then next will be from 33. Next
after 256 next will be from 34 and then 35. Okay.
So this is continuous.
Second, how many blocks are there? Four
blocks. So in power of two also.
What about third? What is the size?
Eight bits of HID. So 2^ 8 IP address in one block and we have four blocks. So 2^
10. Now let's check whether we have 10 zeros in continuous fashion from the right hand side in the first block ID.
So 0 0 1 1 2 3 4 5 and then 1 2 3 4 5 6 7 8. You know we have 10 zeros. So third
7 8. You know we have 10 zeros. So third
condition is also satisfied. size of
supernet divisible by the first block id.
So here supernetting can be done. So
what will be the supernet ID? The first
block ID 198 47 32 and 0. And what will be the supernet mask?
Network ID will be all one and host ID will be all zero. So 255.25 255. This
was all host ID and this will become network ID 1 2 3 4 5 6
0 0 and then so this will become 252 and this is 0.
So this is what super net mask is.
Is it clear?
Let's solve another question.
128 56 24 0 128 56 25 128 56
26 0 128 56 270 Apply the three condition. Can we do can we combine and
condition. Can we do can we combine and make a supernet of them?
Well, shout out to AB because he has correctly identified that we cannot apply supernating here because they all belong to a single network.
You all were trying to apply conditions.
First look at them. This belongs to class B.
This is NID. This is HID.
So they all belong to a single network.
No need to do subnetting. We cannot
apply subnetting on a single network.
Okay, let's change it a bit. So this
time 0 0 0 0.
Now check can we apply subnetting now.
So first of all are they continuous? Yes
they are continuous.
Second how many blocks are there? There are
four blocks in power of two. So yes they can be combined. Continuous power of two condition satisfied. The third one is
condition satisfied. The third one is size of supernet. What is the size of supernet? We have 16 bits in the host
supernet? We have 16 bits in the host ID. So 2^ 16 and we have four blocks. So
ID. So 2^ 16 and we have four blocks. So
2^ 18. Now do we have 18 contiguous zeros from the right hand side in the first block ID? Let's check
128 0 0 1 1 0 0 0 and then 1 2 and then 0 and 0 8 8 8 16 and then 18.
This will become the HID part. This will
remain the NID part. So yes,
supernetting can be done. What about
supernet mask? NID will be all zero all ones and HID will be all zeros.
again 255 252 0 0.
Is it clear?
Okay.
Let's see the difference between subnet mask and supernet mask.
Okay. So number of ones in the subnet mask either equal to nid or more than nid bits. So number of ones
nid bits. So number of ones why because SIDs are also present.
Okay. And here number of ones in supernet is always less than the NID.
Why? Because you see we are borrowing from the NID. This time
have you realized for sub for subnetting we were borrowing from the HID part. You
can also write here for subnetting you can borrow from HID and for supernet you have to borrow from NID that's why in the mask number of ones is
less than the NID and here the number of ones is greater than equal to N ID subnet mask is always applicable
always applicable to single network single network and superet mask task is applicable for two or more networks.
Networks in subnetting we borrow from host ID.
You can write like this and from in supernetting we borrow from network ID.
Are the difference clear between subnetting and supernetting?
Okay.
Now what about supernetting and classful addressing? Let's take an example.
addressing? Let's take an example.
Suppose uh a company needs 600 addresses.
Okay. So let's check whether these four blocks could be used to uh form a
supernet for this company. 198 47 32 0
198 47 33 0 198 47 340 and 198 47 350.
Are they continuous?
As this belongs to class C. So this will be an ID. This will be HID. Yes, they
are continuous.
What is the size? uh total size of the supernet 2^ 8 into 4 2^ 10.
So you can check this will satisfy and there are four there are four blocks. So this is in power of two. Third condition also
satisfied. So can they be merged? Yes,
satisfied. So can they be merged? Yes,
they can be merged. This this
supernetting is also easy. You just have to remember the four condition and you are all good.
So with the end of this topic our IP addressing is over. What we have learned in IP addressing let's overview. So
first of all we begin with the properties of IP address. We learned
about various classes involved there. We
learned about classful addressing and then we learned about subnetting.
After subnetting we moved toward variable length subnet masking. Then we
learned CI classless addressing. Then we
learned about supernetting.
Apart from that we learned about various concepts like what is DBA? What is
limited broadcast address?
What is NID? HID, subnet mask, supernet masks.
Okay. How we do subnetting? How we do supernetting? How we are going to
supernetting? How we are going to identify the first host, last host, the network ID, the host ID, the range.
We have learned all these type of concepts.
In the next lecture, we will start with error control.
IP addressing is almost over. We'll
begin with error control. Before error
control, I'll ask you to solve the complete set of DPPS I have provided for IP addressing.
I have already given you the solutions that in the DPP no question is that hard that you will not able to understand even after looking at the solution. If
you have attended the classes properly, you have made notes then they won't be that tough. Okay, you will be able to
that tough. Okay, you will be able to understand even if you have any doubt in DPP. I say
in each and every lecture if you have any doubt in DPP or in the lecture you can ask in the beginning of the lecture or in the end of the lecture or even while I'm
teaching some concept and you face any difficulty while understanding you stop me right there and ask me okay don't wait for the topic to get completed and then you'll ask
yes there are almost I six to seven DBPs regarding this IP addressing. You can
solve all of them. Each DBP have around five to six problems. So you'll have around a set of 80 to 100 problems for IP addressing. If you solve
all of them, you will have a very solid understanding on this IP addressing.
This module was of IP addressing.
After error control, we're going to learn flow control. And then we will learn IPv4 header and fragmentation.
Then we'll move to our TCP UDP.
Then media access control, routing protocols, supporting IP protocols, application layer, and then if time permits, we will learn about cyber
security. Okay? Then we'll meet in the
security. Okay? Then we'll meet in the next class. One important disclaimer for
next class. One important disclaimer for this module that for this error control we are not going to look at the security aspect. We will not consider the
aspect. We will not consider the intentional modification as errors.
What do I mean by intentional modification?
When integrity is violated when some person or some hacker intentionally modify the data that part is not considered an error. When the
data received is not same as the data sent due to the noise this means error has occurred. Okay. So we will look at
has occurred. Okay. So we will look at two types of errors. Single bit error and burst errors.
By the name you could have guessed single bit means only one bit is changed from 0 to 1 or 1 to 0. Let me give an
example. 1 2 3 4 5 6 and then 1 0 and
example. 1 2 3 4 5 6 and then 1 0 and then what I received is 0 0 0 1 0 1 0.
This was sent and this was received. So
one bit is changed. When a single bit is changed then we say single bit error has occurred. And what about burst error
occurred. And what about burst error when two or more bits in the data unit have changed from 1 to 0 to 1. For
example 0 1 0 0 1 0 1 0. And what I received was 0 1 1 0 1 1 1 0. Okay. Now
this is changed and the last bit which was changed was this. So we call it as burst error when
this. So we call it as burst error when two or more bits in the data unit have changed. And this was the last error
changed. And this was the last error and this was the first error.
And we call this distance as burst length. Burst length. So what
is the burst length? Distance between
the last error and the first error. And
what do I mean by distance? We mean
number of bits. Okay. Now you know number of corrupted bits. Number of bits which were corrupted depends on what?
Can you guess?
Number of corrupted bits depends on what? Can you tell me or can you guess
what? Can you tell me or can you guess the factors?
Corruption happens due to noise. So can
you guess the factors?
Absolutely correct. You have guessed it correctly for the one factor which is noise duration. What can be the other
noise duration. What can be the other factor? Try to think.
factor? Try to think.
Try to think what could be the other factor.
Yes. Yes. Data rate
for example, let me take an example.
Let's say noise happens for this much duration of time and data rate is let's say 1 kbps. So how many bits will be corrupted?
100 bits.
K means 10^ 3 bits per second. second to
second cancel and then this will result into 100 bits. So 100 bits were corrupted. Now by looking at this
corrupted. Now by looking at this example, can you guess which error has or which error is more likely to occur?
Which error has more probability, single error or bust error?
Obviously bust error. Burst error is more likely to occur. Okay. Now in the error control module, we're going to study the two aspect. The first one is
error detection and the second one is error correction.
You know detection is way easier than correction. Detecting that these bits
correction. Detecting that these bits are not the bits which sender would have sent. This is detection and correction
sent. This is detection and correction means what could be possibly the correct bits instead of these bits which I received. This is what corruption
received. This is what corruption correction is.
Okay. So, correction is way difficult than detection. We going to look at
than detection. We going to look at correction also. But detection is easier
correction also. But detection is easier than correction. Okay. And how do the
than correction. Okay. And how do the receiver detect that these bits are not those bits which sender would have sent?
How going to receiver detecting? So they
both happens with the concept of redundant bits.
Redundant bits. The central concept in detecting or correcting error is redundancy. So to be able to detect or
redundancy. So to be able to detect or correct the errors, we need to send some extra bits. We need to send some extra
extra bits. We need to send some extra bits with the data.
With the data, extra bits are sent. So
receiver going to remove those extra bits which were added by the sender.
These redundant bits, these redundant bits are known to both sender and the receiver. So if receiver notice that the
receiver. So if receiver notice that the redundant bits are intact, no error has occurred in the redundant bits, then receiver going to assume that
the remaining data would also have been correct. And if there are errors in the
correct. And if there are errors in the extra bits, then the receiver assumes that error would also have been there in the data part also. Okay? So sender
added these extra bits and receiver removed those extra bits.
Okay?
Is it clear?
The detection and correction part is clear. What do we mean by detection and
clear. What do we mean by detection and what is what do we mean by correction?
Correction means we are also guessing.
We are also estimating what would have been the correct bits.
Okay. So in error detection we are only looking to see if any error has occurred. The simple answer would be yes
occurred. The simple answer would be yes and no. If no, if no error has occurred,
and no. If no, if no error has occurred, receiver going to accept those bits. If
error has occurred, receiver going to tell the sender to retransmit those bits again. Okay, let me write here.
again. Okay, let me write here.
Detection is performed by receiver. If
error has occurred, then retransmission happens.
If no error, then receiver will accept those bits. Okay. And for error
those bits. Okay. And for error detection, single bit error is same as the burst error. Even if a single bit is changed, receiver going to ask the
sender to send the whole data again.
Even for a single bit error, receiver going to ask the sender to send the whole data again.
Is it clear? So for detection part, the single error and bust error mean the same. Retransmission will occur. Okay.
same. Retransmission will occur. Okay.
What about error correction?
In error correction, the problem is we need to know we need to know the exact number of bits that are corrupted. We
need to know the number of bits that are corrupted and most importantly the location of the bits.
The location of bits and number of bits.
For example, if we know that the bit at fourth place has been corrupted, which means whatever we have received, if it is zero, we will change it to one. If it
is one, we will change it to zero. Okay.
So, this was the basic concept of detection and correction.
Correction of error is way more difficult than detection. If we need to correct a single error in a 8 bit data unit, we need to consider eight possible error locations.
Are you getting the point? For example,
if we received this data 1 0 1 0 1 0 1 0. Okay, we need to consider eight
0. Okay, we need to consider eight possible error locations. This could be the error location. This could be this could be this could be eight possible error location. When we are talking
error location. When we are talking about just a single bit error, we are assuming that only a single bit error can happen. Only a single bit error can
can happen. Only a single bit error can happen. And what are the what are the
happen. And what are the what are the possible locations at which the error can happen? There are eight possible
can happen? There are eight possible locations.
What about a double bit error?
Double bit error. Now we have to choose two locations out of 8, which means 8 C2.
8 into 7 / 2, which means 28 possible locations this time.
What about 3bit error? It will become 8 C3. What about 4 bit error? 8 C4.
C3. What about 4 bit error? 8 C4.
the number of possible locations going to increase.
So for a k bit error in a n bit data unit there are n ck possibilities for error location. There
are n ck possibilities.
I hope you all know how to calculate this nck n factorial upon k factorial n minus k factorial.
Okay. So I was just giving you an idea that correction is way more difficult than detection. Now what are the things
than detection. Now what are the things we are going to study in error control part error control
detection and correction. In detection
we will start with simple parity simple parity we will learn 2D parity
3D and 4D also or let's let's keep it to 2D parity only check some and then CRC
okay and for correction we're going to study the Hamming code method And what Heming code can do this is also a very simple method. We are we cannot
uh just correct any number of bits. It
can detect two bit error.
It can detect two bit error and correct single bit error. Just one bit error it could correct.
Even for correcting one bit you going to notice that the method is not easy.
Okay. For detection, we'll start with simple parity, 2D parity, checksum and CRC. Okay. What happens in detection? If
CRC. Okay. What happens in detection? If
error is noticed, the receiver will discard the message and will ask for retransmission.
Retransmission.
And for error correction, it has the capability to correct the error. It it
do not require retransmission.
No retransmissions required. And heming
code can correct single bit error. I
have written this already.
One bit error can be corrected.
Okay. Now let's begin.
First of all, you need to learn some of the terms. First term is data world.
What is data world?
Or before that let's learn some other things. Let's learn the logic for error
things. Let's learn the logic for error detection.
Okay, in error detection we what we do we do block coding. Block coding. In
block coding we divide our message into blocks each of size k bits.
Let's say the length of the full is n.
So each of side k bits and what we do in each block we add redundant bits of r.
In each block it's done. are redundant
bits are added.
Okay. And this each block we call it as data word.
Each block is known as data word. So in
each data word in each data word our redundant bits are added. And this whole unit we call it as code word.
Is it clear? What we do? We divide the message into k bits. K bits. K bits, k bits, k bits. And then in each block
which we call data word, we add our redundant bits.
This was data word and the whole is code word. The whole is code word and the k bits was the data word. So let's say instead of naming it
word. So let's say instead of naming it as n, let's name it as message. And
let's name the length of the code word is n. Okay. So n means k plus r which means
n. Okay. So n means k plus r which means length of the data word plus redundant bits.
Okay. So in place of sending just data we send these code word. So data word are not transmitted we transmit code word. These code words are what
word. These code words are what transmitted by sender.
Is it clear? What we do? We divide the message into k bits. Each block is known as data word. We add r redundant bits to each data word. And then now this whole
block we call it as code word. And these
code words are transmitted. Is it clear?
Let me take an example. So 0 0 1 1 0 1 1. Let's say k equals to 2. So we going
1. Let's say k equals to 2. So we going to divide this whole message into blocks of size two bits. Okay. So k equals to two. Let's take r equals to 1 bit. So
two. Let's take r equals to 1 bit. So
one bit will be redundant. So
data word will be 0 0 and one bit redundant bit will be added. So this
will now act as code word.
What is the length of code word? n
equals to 3. Okay. So let's say data word is 0 0 1 0 and 1 1. These are data words.
And what will be the valid code word?
valid code word.
We are assuming here that out of the eight possible choices because each this each position have two choices. It could
be either zero or one. So there could be total eight possible code words.
Out of these eight possible code words, we are assuming that only four are valid. Only four are valid. Which are
valid. Only four are valid. Which are
valid? 0 0 0 1 1 or let's say 1 0 1 we can also put zero here but we are just taking an example 1 1 0. So now these
four are valid and the remaining 0 0 1 0 1 0 1 0 0 and 1 1 1 these are invalid.
So now what happens with K bits with K bits which means we're talking about the data word
K bits there can be two 2 power K combinations and now we have added K + R bits
converting it to N bits. So with N bits we could have 2^ N combinations.
For example here we have K equals to 2.
So we had these data words. We have
these data words. So we have four data words. And when we added one extra bits,
words. And when we added one extra bits, the combination rose to eight data words. And out of these eight, four were
words. And out of these eight, four were valid and four were invalid.
The remaining four were invalid.
So 2^ n were total. 2^ k were valid. So
these are invalid code words.
You getting the point?
These are valid code words. These are
invalid code words.
Okay. So let me write again. 2^ K are valid code words and 2^ K. 2^ N minus 2^ K are invalid code words.
Okay, is it clear? So with k bits we can create combination of 2^ k data words and with n bits we can create a combination of 2^ n code words and we
know that only 2^ k are valid code words. So remaining are invalid code
words. So remaining are invalid code words. Now how does the error detection
words. Now how does the error detection happen with these? The most important thing is receiver has the list of
receiver has the list of valid code words.
Okay. So the original so when error happens the original code words or the valid ones are changed into invalid ones and receiver has the list of valid code
words. So receiver going to detect that
words. So receiver going to detect that the error has occurred.
Is it clear? So each code word sent to receiver may change during the transmission. If the receivers's code
transmission. If the receivers's code the received code word is same as that of valid code word then the word is accepted. Okay. So let's say if sent was
accepted. Okay. So let's say if sent was 0000 and what are the list of valid?
Let's say received also 0000 and receiver checks is 0000 is in the list of valid code words.
Let's say yes. then
the receiver accepts.
Now what about the case when there are multiple there are multiple bits changed. Let's say 00 0 was sent
bits changed. Let's say 00 0 was sent and we received 011. The sender the sender has sent 00 0 and we received 0
011. Now receiver checks again is in the
011. Now receiver checks again is in the list of valid code word. Receiver
the list has 011. So receiver says okay it is in the list of valid code word. So
I will accept it. Now what happened? The
error remains undetected.
If change happen in such a way that the resultant error bits are in the list of valid code word then the receiver is not
able to detect the error. Is it clear?
Let me clarify all the scenarios again.
If sender sends 0000 and receiver receives 0000 then receiver accept it.
If receiver receives something like this 001 then receiver rejects it because this is not in the list of valid code word. But what happens in the case
word. But what happens in the case when receiver when error has occurred but the received word still matches a valid code word list then the error
remains undetected.
Okay, is it clear? Now we're going to learn the new concept of Hamming distance.
Okay. So, heming distance is the distance between two binary strings of same size and it is the number of differences between corresponding bits.
So, let's say if I ask you to calculate the Hamming distance between 0 0 and 0 1 then you will say the Hamming distance is two because of these two bits. Let me
repeat again what is Hamming distance?
Hamming distance is calculated between the binary strings of same size and it is the number of differences between the corresponding bits. Corresponding bit is
corresponding bits. Corresponding bit is necessary. Okay. So having distance
necessary. Okay. So having distance between two binary strings is denoted by dxy.
X represent the string one and y represent the string two. Okay. So if I ask you the hamming distance between 1 0
0 and uh 011 then what will you say?
Three. Yes. Correct. Three will become the Hamming distance. What about this D 1 0 1 0 1 and 1 1 1 1 0? What is the Hamming distance?
Three again. Yes, correct.
Okay. So, what is the mathematical function or how you going to calculate the Hming distance with the help of exorate?
I hope you all know what is exorgate.
Exor gate is represented like this.
If both inputs are zero then it represents zero. If both input are one
represents zero. If both input are one it represents zero again. If both input are different then one then one. So if inputs are same it will
then one. So if inputs are same it will result zero. If inputs are different
result zero. If inputs are different then the result will be one. So if you are to calculate the Hamming distance between let's say the last question 1 1
1 1 0 then you do the exor and now 0 1 0 1 1. Now you calculate the number of ones here.
Number of ones means that the input were different. If inputs were different
different. If inputs were different which means the corresponding bits are different. So number of ones will
different. So number of ones will represent the Hamming distance.
So we have three ones. So three will become the Hamming distance. Hamming
distance can easily be found if we apply exor operations on the two words and count the number of ones in the result.
Is it clear? Exor gate is also represented using this.
Okay.
Now what we are interested in? We are
interested in the concept of minimum Hamming distance. Minimum Hamming
Hamming distance. Minimum Hamming distance.
It is the smallest heming distance between all possible pair of code words.
smallest between all possible possible pair of code words.
Okay.
So let's say these are our valid code words. 0 1 0 1 0 1 1 0 and 0 0 1. Now
words. 0 1 0 1 0 1 1 0 and 0 0 1. Now
what is the minimum heming distance?
Between let we name it as A B C D. So
between A and B the heming distance is three. Between A and C the heming
three. Between A and C the heming distance is 1. Between A and Dming distance is two. B and Cming distance is two. B and Dming distance is 1. C and
two. B and Dming distance is 1. C and
Dming distance is three. So one is the minimum heming distance and we have to check for each and every combination. We check first for A and B,
combination. We check first for A and B, then A and C and then A and D and then B and C, B and D and then C and D. Is it
clear?
Anyone have any doubt till now?
Okay. So why we have learned about the Hamming distance?
Because of its uses in error detection and correction also. See here. Let's say
if I if the sender has sent 0 1 0 and the receiver received 1 1 0 this is a valid code word error has occurred but the received code
word matches in the list of valid code word so I'm going to say that the receiver won't be able to detect the error what about this 0 1 0 and it receives
011 now this is not in the list of valid code word this is Invalid code word receiver going to detect it.
Detect it. These were all one bits error. One bit error. One bit error.
error. One bit error. One bit error.
Okay. Now all one bit error cannot be detected. All one bit error cannot be
detected. All one bit error cannot be detected because the minimum having distance was one. Here the minimum having distance
one. Here the minimum having distance was one. So I'll say all one bit error
was one. So I'll say all one bit error cannot be detected.
Okay. Now let's calculate heming distance for another set. 0 0 0 1 1 0 1 1 1 0. The minimum heming distance here
is 2. Now let's check again. Sender send 0
2. Now let's check again. Sender send 0 0. Receiver received 1 0 0.
0. Receiver received 1 0 0.
What is the bit error? Single bit error.
Now this 1 0 0 is not in the list of valid code word. So I'm going to say receiver has detected the error.
receiver has detected. So either it received 1 0
has detected. So either it received 1 0 0 or it receives 0 1 0 or it receives 0 0 1. Whatever case you take, receiver
0 1. Whatever case you take, receiver going to detect it every single time.
Why? Because this time Hamming distance is two among the valid code words.
Initially the Hamming distance we have taken was just one. So with just one Hamming distance, one bit error was not detected every time because the received code words were still getting matched to
the valid code word list. Now we have changed the valid code word list and we set the hamming distance equals to two.
In that case every possible one bit error is getting detected. Let's check again for another
detected. Let's check again for another set. For example 011 bit error can be
set. For example 011 bit error can be 111 or 01 or 0 1 0.
None of them is still getting matched in the set of valid code words. How it can get matched? Because here the minimum
get matched? Because here the minimum corresponding change in bits between two valid code word is two and here the error is just single bit.
So by changing just a single bit you cannot transform this valid code word into some another valid code word. You
have to at least change two bits.
This was heming distance representing that to transform one valid code word into another valid code word.
The minimum number of bits you have to change is two. So when a single bit error occurs, none of them get transform into another
valid code word. And this is how receiver detects the error every single time. Is it
clear?
You can take other cases also.
The concept remains same. 0 1 1 0 0 none of them is still getting matched. So
receiver going to detect it easily that the code word which he's receiving is not in the valid code word list. So
error has occurred. So all one bit error all one bit error are getting detected
when hamming distance is two two bit error. So a valid code word when the hamming distance was two which
means we require two bits to change for valid code word to convert into another valid code word and if one bit error has occurred it will be invalid code word
and receiver can easily detect and if another bit error has occurred it can transform into another valid code word and receiver won't be able to detect.
What about three bit? If having distance was three bit then what?
Then again two bit error will be still a invalid code word and a three bit error can transform a valid code word into
another valid code word. So ifming
distance is d which means d minus one bit errors receiver can detect. Let me
repeat again. Hamming distance means that you require those many bits to convert a valid code word into another valid code word. Even if it is a one bit
lesser than the required, the valid code word will remain invalid and receiver going to detect.
So if the heming distance is D till D minus one bit error it will still result into invalid code word and receiver can easily detect that this received code
word is not matching in the list of valid code word. So I'm going to say to the sender that whatever data you have set sent it is not what I have received.
So you have to retransmit again it will detect the error. Okay. If the Hamming distance is D till D minus 1 bit error it will be detected.
And you can say like this also if we want to detect k bit error you require k + 1 heming distance. Is it clear?
Okay. So till now we were talking about detection. But what about correction?
detection. But what about correction?
If you want to correct k bit error you require 2k + 1 having distance.
This is for correction. So you have to remember these two formulas that for detection k + 1 heming distance is needed and for correction 2k + 1 is
needed to correct one bit error you need three heming distance to correct five to correct two bit error you require five as a hamming distance. Five bit hamming
distance is required to correct k bit error 2k + 1ming distance is required.
Is it clear?
Okay. Okay, now let's move toward the new concept of simple parity check.
Simple parity.
What do we do in simple parity? One
extra bit which is known as par bit is added to each data word. So we used to divide the message into KK bits. We call
them as data word and we added R addent bits. So here R equals to 1 and we call
bits. So here R equals to 1 and we call this bit as parity bit.
Okay. Simple parity can detect all single bit error. All single bit error can be detected.
They can be detected and they cannot detect even bit errors.
Even number of errors can detect all odd number of errors. So
I can just write like this even number of errors are not detected while odd number of errors are detected while it is a guarantee that all single bit error will be detected.
So what do we do? Let's first understand the concept of even parity and odd parity.
Even parity, odd parity, even parity means number of ones including the parity bit should be even.
Number of one including the parity bit should be even which means number of one. If number of one excluding the parity bits are even
already then we set parity bit to zero.
If number of parity if number of ones excluding the parity bits are odd then we set parity bit to one. So that by adding this one the number of ones will
be even. Let me explain. So let's say if
be even. Let me explain. So let's say if there are three ones then I'll set parity bit to one.
So including the parity bit now it will have four ones. But if it already has if it already has let's say four ones then I'll set parity bit to zero. So
that the total number of one still remain even. The same case happens with
remain even. The same case happens with odd parity. This time
odd parity. This time if the number of ones are odd, then we set parity bit to zero.
Let's say there are three ones, then we're going to set parity bit to zero.
So that number of ones remain odd. Let
me tell again excluding the parity bit check if the number of ones are even or odd. If we
are talking about even parity and number of ones are already even then you set parity bit to zero. If the number one were not even then you set parity bit to one. So that including the parity bit
one. So that including the parity bit numbers become even.
While in the case of odd parity if the number of ones are odd then you set parity bit to zero. If the number of ones are even then you set parity at one. So that including that paritivate
one. So that including that paritivate number of ones become odd.
Is it clear?
Okay. Okay. So
I have mentioned already this that even number of errors are not detected while odd number of errors are detected.
Okay.
Let's see an example. For example, data world is 0 0 1 1 0 1 1 the same previous one. And we are dividing it again into
one. And we are dividing it again into two parts.
Dividing again into two parts where K equals to two into several parts. Now
R equals to 1. And we call this as parity bit.
So 0 0 1 1 0 and 1 1. And parity bit will be added. Let's say and the valid code word remains 0 0 1 1 and then 1 0 1
and then 1 1 0. How these bits are added?
So that number of ones remain even. We
are talking about let's say even parity.
These are data word and this is code word. Here the number of ones is even.
word. Here the number of ones is even.
Here the number of ones is even. Again
even and then again even including the parity bit. You have to make sure that
parity bit. You have to make sure that you do not exclude the parity bit while counting ones for even or odd. You have
to include the parity bit also. Is it
clear? So now this is like change 0 0 0.
Let's say this is uh sent and what receiver received 1 0 0.
Okay. So the number of ones are now odd while the receiver know that the sender and receiver have already talked upon that we are going to use even parity.
And if we receive number of ones as odd which means error has occurred which means receiver will ask the sender to retransmit.
What about this 0 0 0 and then 1 1 0.
This was 1 bit error and this was two bit error.
Number of ones are even. Number of ones are even. So receiver cannot detect two
are even. So receiver cannot detect two bit error now because this is included in the list of valid code word. You can
even directly say that if the number of ones are even and they have already agreed upon the even parity so receiver won't be able to detect two bit error.
Is it clear? What about three bit error?
0 0 0 and then 1 one number of ones are odd again. So I'm going to say receiver
odd again. So I'm going to say receiver can detect the three bit error. So as I have said that odd number of errors will be detected and even won't be detected
when we are using even parity. So this
is the case for even parity it's clear.
So when even is changed to odd or odd is changed to even then
detection happens.
Now you know this is not for just even parity but this is valid for even and odd parity both. Why? Because even to odd and odd
both. Why? Because even to odd and odd to even in this case detection happens and this only happens when there are odd number of changes.
If we have even number of changes then what will happen? Even will remain even and odd will remain odd. In that
case error gets undetected.
That's why I have written here that in simple parity even number of errors remains undetected while odd number of errors get detected. Why? Because odd
number of errors change even to odd and then receiver can detect and odd to even receiver can detect. But what about the case when even number of changes happen
even remains even and odd remains odd.
Whatever be the parity receiver won't be able to detect.
Is it clear how simple parity words works works? It will detect any single
works works? It will detect any single bit error and regarding odd number of errors. It will detect any odd number of
errors. It will detect any odd number of errors but for even number of errors it won't be able to detect. For example,
two bit error were not detected while one and three bit error were detected.
Is it clear?
Okay. Now let's learn about 2D parity.
2D parity.
Okay. In 2D parity what we do or let me tell you the features first.
Twodimensional parity check can detect and correct all single bit error. It can
detect and correct also all single bit error.
Single bit error. And what about the errors greater than one bit? So it can detect it can just detect two bit and three bit errors also.
And what about four bit? Sometime it may detect and sometime it may not. But for
shortity you can see it will detect two bit and three bit error while it will detect and correct also single bit error.
Okay. For four bit only some pattern with four or more error can be detected.
But for two and three bit you can be sure it will be detected.
Now what happens is 2D parity you know 2D means two dimensional so it's it's sure we will talk about matrix so what happens in 2D parity check code the
information bits are organized in a matrix in rows and column format for each row and each column one parity check bit is calculated
how does that happen let's see with the help of an example Suppose we have an original data of this 0 1 0 0 1 0 0 1 0
1 0 1 1 0 0 1 0 1 Okay, let's take more 1 1 0 1 1 0 0 1 0
0 1 Okay. And now let's say we are dividing into let's say k equals to 6.
So 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 1 2 3 4 5 6 1 2 3 4 5 6 and these parts. So we
have divided into like this and this will become the first row. This
will become the second row. This will
become the third row. Fourth row and fifth row. So I'll arrange like this. 0
fifth row. So I'll arrange like this. 0
1 0 0 1 0.
And then the next 0 1 0 1 0 1. And the
next 1 0 0 1 0 1. And the next 1 1 1 0 1 1. And the next 0 0 1 0 0 1. Is it
1. And the next 0 0 1 0 0 1. Is it
clear?
So these will be number of rows. So
number of rows are five. Number of rows.
1 2 3 4 5. Now what happens? We are
going to calculate the parity.
For we will add another row and another column. So let's take even parity. We'll
column. So let's take even parity. We'll
consider even parity.
So these are already even. This is
already even. So zero will be here. This
is odd. So one will come here. This is
odd again. So one will come here. This
is 1 2 3 4 5 odd again. So one will come here. This is even. So zero will come.
here. This is even. So zero will come.
Is it clear? Now this
already even so zero will come here and then the second odd so one will come here 1 one which means already even zero will come here zero will come here zero
will come here and then already zero will come and then in the end 1 2 3 so four are you getting the point how I'm
calculating see let's let me explain you for some let me explain this case So
1 2 3 there are already three ones which means it is odd and including the parity bit which is this one we have to make it
even so I have to add one more one so that 3 1 and 4 1 3 1 and 1 one will count to four ones which is even that's
why I have written one here why I've written one here because 1 2 3 and this is one again so it will count to four
that's why we have taken one here I hope how to calculate parity you know let me take some other example
1 1 0 1 now tell me what will come here if I'm talking about odd parity 1 one 2 3 4 and including the parity bit it
will become five which is an odd number one. What about even parity? If I have
one. What about even parity? If I have taken even parity, then what would be the case? Then 1 2 3 4
the case? Then 1 2 3 4 now it will come zero. Why?
For even parity, these four ones are already in even number. That's why it will come zero
number. That's why it will come zero here. I hope the point is clear how to
here. I hope the point is clear how to calculate the parity.
Now let's see how we are going to check for the changes.
Let me rename it. This this will be the row parity and this will become the column parity.
Okay. Now
this will become the first row first row to be transmitted. You know
this will become the data word. Not not
data word. This will become the code word.
Till here it was data word and the last bit is a parity bit. So it
will act as a code word. Now this will become the second row to be transmitted.
This will become the third row to be transmitted. So in this manner
transmitted. So in this manner transmission will happen. Is it clear?
Now let's talk about the one bit error.
Let's talk about the one bit error.
Let's say this one get changed to zero. This one gets changed to zero. Now what will happen?
Parity bits will be calculated at the receiver end. So this will remain same.
receiver end. So this will remain same.
This will remain same. This will remain same. Now what about this one one?
same. Now what about this one one?
It's already even. So it should have been zero here. So receiver will notice that there is some error here in this row.
Is it clear? Receiver going to notice that there is some error in this row.
Okay. Now what about this? This will remain zero. Now what
this? This will remain zero. Now what
about this? It will also calculate the column parity. This will remain zero.
column parity. This will remain zero.
What about this one? One. It's already
even.
Why it is one here? Receiver going to notice. So receiver will check there is
notice. So receiver will check there is some error in this column also. So
wherever they intersect they're going to intersect here wherever they intersect that bit will be the corrupted bit. So
receiver know if it has received zero which means the original bit would have been one. So in this manner correction
been one. So in this manner correction happens.
Is it clear? Let me explain again. So
what happens? We were given with a original message. This was our original
original message. This was our original message. We divided the message with K
message. We divided the message with K equals to 6.
Okay. So this became our data word, data word, data word, data word, data word.
We arranged them into rows fashion in row major order. We arranged them into row major order. And then we calculated the row parity and the column parity and then this became the row to be
transmitted. The second row to be
transmitted. The second row to be transmitted, the third row to be transmitted. And what receiver did? So
transmitted. And what receiver did? So
receiver let let me show you what type of message does receiver received.
Receiver received like this. 0 1 0 0 1 0 0 1 0 0 1 0 0. Receiver received message
like this. And then 0 1 0 1 0 1 1. And
like this. And then 0 1 0 1 0 1 1. And
then 1 0 0 1 0 1 1 like this. This will
be the third row which receiver has received. Now receiver knows that K
received. Now receiver knows that K equals to 6. So it will automatically bifurcate like this.
Okay. And what will receiver do now? It
will rearrange 0 1 0 0 1 0 0 1 0 1 0 1 1. And it will assume that these must be the row parity bits. And
similarly in the end it will assume the last one should be the column parity bits. And it will recalculate the row
bits. And it will recalculate the row parity bits and column parity bits. And
wherever it sees an error it set up a mark. Let's say the mark came here and
mark. Let's say the mark came here and here.
Okay, these two parity bits were let's say different than what receiver calculated. So receiver will assume that
calculated. So receiver will assume that error would have happened in this row and this column and wherever the intersection will be receiver assumes that that bit must be corrupted. Is it
clear?
Okay. Okay. Okay. Now, so this was the concept of one bit error detection
and correction in 2D parity.
Now what about two bit error? What will
happen in the case of two bit error?
It will form something like this.
It will form something like this. Here
it was just like this. In the one in the case of one bit error receiver clearly know where the intersection is. So it
can detect easily and correct also. But
here when there will be two bit error when there will be two bit error four of the parity bits will be affected. Two
from the row and two from the columns.
And now receiver do not know which bit is corrupted because there are now four intersections. And out of those four
intersections. And out of those four intersection only two bits two bits were corrupted. Now receiver do not know
corrupted. Now receiver do not know which two bits are corrupted. So it will not try to correct it. It will just ask the receiver ask the sender to retransmit it. Receiver going to ask the
retransmit it. Receiver going to ask the sender to retransmit it. Are you getting the point why it is not able to correct in the case of two bit error? Let me
repeat again. In the case of one bit error, a single parity bit from the row side and a single parity bit from the column side will be affected. So
receiver going to mark those rows and columns and wherever they intersect, wherever they intersect, receiver knows that this is a single bit,
this is a single bit that need to be altered or changed for correction. Now
in the case of two bit error in the case of two bit error two bits from the row side and two bits from the column parity side will be affected. So receiver going
to mark two rows and two columns and these two rows and two columns going to form four intersection. This one this one this one and this one. And with
these four intersection receiver have to select two bits which were corrupted.
And receiver cannot do that because there are six possibilities. 4 C2 there are six possibilities. Receiver cannot
pinpoint which two bits were corrupted.
So receiver is not going to trying to correct them. It will just ask the
correct them. It will just ask the sender that I have received corrupted bits. So you have to retransmit the data
bits. So you have to retransmit the data and sender will retransmit.
That's why it can only detect two bit error.
Correction doesn't happen. No
correction.
Is it clear? So two bit error can maximally affect four parity bits and minimally affect two parity bits.
How? How? In this case when when error happens like this that in a single row two bits were changed. In a single row two bits were
changed. In a single row two bits were changed. So one parity bits will be
changed. So one parity bits will be changed from here and two column parity bits will be changed.
Okay. So in that case in this case correction can also happen but it is not guaranteed that the error will happen in a single row only for generally we say that for two bit error only detection
happens and no correction. Two bit error can maximally affect four four parity bits when the error happens in two different rows. So when error will
different rows. So when error will happen in two different rows the honking culture in India is really really bad.
What can we do? So
and I forgot what I was speaking.
Yeah. So in a two bit error in two bit error the maximum parity bits that can be affected could be four parity bits when the error happens in two different rows. So when error happen in two
rows. So when error happen in two different rows two row parity bit will be affected and two column parity bit will be affected when in while in uh
this case error happened in a single row. So
row. So these three these bits will be affected. Now here
I've written two bits but I have made three boxes. What does it mean? Let's
three boxes. What does it mean? Let's
say this was zero and this was one. Now it
is changed to one and zero. This parity
bit won't be affected.
This parity bit won't be affected because number of ones remain the same.
So this won't be counted just two column parity bits. Is it clear?
parity bits. Is it clear?
Okay. So with two two bit maximally can cause four parity bits to change and two minimally maximum and minimum. What about three
bit maximum? Six bits. Six parity bits can
maximum? Six bits. Six parity bits can can be affected and minimum. Again two
parity bits can be affected. What will
be the minimum case? The minimum case will be like this.
Okay. These are changed. So
this bit won't be affected.
This bit will be affected or not.
This won't be affected. So
this one and this one.
These two parity bits will be changed.
That's why even with three bits, the minimum number of bits parity bits that will be affected will be two. Is it clear? So let me make a
be two. Is it clear? So let me make a table again.
With two bits two bit of error the maximum parity bit and the minimum parity bit that will be affected will be four and two. With three bits the maximum parity bit that will be affected will be six and the minimum will be
still two.
Okay. Now what is the disadvantage of 2D parity that you can directly look at?
Can someone guess what is the disadvantage of 2D parity? Or I can speak like this. In what case the method of 2D parity fails
absolutely correct when these parity bits are affected. If some
error occur in parity bits then this scheme will not going to work.
Is it clear the concept of simple parity and 2D parity? Is it clear or not?
parity? Is it clear or not?
If anyone have any doubt you can ask me.
Now in simple parity it was we are just matching that even remains even or even changes into odd. If if the number of
ones remains same then the error goes undetected. If the number of one changed including the parity bit then we will detect the error. While in
case of 2D parity, we divide the message into equal parts, arrange it into rows and columns, check for the row parity and column parity and we will send this
whole row. Receiver going to rearrange
whole row. Receiver going to rearrange this this type of message into matrix again. We'll calculate the row and
again. We'll calculate the row and column parity again and we will and receiver going to check if there is a kind of intersection forming. If yes, if it found the mismatch between the
calculated parity and the received parity, receiver going to ask the sender to retransmit again. So this is how detection and correction happens in 2D parity.
Is it clear?
Okay. Then in the next lecture we'll begin with CRC.
Let's learn about cyclic codes.
In the previous lecture we have studied about linear block codes.
In this a valid code word exalt with valid code word will result into valid code word. What about cyclic codes? They
code word. What about cyclic codes? They
are a special type of linear block code in which cyclically shifting a bit will result into another valid code word.
Valid code word. cyclically shifted
will result into another valid code word.
For example, if it is written something like this C1 C2 C3 till CN CN C1 C2 C3 till CN minus one. This is
valid code word. This will also be a valid code word. What about this CN minus one CN C1 C2 CN minus2? This is
also a valid code word.
Okay, you know the difference between the linear block code and cyclic code. Is it
clear? Okay, now so today we'll move toward CRC cyclic redundancy check.
Now what will happen? Let me tell you with the help of a flowchart. So this is sender. This is a receiver.
sender. This is a receiver.
Sender have data and something called divisor. This
divisor is common between sender and receiver. They both know what divisor
receiver. They both know what divisor will be. Whatever will be the length of
will be. Whatever will be the length of division. Let's say K is the length of
division. Let's say K is the length of divisor. K minus one zeros will be
divisor. K minus one zeros will be appended. They are not added. They are
appended. They are not added. They are
appended. You know the difference between adding and appending.
1 0 1 0. Adding zeros is like something like this. 1 0 1 0. And appending zeros
like this. 1 0 1 0. And appending zeros is like this. Okay. So we are appending zeros and now this will be sent to
divisor for modulo to division.
Now what will happen? Diviser will give us the remainder. We call that as CRC.
Now these zeros are then replaced by CRC. So we will have data and the CRC.
CRC. So we will have data and the CRC.
This will become our code word and this will be transmitted.
This will be transmitted to receiver.
Now receiver have data and the CRC and it also has access to divisor. So it
will send this to divisor and divisor will calculate the remainder by performing the same modulo to
division and then remainder will be checked is it zero or it is non zero. If
it is zero then the data will be accepted and if it is non zero which means corruption has happened. receiver has
detected the error and it will ask for retransmission.
Is it clear? Let me repeat again. So
let's let's understand with the help of an example. Let's say we have a data
an example. Let's say we have a data 1 0 0 1 0 0 1 and we have CRC generator.
We call it as divisor also as 1 1 0 1. So you know what is k equals to 4. So we have to append k minus one
to 4. So we have to append k minus one zeros to data. So our new divisor will or the dividend will be dividend will be
1 0 0 1 0 0 1 and then k minus 1 0 which means three zeros will be appended here.
We know the divisor already. Diviser is
1 1 0 1. So we have to perform modulo two division. Let's see how does that
two division. Let's see how does that happen. 1 0 0 1
happen. 1 0 0 1 0 0 1 and then three zeros 1 1 0 1. Now
in modulo 2 division what we do? We use
exor instead of subtraction. So this
will come here 1 1 0 1 1 and 1 0. When the inputs are same it will output zero. When the inputs are different it will output one. In this
case input are different. So it will output one and then here 0 0 and then this will be copied here as it is 0 0 1
0 0 0.
Is it clear?
Do anyone have any doubt till now? You
can ask.
Now what will happen? This first zero will be ignored and then this will come here again. 1 1 0 1 0 1 0
here again. 1 1 0 1 0 1 0 This is 1 0 1 0 0 0. Till now is it clear?
Okay. Then we will repeat the same process. 1 1 0 1 0 and then 1 1 1 1 and
process. 1 1 0 1 0 and then 1 1 1 1 and then three zeros. Okay. Then again 1 1 0 1
0 0 1 0 0 0 and then 1 1 0 1 0 1
0 1 0 and then 1 1 1 0 0. It will output 0 1 1.
This is 1 1 0 0. Oh yeah, this is 1 1 0 1. So it will also output one. Now we
1. So it will also output one. Now we
have 11 one as the CRC.
Now this will be replacing these three bits.
So these instead of 0 0 0 it will be 1 1. Now what will be this part data and
1. Now what will be this part data and then CRC this will become
1 0 0 1 0 0 1 and then 1 1. This is now our code word. This will be transmitted to the receiver and then receiver will
perform the same module to division.
Let's do that.
So we have this. Okay, we can do it here only one one and then let me erase all this part.
That's all. now.
Okay. So,
0 1 0 0 and then this will be copied here. 0
0 1 1 1 and then 1 1 0 1 0 1 0 1 and then 0 1 1 1 1
0 1 0 1 1 and then 1 2 3 4 1's 1 1 0 1 0 0 1 0 1
1 1 0 1 This will 0 1 1 0 1 1 1 0 1 and this will be 0 0 0 0. This time remainder is
what? It's zero which means no error
what? It's zero which means no error accepted.
Is it clear? We have seen this case till now.
What about a case of error? What about a case of error?
Let's say this bit let's say this bit has been changed.
Receiver has received this Now what will happen? Receiver will
calculate this at at its part and then we will see that the remainder this time is not zero. Which means receiver will assume that corruption would have happened somewhere in between and
receiver will ask for retransmission.
Let's solve this again.
0 1 1 0 0 0 1 1 1 This will copied here as it is. Okay.
Then 1 1 0 1 0 0 and then 1 0 1 1 0 1. This is 0 again.
This is 1. This is 1. This is 0.
And these two will be copied here. So 1
1 will come. 1 1 0 1 0 0 0 0 and then one. This is not zero
one. This is not zero which means error has occurred.
Retransmission will be asked.
Is it clear? Now
okay. Now the same happens in the polomial notation also. Let's see the polinomial notation.
polinomial notation in CRC we call data word as dx and then code word as cx
and then let's say generator or divisor as gx and syndrome what is syndrome this is syndrome
and error as ex. Okay. So what we will do? How we'll apply CRC in polinomial
do? How we'll apply CRC in polinomial notation?
Wait a minute. Let's solve here. Now we
have to first determine the degree of gx. What was the first step in in this
gx. What was the first step in in this binary notation? We saw that what was
binary notation? We saw that what was the length of the divisor? If the length was four, we added k minus 1 0. If the
length was k, we added k minus 1 0. Same
thing we will replicate here. We have to first access the degree of this polinomial. Degree of generator or
polinomial. Degree of generator or divisor.
Let's say the degree is r.
Okay. Now we will determine we will determine what x raised to power r dx is. This is what appending is
appending of zeros. Okay. Then we will calculate this x raised to power r dx and then gx
and whatever will be the remainder let's say crc and then what will be the code word? code word will be x to power
code word? code word will be x to power r dx plus remainder.
This will become the code word. Is it
clear?
Okay, you do not forget this step. This
is important. This is like appending of zeros.
Now let's solve a question.
Let me take a new page here.
Let's say data word is 1 0 0 1 0 0 1. Let's say let's take the same data word. We will convert this
into polinomial.
This is x^0 x^ 1 x^2 x^ 3 4 5 6. So this
will be x^ 6 + x^ 3 + x^ 1. This is our data word.
And what was our generator or divisor?
Generator was 1. This is x^0, x^ 1, x^2 and x^ 3. So our generator is x^ 3 x^2 +
1. This is our generator and this is our
1. This is our generator and this is our data word. Now what is the degree of
data word. Now what is the degree of this generator? The degree is 3. So r
this generator? The degree is 3. So r
equ= to 3. Now we have to calculate the code word. What is code word? x^ 3 into
code word. What is code word? x^ 3 into data word. What is data word? X^ 6
data word. What is data word? X^ 6
and this. So this will be x^ 9 x^ 6 plus x^ 4.
Is it clear?
Yeah. Yeah. Yeah. You are correct. I
have made a mistake here. So this here should be one because the coefficient of x raised to power 0 is one. So it will one will come here. Here one one will
come. Yes. Yes. You have spot correctly.
come. Yes. Yes. You have spot correctly.
Uh okay. So this was our code word. Now
we will have to calculate the CRC X^ 9 X^ 6 and then X^ 3. What was our
generator? X^ 3 + X² + 1. We have to
generator? X^ 3 + X² + 1. We have to calculate here again how we going to do?
We have to cancel this X^ 9. So we the quotient will be x^ 6 x^ 9 x^ 8 and x^
6. We multiply this to this and then we
6. We multiply this to this and then we put it here. x^ 9 is gone. Then we have x^ 8 x^ 6.
This is also gone. So we'll have x^ 8 and x^ 3. That's it. Now
we have to create x^ 8. So it will be x^ 5. Now it will come x^ 8 x^ 7 and then
5. Now it will come x^ 8 x^ 7 and then x^ 5.
Okay. This will be gone. We have x^ 7 x^ 5 and then x^ 3. Now we have to create x^ 4. So that x^ 7 get cancelled. This
x^ 4. So that x^ 7 get cancelled. This
is canled. And then we'll have x^ 6 x^ 4. This is gone. X^ 6 5 4 and then 3.
4. This is gone. X^ 6 5 4 and then 3.
Then we'll have X^ 3. So we'll have now X raised to power what was that? 6
5 and X^ 3. This is gone. This is gone.
And this is gone. We'll have X^ 4 in the end.
So now this time here we'll have just X.
So x^ 4 x^ 4 + x^ 3 + x
this is gone x^ 3 + x then just one here then we'll have x^ 3
and then x² + 1. Now
x^ 3 is gone. We'll have x² + x + 1.
This is what crc is. Now this will be added to our divisor. What was our divisor?
Not divisor but the code word. What was
our code word? x^ 9 x^ 6 and then x^ 3.
This will be added here. So we'll have x² + x + 1.
This is our final code word. This will
be transmitted and receiver receives this. And what
receiver going to do? The same thing. X^
9 X^ 6 3 and then we'll divide it with the same division. What was that? XQ + X2 + 1
division. What was that? XQ + X2 + 1 XQ + X² + 1.
Okay, let's divide x^ 6. So 9 8 x^ 6. This is gone. We'll
x^ 6. So 9 8 x^ 6. This is gone. We'll
have x^ 8. This is also gone. X^ 3
and this we require X^ 5 X^ 8 and then X^ 7 X^ 5.
This is gone. We have x ^ 7 x^ 5 x cq x² x and then 1 and then
we require x^ 4. So x^ 7 x^ 6 and then x^ 4.
Now 5 4 3 2 1 and zero.
Then we'll require x^ 3 x^ 6 + x^ 5 + x^ 3.
This is gone. This is gone. This is
gone. We will have x 4 x² + x + 1. Then
we'll have x x^ 4 x cub and then x. This is gone.
And then we'll have x cub x² x and then 1. And then we'll have 1 x cq x² and
1. And then we'll have 1 x cq x² and then 1.
Then we'll have x. We made some mistake somewhere. X should have been cancelled
somewhere. X should have been cancelled here. Here, here. X was cancelled here.
here. Here, here. X was cancelled here.
So, this is just one. So, we'll have zero in the end. All of them will be cancelled.
So, it receives zero, which means accepted.
So by the time you may have guessed that doing like this in a polomial notation is lengthier and the chances of cell mistake are also more. So what is the
recommended method? You convert it into
recommended method? You convert it into code word. So not code word into binary.
code word. So not code word into binary.
So this will be 1 0 0 1 0 0 1 and then 1 1. Now you can do it very easily.
1. Now you can do it very easily.
In the end you will receive syndrome as zero. This is what syndrome was.
zero. This is what syndrome was.
Syndrome is zero.
Is it clear how CRC works? You have to remember this where that was.
You have to remember that flowchart which I made. It's lost
somewhere.
Let me find it. Here it is.
You have to remember this flowchart that in the beginning you would have data and a divisor which is shared among both sender and receiver.
So sender and receiver both have this divisor. And then by looking at the size
divisor. And then by looking at the size of divisor you're going to append one lesser zero. So if the size is k you can
lesser zero. So if the size is k you can append 6 - k 6 minus k minus 1 zeros and then divide this with the help of
divisor performing modulo two division you'll get the CRC append that CRC in place of those k minus one zeros and then you'll have your code word this code word will be transmitted to the
receiver receiver going to perform the same thing mod division with the same diviser and it will receive remainder if the remainder is zero which means
It has accepted. If the remainder is non zero, it will ask for retransmission.
Receiver will assume that error have happened somewhere.
Are you understanding the main theme or the main idea behind this concept?
How people have think of that? For
example, let's say if you divide 18 with four, what you'll get? You'll get four.
Fours are 16 and you'll receive two. Now
this two is the remainder.
If you are adding these two again at the dividend, what will happen? This will
become 20. And now when you are going to divide again, you will receive remainder as zero. This is what we are doing here.
as zero. This is what we are doing here.
We received some remainder and then we added that remainder back to the dividend and then we are dividing the dividend again with the same divisor and this time now we are receiving remainder
as zero. Look here we started with some
as zero. Look here we started with some we started with some dividend divided it received some remainder added it back and then divided again with the same
diviser we received the remainder as zero this process will work perfectly until some error happens what error that could happen instead of 18 it became let's say
19 now when two will be added it will become 21 and you will receive some remainder So by this I can assume that if there is
some remainder even after adding that two to the dividend again there is some remainder which means error has been there. Okay. So this was the concept of
there. Okay. So this was the concept of CRC. I hope it is clear. We have seen
CRC. I hope it is clear. We have seen both of them the binomial notation and polinomial notation. Now let's look at
polinomial notation. Now let's look at the last method for error detection which is checksum.
What we do in checksum? We break the original message into k number of blocks with n bits in each block. Let's say
this was the original message. We break
it in k number of blocks with n message n bits in each block. They are k blocks.
Okay. Now what we do? We do the sum of all k data blocks.
We do the sum of all k data blocks and we add the carry to the sum if there is n carry. So I can write if
any. So if there is any carry for
any. So if there is any carry for example you added and there is some carry you going to add this carry back
to this sum here again. Okay. And now of this sum what you have to do you have to take complement.
Which complement? 1's complement. What
do we do in 1's complement? We just
invert all the bits. So if we have 1 0 1 0, the 1's complement will be 0 1 0 1.
So we are inverting all the bits.
Is it clear what we are doing here? We will have a message. We'll divide it into key
message. We'll divide it into key blocks. We'll take the sum and if there
blocks. We'll take the sum and if there is a carry, we're going to add that back to the sum. And whatever be the resultant we want to take once's complement. Till now are the steps
complement. Till now are the steps clear? Yes. Okay. So after this
clear? Yes. Okay. So after this complement whatever be the number we call it as check sum.
Okay. So can you guess what we are planning to do here?
What we are planning is of all these blocks we're going to take a sum and of this sum once complement
means implementing or insisting a negative sign. So let's say if the sum is 44 then once complement
means we are sending minus 44 with this.
Now what receiver going to do? Receiver
going to take the sum again including the check some block also. So block one, block two, block three. These were the data blocks. Now receiver will also add
data blocks. Now receiver will also add the check some block. Let's say the sum of these are 44 as we have calculated before. And then
before. And then receiver going to add the minus 44 block also. And in the end, in the end what
also. And in the end, in the end what will happen? Let's say 0 0 0 will come.
will happen? Let's say 0 0 0 will come.
But as you know the steps will be same for both. It will also take one's
for both. It will also take one's complement of zero. So it will receive one one one one all. So if the result is all ones then we are going to accept
otherwise reject. Did you get it? Let me
otherwise reject. Did you get it? Let me
repeat again. We had a message. We
divided it the message into blocks.
Let's say this is block one, block two, block three, block four and block five.
We take the sum of all the blocks.
And then whatever be the number, let's say the number was 44. So what we going to do? We're going to implement a minus
to do? We're going to implement a minus sign to in front of 44. So this will become minus 44. How did we do that?
With the help of once complement. Now
we're going to attach another block. We
named it as block six. And we will add minus 44 here. Now this hole will be sent to the receiver. Receiver going to look at it and we'll divide in the same
fashion. B1, B2, B3, B4, B5 and B6. Also
fashion. B1, B2, B3, B4, B5 and B6. Also
receiver going to do the same.
1 to six and then it will receive zero and you know the process will remain same for both sender and receiver. So
what receiver will do? It will also do the on's complement. Now what is the on's complement of 0? 1 1 1. So 0 0 0 the on's complement will be 1 1. If it
is all one which means the result was zero which means error has not occurred. So it will accept otherwise it will reject.
Is it clear what we are planning to do here in checksum? Okay. So the why we do checksum because checksum detects all error in involving odd number of bits.
All odd number bits error are there. It
detects most error involving even number of bits. All odd error and most of the
of bits. All odd error and most of the even error are detected. If one or bits of a segment are damaged and the corresponding bit or bits of opposite value in the second segment are also
damaged then you know the sum of those columns will not change. So receiver
won't be able to detect those error.
That's why that's why I've written most error. But you know it's a rare
error. But you know it's a rare condition. It's a rare situation that
condition. It's a rare situation that the bits changes in a way that the sum did not change because all depends on the sum. If some error occurred and it
the sum. If some error occurred and it it is still remain minus 44 then receiver won't be able to detect it.
That's why we have written mostly even errors. While in the case of odd it will
errors. While in the case of odd it will never happen.
So all of the odd errors are detected and mostly the most of the even errors are detected. Is it clear how check sum
are detected. Is it clear how check sum is done? Now we can take a detailed
is done? Now we can take a detailed example with the help of binary numbers and all but you know you can do it yourself also.
You can take any number like 1 1 0 1 1 0 1 0 and then you can divide it into the parts. You can add them whatever be the
parts. You can add them whatever be the carry you add that back and whatever number you received you going to take one's complement and then you add this one complement back to
this number. If you receive zero which
this number. If you receive zero which means you are doing correct. You can
also try by changing some of the bit here. Let's change it to zero. In that
here. Let's change it to zero. In that
case you'll find that you won't be able to get zero in the answer. It's an easy thing. It's not that important. Check
thing. It's not that important. Check
sum is not that important. CRC was
that's why I've taken numerous example on CRC.
You have to understand the concept behind CRC and checksum. Okay,
is it clear so this was the end of our error control. I've given you the DPP
error control. I've given you the DPP you can solve. In the next lecture we're going to begin with flow control. In the
last lecture we have discussed your doubts from the DPP and IP addressing and error control lectures. In this
lecture, we'll begin our new module which is flow control. This is our module three.
Okay. We'll begin with the concept of bandwidth.
What is bandwidth? Let's say we have the sender and the receiver. Let's name it like this. Sender and receiver. This is
like this. Sender and receiver. This is
our transmission medium and we have our message.
Now the time taken the time taken by the sender to place this message on the link is what transmission delay is. The time
taken by the sender to place this message on the link is what transmission delay is. What is bandwidth? Number of
delay is. What is bandwidth? Number of
bits you can place in 1 second. Number
of bits placed per second.
This is what bandwidth is. So let's say if the message size is 100 bits and the bandwidth is let's say 1 bit per second
then the time taken will be time taken will be 100 seconds. You are
placing one bit in 1 second and there are 100 bits so time taken will be 100 seconds. So how did we come up with that
seconds. So how did we come up with that uh transmission delay? We can also make the formula message length or we call it as L message length divided by the
bandwidth.
This is the formula of transmission delay. Okay. Now what about propagation
delay. Okay. Now what about propagation delay? What is propagation delay? The
delay? What is propagation delay? The
time taken by the message to reach from sender to receiver is what propagation delay is. So this will be distance
delay is. So this will be distance upon speed. Let's say the speed is 10
upon speed. Let's say the speed is 10 m/s and let's say the distance is 30 m.
So what will be the propagation delay? 3
seconds.
Is it clear? So transmission delay was 100 seconds and propagation delay was 3 seconds.
Okay.
So we have understood the concept of bandwidth. What is bandwidth? Bandwidth
bandwidth. What is bandwidth? Bandwidth
represent the rate at which number of bits are placed on the link in 1 second.
What is velocity? It represent the rate or distance covered in 1 second.
Okay, is it clear? Now you may have the doubt that are these 100 bits are placed in one go
or it is placed like bit by bit. So the
answer is it's placed bit by bit. As
soon as one bit is placed on the link, it start moving and then another bit is placed on the link it start moving.
Okay. So it doesn't work like this that 100 seconds are needed to place them on the link and then each bit each bit take 3
second. So it's going to take 300
second. So it's going to take 300 seconds for 100 bits. So 300 + 100 equals to 400 seconds. No, it doesn't work that way. Have you heard of the
concept of pipelining?
What is pipelining? Have you heard of the concept?
Yes. Things go parallelly. Things go
parallelly. As soon as the bit is placed on the link start moving and as the first bit is reaching the sender, the second bit would be somewhere in the
bitman. Okay. So this 3 second, the last
bitman. Okay. So this 3 second, the last 3 second which we are adding is of just the last bit.
Okay. If you think more about it, you'll get the idea. Both works are going on parallelly. In the same time, bits are
parallelly. In the same time, bits are also moving and another other bits are also getting placed at the transmission medium.
This three bit 3 second is of the last bit. Okay. Now let's understand more. We
bit. Okay. Now let's understand more. We
have learned for transmission delay what is propagation delay. Now there are other delays also like queuing delay and processing delay. Processing delay.
processing delay. Processing delay.
Okay. Let me repeat again. What is
transmission delay? Amount of time taken to transfer a packet on to the outgoing link is called transmission delay. What
is what was the formula of transmission delay? Length of the message divided by
delay? Length of the message divided by the bandwidth.
Let's solve more problems on this. Uh
suppose this is our sender. This is our receiver and packet size is let's say 1,000 bits
and the bandwidth is 2 bits per second.
So what will be the transmission delay?
What will be the transmission delay? 500
seconds. We just divide it L by bandwidth. 500 second will be the
bandwidth. 500 second will be the transmission delay. Is it clear? So you
transmission delay. Is it clear? So you
have to remember the formula. Packet
size or length of the packet divided by bandwidth.
Okay. Now I I think I need to clarify this. What is kilo? What is mega? And
this. What is kilo? What is mega? And
what is giga? So when you are talking about data and when you are talking about bandwidth they both represent different things.
This is very important concept they both represent different things. So in case of data kilo represents 2^ 10 which is 1024.
Mega represents 2^ 20 which is 1024 into 1024. and giga represent 2^ 30 which is
1024. and giga represent 2^ 30 which is 1024 raised to power 3 while in case of bandwidth kilo
represents 10^ 3 mega represents 10^ 6 and giga represent 10^ 3 is it clear
is it clear so let's say if I give you this question l is 8 k bits and the bandwidth is also 8 kbps
What will be the transmission delay? Is
it 1 second? Okay, tell me this.
Tell me this. What will be the number?
I hope you all know the meaning of this.
This is ceiling function. So, what will be the number? What will be the answer of this?
This K represents here 1024 and this K represents here just 1,000. So this will be like this 1.024.
This will be two.
Did you get it? So if someone ask what is the transmission delay? You'll reply
1.024 seconds.
Okay. Now what is propagation delay?
Amount of time taken to reach a packet from one point to another point. This is
called propagation delay. How we
calculate this?
distance upon speed.
Is it clear? So you can uh write the formula of propagation delay is distance upon velocity.
Okay. So the total time taken to send a packet from A to B will be transmission delay plus propagation delay. Now what
about this queueing delay? What is
queuing delay? And what is the formula of queuing delay? So the answer is there is no generalized formula of queuing delay.
There's no generalized formula for queuing delay. Now what is queueing
queuing delay. Now what is queueing delay? Quing delay is the amount of time
delay? Quing delay is the amount of time the amount of time packet will wait in a queue at the router before being taken up for the processing is called queuing
delay. It's called queuing delay. So uh
delay. It's called queuing delay. So uh
every router or even receiver also have a buffer queue. a buffer Q where if the speed of the sending is more and speed
of processing or contemplating by the uh receiver or the router is less then what will happen? The packet will start
will happen? The packet will start waiting at the waiting queue or the buffer queue.
You may have heard the line that the buffer is full, the buffer is full, the start the packets will start getting lost. So this is what buffer means at
lost. So this is what buffer means at the router or the receiver if the speed of sending is more and speed of processing is less then
the packets will keep on arriving and they will wait in the buffer queue.
Okay. So the amount of time the packet has wait in the buffer queue before taken up for the processing is what queueing delay.
Is it clear? So there's no generalized formula for this. Now we'll move ahead.
Now we'll move ahead. Uh or should I clarify something before.
Let me clarify these things.
We have t we have talked about the OSI layer OSI model. We heard that there was a data link layer in between. In data
link layer we discussed that it was node to node layer or you can say hop to hop layer.
Okay. network layer we discussed that it was source host to destination host destination host and transportier was a
bit further it was end to end or process to process discussion end to end or process to process discussion in data link layer we had MAC address of
48 bits in network layer we have IP address of 32 bits.
In transport layer, we have port number of 16 bits.
Okay, is it clear? Let me let me revise you again. For the OSI model, we had
you again. For the OSI model, we had these layers. Application layer,
these layers. Application layer, presentation layer, session layer, and then transport layer, network layer, data link layer, and then
physical layer. Okay. And then in TCP IP
physical layer. Okay. And then in TCP IP mode, we have combined these into a single application layer.
And then we directly have transport layer, network layer, data link layer and physical layer.
Is it clear?
Is it clear? So what happened?
During router when the packets are received to routers router will only require the services till network layer while the receiver and the sender will
require the services of application layer also. So router will only require
layer also. So router will only require the services of network layer. So what
happens when the packet received when the packets are received by the routers and router is busy with processing of some different layer. Let's say router is busy with interacting with detail
link layer or network layer and there is another packet at arrival. So what will happen? The packet will first wait in
happen? The packet will first wait in the queue and then when this packet will be processed it will send forward or it will be forwarded. Now when another
packet was waiting in the queue that was what the queueing delay was and when the packet is being processed by these three layers of the router we call it as
processing delay.
Processing delay.
Is it clear?
So the processing delay is the time required for router or we can also discuss for the destination node. The
same thing happen with the destination node also or the receiver also. receiver
or router.
Okay, anything could be in between. For
example, we needed some intermediary node in between. So, we are then discussing about the router. If it's
direct connection, then we are discussing about the receiver. So,
processing delay is the time required by the receiver or the router to receive a package from its input port and remove the header, perform the error
detection procedure. This is what
detection procedure. This is what happening here. remove the header,
happening here. remove the header, perform the error detection procedure and deliver the packet to the deliver the packet to the let's say or forward the packet or if it is if it is
receiver then it will send the packet to the above layers upper layer protocol in case of destination host and if it is a router then it will send the packet to the
output port. If it is a router
output port. If it is a router then it will be received at the input port will be processed here and it will be sent to the output port. In case of
receiver packet will be received and will be sent to the upper layers.
So this time is what processing delay is.
If it is waiting in the queue then it is queuing delay. If it is getting
queuing delay. If it is getting processed then it will be processing delay. Is it
clear? Let me also also made make a diagram for you so that so that you can understand better. Let's take TCP IP
understand better. Let's take TCP IP only. So we have application layer,
only. So we have application layer, transport layer, network layer, data link layer and physical layer. And let's
say we have an intermediary node in between we call it as router one. And
let's say another node we call it as router two. And then we have send
router two. And then we have send receiver.
This was sender. And the receiver also have same set of layer. Application
layer, transport layer, network layer, data link layer and physical layer. So
what happens?
Application layer will start the uses of application layer and then we'll move to a transport layer, network layer, data link layer, physical layer and then the packet will
be forwarded on this link. The packet
will re reach the router one. Now router
is a kind of device. We're going to study all the devices later like router hub and all these things which require the services till network layer only data link layer and network
layer. Why?
layer. Why?
Why? Because it doesn't have to process.
It doesn't have to process till the application layer and transport layer.
It doesn't require the services of application and transport layer. What is
the work of router? Forwarding the
packet to the responsible uh either router or receiver.
So application layer, transport layer, network layer, data link layer, physical layer all are used in case of sender.
But physical layer, data link layer, network layer and then again data link layer, physical layer they will be used at the router one. Same case will happen physical layer, data link layer, network
layer and then again data link layer, physical layer and then when it will reach the receiver it will use physical layer, data link layer, network layer and then transport layer and application
layer.
Is it clear?
So we have kind of gone the off topic. I
just wanted to explain you how what what do I mean by processing when when I'm going to say that there will be processing delay. So what do I mean by
processing delay. So what do I mean by processing this this concept I was explaining to you. Okay. Now let's move back to the delays. So we have discussed
these delays. Trans transmission delay L
these delays. Trans transmission delay L by bandwidth.
Propagation delay distance upon speed.
Queuing delay the amount of time a packet has waited in the queue and processing delay is the amount of time taken by the router or the receiver to accept the packet into the input port,
process it and send it to the output port. Okay, we do not have formula of
port. Okay, we do not have formula of these two. They will be either given in
these two. They will be either given in the question or we have to ignore them.
If they are not given in the question then you have to ignore them.
Is it clear? So let me give you a tip for the DPP problems that in most of the questions of flow control when we were talking about the
delay problems what you're going to face is they will try to they will try to play in the game of unit conversion.
Okay they'll try to play in the game of unit conversion. They will g give some
unit conversion. They will g give some data in kbps.
Sometime they will write k bps. What is
b and what is small b? The small b mean bits and the bigger v means bytes which means 8 bits.
Sometimes you will forget that for data you have to take 1024 and for bandwidth you have to take 1,000.
So you have to be very careful in these concepts of unit conversions and you have to be careful while solving.
Let's solve some of the problems here.
Let's say the packet size is 1 KB and the channel capacity is 10^ 9 bits per second. So sometime bandwidth is also
second. So sometime bandwidth is also called channel capacity. Then what is the transmission time? You can directly solve what it will be.
No need for exact answer. You can give me approximate also.
Okay. So
this is like 1024 bytes and then you have to convert it into bits. Now it is bits. Then 10^ 9
bits per second.
So this will be 81 92 divided by 10^ 3 into 10 ^ 6 second. Now this will be microcond and this will be 8.1 192
microcond.
Let's solve another question.
We'll solve here. Consider a 100 Mbps link link between uh let's say earth
station we call it as sender and the receiver is satellite this is receiver and we have 100 Mbps
links which means this is bandwidth and the receiver is the is at altitude of let's say 2100 kilm mters
and the signal propagates at the speed of let's take the speed of light 10^ 8 m/s.
Okay. Now the time taken for the receiver to completely receive a packet of 100 bytes
transmitted by the sender will be okay. Try to calculate the time taken by
okay. Try to calculate the time taken by the receiver to completely receive a packet of 1,000 bytes will be.
It's an easy question. You just have to put up the formulas and you'll get the answer.
So where you will begin and you will write the formula. What is the time taken? The time taken will be
taken? The time taken will be transmission delay and propagation delay because the receiver do not have to process here. receiver is just
process here. receiver is just receiving. We have to tell the time till
receiving. We have to tell the time till the receiver have received the packet.
We will ignore the scenario where it will queueing and processing and all these things and the queueing delay and prop processing and delay are not in the question. So you are going to ignore
question. So you are going to ignore them already. Now calculate the
them already. Now calculate the transmission delay. You know the formula
transmission delay. You know the formula L by bandwidth and the processing uh not processing delay but propagation delay.
You know the formula distance upon speed.
What is the distance? The distance is 2100 kilometers.
And what is the speed? Speed is 3 into 10^ 8 m/s. So you can convert it either into kilometer or convert that into meter. So let's convert it into kilome.
meter. So let's convert it into kilome.
So this will be 5 kilm/s.
Now what is the packet size? Packet size
is 1,000 bytes. And what is bandwidth in bandwidth is in bits. So you can convert the packet into bits. So you will write
8,000 bits.
Now you can solve this is so easy. Now
tell me the answer.
Why so much time you are taking man?
This is so easy. What is propagation delay? Just the division of them. So
delay? Just the division of them. So
this will be 7 into 10^ - 3 second or 7 millisecond.
Now what is the transmission delay?
Length by bandwidth. So 8,000 divided by 100 into 10^ 6 bits per second. So you
cancel this and then and then it will be like 0.08 millisecond.
How do we go up with 0.08? This is 10^ 3 and this is 1,000. This is cancel. This
is 0.08 and this is millisecond. So what
is the total time taken? 7.08
millisecond.
Did you get it?
Okay, we have a question that here in this in these layers does transferring the data from application layer to
presentation layer also takes time. Is
it what you're asking?
No, no, no, no. This doesn't happen like this. Actually, it's not some kind of
this. Actually, it's not some kind of transfer. Let me explain you. Let me
transfer. Let me explain you. Let me
explain you. It's a nice question. Okay,
this is very natural to ask this. For
example, we started with application layer. We had a message let's say hi.
layer. We had a message let's say hi.
Okay, now when it will be transferred to transport layer, it's not kind of transferred. It just transport layer
transferred. It just transport layer also has the access at the same time. So
what transport layer will do? Transport
layer will add a header.
We'll add a header. Now this message is here and transport layer will just add the header.
Okay. And we call this this is called message and this is called let's say segment
in the case of TCP and datagram in the case of UDP.
Okay. Now what happens when it goes to network layer this remains here and network layer also had add its own
header. So this is called
header. So this is called you can also call this as a diagram or packets.
Now same thing happen again in data link layer header is added but there's some special thing in data link
layer trailer is also headed added okay and then this whole thing will be converted into stream
stream of bits by physical layer.
So in this manner the things goes down.
Why we are studying flow control?
Because flow control coordinate the amount of data that can be sent before receiving the acknowledgement. What is
acknowledgement? It's like a kind of special message that receiver sends to the sender that I have received whatever you have sent.
Okay. So what does flow control co flow control coordinates? It coordinate the
control coordinates? It coordinate the amount of data that can be sent before receiving the acknowledgement. See
sometimes what happens that sender is sending the data and receiver is receiving it. What receiver do while
receiving it. What receiver do while receiving it process the data and processing takes time while sender is just sending it. So sender may send it
it at a very high speed. Receiver have a queueing Q for storing those packets while receiver is busy. So we have a
buffer Q. But what happens? Sender is
buffer Q. But what happens? Sender is
sending at a very high speed that the receiver will get overflammed even with the queue. The queue will be soon full
the queue. The queue will be soon full and the packets will start getting dropped. We will lose those packets. So
dropped. We will lose those packets. So
this need to be coordinated that receiver should immediately message the sender that he's getting overwhelmed.
You have to reduce your speed.
Okay. So, flow control coordinate the amount of data that can be sent before receiving the acknowledgement.
It's a it's a kind of procedure that tells the sender how much data it can transmit before it must wait for an acknowledgement by the receiver.
Otherwise, if it is just keep on sending it, the receiver may lose the data.
Okay? Because receiver has a limited speed at which it can process process what process the incoming data and limited amount of memory to which it
can store the incoming data. So receiver
must inform the sender before the limits are reached and request that the transmitter to send fewer frames or stop temporarily.
Okay, it can message to either reduce your speed or you have to stop temporarily so that I can clear up the buffer by processing those packets.
Since the rate of processing is often slower than the rate of transmission, so receiver has a block of memory, we we call it as buffer to store incoming data until they are processed. So receiver
will say you have to stop until I process these packets which are already present here in the buffer ready to be processed.
Okay, is it clear? Now, how do we manage all these things? So, we have several protocols. Protocols inflow control.
protocols. Protocols inflow control.
Okay.
So, we will discuss three protocols.
Stop and wait, go back in and selective repeat.
Selective repeat or reject.
Okay. We call it as ARQ ARQ ARQ. So we will learn these
ARQ ARQ. So we will learn these protocols in the next lecture. Till now
if you have any doubt you can ask me.
Okay. So we'll meet tomorrow in the next lecture. In the last lecture we have
lecture. In the last lecture we have discussed about the delays and the core logic of flow control.
In this lecture, we'll begin with the protocols involved in the flow control mechanisms. The first one is stop and wait. As the
name suggest, what we do? Here is the sender. Here is the receiver. Sender
sender. Here is the receiver. Sender
send some data packet and the receiver will send the acknowledgement. Until the
acknowledgement is not received, sender is not going to send another data packet. So what will happen at the
packet. So what will happen at the sender side? Sender sends one data
sender side? Sender sends one data packet at a time and will send the next packet only after receiving the acknowledgement for the previous data packet.
If the acknowledgement for the previous data packet has come, then it will send another data packet. Is this clear? Now
what will happen at the receiver side?
Receive and consume the data packet. And
after consuming the data packet, acknowledgement must be sent. These are
the two rules for the sender side and the receiver side. at the primitive primitive stop and wait. Let me repeat again. Sender will send the data packet
again. Sender will send the data packet and receiver will acknowledge it. Until
the acknowledgement has not come from for the previous data packet, it will not send the next data packet. Is it
clear?
Okay. Now there can be some problems with this mechanism. The first problem is what if the data packet sent by the receiver has
lost somewhere due to noise. Sender wait
for the acknowledgement for infinite amount of time and receiver will wait for the data packet for the infinite amount of time. They will be stuck in deadlock.
They will be stuck in deadlock. Okay,
this is the first problem which we can encounter which is of lost data packet.
Okay. Now what about the second problem?
Second problem which can be data package has reached but acknowledgement lost in between because acknowledgement is also a packet and it could be lost due to noise. Now what happened?
noise. Now what happened?
Acknowledgement is lost in between. So
now sender will wait for infinite amount of time for the acknowledgement. So this
is the problem of lost acknowledgement.
Now what about the third problem? The
third problem is delayed acknowledgement. What happened?
delayed acknowledgement. What happened?
For example, the acknowledgement got delayed. So
sender may assume this acknowledgement for some other packet.
So delayed acknowledgement might be wrongly considered as an acknowledgement for some other packet. So the third problem which could be of delayed acknowledgement.
So these are the three problems that need to be addressed or resolved by using the new concept of stop and wait
ARQ.
ARQ what is ARQ? ARQ means automatic automatic repeat request.
What is this? that
let's say if data package is lost somewhere in between then sender will set a timer because receiver do not know that sender has sent the packet so it will not send
the acknowledgement so what will sender do sender will set a timer when the limit will be reached sender assumes that either the acknowledgement is lost or my data packet is lost I have to send
it again sender will send again so this is what automatic repeat request is okay. So let me give you some
okay. So let me give you some theoretical points. So first of all this
theoretical points. So first of all this stop and wait is a mechanism for flow control.
You know it could also be used for error control. How error control? If error is
control. How error control? If error is detected then stop and wait uh stop how error control is done. Let's understand error control
is done. Let's understand error control in stop and wait ERQ is done by keeping a copy of sent frame. So whatever frame is sent the sender will keep a copy of this until it receives an
acknowledgement and sender start a timer when it send a frame. If acknowledgement
is not received within the time frame then the sender assumes that the frame was lost or damaged or some error has occurred because you know even if even
if the packet has reached the receiver if there is error receiver will discard it silently.
Discard silently.
Sender will never know what was the case. The case was of lost data packet
case. The case was of lost data packet or the lost acknowledgement or the case was of error. Sender won't be able to know because receiver discards silently.
Receiver do not send another data packet to say that there has been some error.
You have to retransmit. Receiver will
discard silently. Sender has a timer with itself. Sender will notice during
with itself. Sender will notice during that timer that acknowledgement has not come. So sender
will retransmit again. So in this manner flow control and error control both are achieved with the help of stop and weight.
Okay receiver sends an acknowledgement to the sender. If it receives the frame correctly without any error okay and suppose if some error has
occurred then send the sender will keep a timer and will retransmit again when the timer is reached.
Okay. Now about acknowledgement.
Acknowledgement is always of the next expected frame.
Next expected frame.
For example, you have data packets in this manner.
Let's say 2000 2001 2002 in this manner. So when you will send 2,000 to the receiver, receiver will not
say yes, I have received 2,000. You can
send me 2001. Receiver will directly write here give me 2001. When 2001 will be sent to the receiver, receiver will directly ask for 2002.
Things goes in this manner. So
acknowledgement will always be of the next expected frame.
It's like I've got this, you can send the next. I've got this, you can send
the next. I've got this, you can send the next. So it will always be of next
the next. So it will always be of next expected frame.
And until the sender receives the acknowledgement from the receiver, it will keep the copy of the message sent in its buffer.
Is it clear? So things goes like this.
Packet sent data packet but it has not uh received by the receiver. It it was lost somewhere in between. We have a timer let's say of 60cond after that and
we also have kept the copy of the packet which was sent so that if some problem arise this copy can be used here again to send again and this time it has
reached another copy is also maintained.
The packet is sent and acknowledgement received. Now this time the copy can be
received. Now this time the copy can be deleted because the receiver have this packet. Okay. So until acknowledgement
packet. Okay. So until acknowledgement is received the copy will not be deleted. Now this ERQ works on this stop
deleted. Now this ERQ works on this stop and wait ERQ have stop and wait stop and wait timer
so that buffer may not be full. This is
the actual flow control mechanism. Flow
control. This stop and wait is for flow control that you will not send another frame until you received the acroagement of the previous frame. The next concept which is included in this is timeout
timer.
This will prevent you from getting stuck in the deadlock so that sender and receiver may not wait for infinite amount of time. What will
be the third concept? The third concept will be of sequence number so that duplicate packets may not be received.
These sequence number are necessary.
Sequence number of the data. What is the fourth concept? Sequence number of
fourth concept? Sequence number of acknowledgement data and sequence number of acknowledgement.
So that sender may know that which packet has received and which packet need to be sent again.
Is it clear?
Let me explain you how they are working as a solution. So first solution lost data packet.
Lost data packet.
What happens? We have
this data packet which was lost in between. Now we have timeout timer.
between. Now we have timeout timer.
As the timeout timer expired, the data packet will be sent again. So no
deadlock. No problem of deadlock. So
stop and wait plus timeout timer will protect you from deadlock. What about
lost acknowledgement problem?
What about lost acknowledgement? You
send the data packet. Acknowledgement
was lost somewhere in between. You send
the data packet again. Now receiver have received the duplicate packet. Suppose
if you didn't didn't have the sequence number of data, receiver will never know that it has received a duplicate packet until the processing happens and all
these things.
Did you get it? That's why sequence number of data was necessary.
Okay.
So what about loss acknowledgement? As we
have sequence number of data packet, we have time out sequence number concept, sequence number of data packet, we have the concept of stop and wait and we have
the concept of timeout timer.
The loss acknowledgement packet can be solved because this time this time receiver rejects the data packet by saying that it is duplicate.
Receiver rejects the duplicate data packet and this time it will send the acknowledgement again that I have already received that data packet. You can skip it.
packet. You can skip it.
Send me the next. Acknowledgement is all always off next.
Okay.
Now what about the third problem?
Delayed acknowledgement.
See this suppose we have a data packet one.
Okay.
And then receiver has sent the acknowledgement but due to noise it got delayed.
What sender will do? Timeout will expire and it will send the data packet again.
data packet rejected by the receiver by claiming it to be duplicate and then it will send the acknowledgement by saying that I have already received this data packet
you can send me the next but but this acknowledgement came late and before that data packet two was sent due to this acknowledgement as receiver already told that I have received the
data packet you can send me data packet two so this acknowledgement will come here and when the sender will send data packet to this was lost somewhere in
between but acknowledgement from here came.
So what sender sender will assume?
Sender will assume that receiver has received this. So it will send data
received this. So it will send data packet three and receiver will never know that the sender has already sent data packet two and sender is thinking that receiver have received the data
packet two. What is the solution that
packet two. What is the solution that you mark the acknowledgement by giving them number also just like the sequence number for the data. What we will do? We
will give me we will give these acknowledgement the sequence number.
Okay. So this time it is not just acknowledgement it will ask for acknowledgement for data packet two. So
when data packet two will be sent and then the acknowledgement for data packet 2 will come here again.
Yeah, I want data packet 2. And this
time sender will know that receiver is again asking for data packet 2 which means this data packet 2 was lost somewhere. So instead of data packet 3,
somewhere. So instead of data packet 3, this time it will send data packet two only. Is it clear? Let me clarify all
only. Is it clear? Let me clarify all these three problems again. So the first problem was lost data packet. How we
solve this? With the help of timeout timer. In the first case when there was
timer. In the first case when there was just stop and wait not the ARQ. these
cases this is what this is what stop and wait ARQ is. Apart from that if it is just stop and wait then it is just stop
and wait. These things make stop and
and wait. These things make stop and wait as stop and wait ARQ. Okay. So we
are solving the first loss data bagget problem with the help of stop and wait concept and timeout timer. With the help of timeout timer the sender and receiver do not have to
wait indefinitely.
Okay. Because if there was no timeout timer, receiver will be waiting for the data packet and sender will be waiting for the acknowledgement. Second problem,
lost acknowledgement. How are you going to solve that? With the help of sequence number on the data packet, stop and wait and timeout timer.
Okay. And how we going to solve the delayed acknowledgement, stop and wait concept?
This was the core. And then time up timer for no deadlock. And then sequence number
no deadlock. And then sequence number for no duplicate packet.
And then sequence number for acknowledgement for no delayed acknowledgement problem.
Is it clear?
So what does ARQ means? It could be like automatic request query. It ask again and again again and again.
Okay.
Now let's understand the time aspect of stop and wait.
Let's say this is our sender and this is our receiver.
Okay, let name it as A and this as B.
What happens? We have a link in between.
Now A has a frame to share.
A will transfer this frame onto the link and this will be the transmission delay and this frame will be sent over this
link to this receiver B and the time taken by frame to reach to the receiver B will be propagation delay of the frame.
Okay.
And now what will happen?
frame will reach the receiver that is B and queuing delay and processing delay will also be included here. Processing
delay will also be included here and then what will happen? B have
acknowledgement.
B will transfer this acknowledgement on this link and acknowledgement will travel. This is
propagation delay of acknowledgement and then A will receive the acknowledgement. So what will be the
acknowledgement. So what will be the total time here? The total time here will be transmission delay of the frame,
propagation delay of the frame, queueing delay of the frame, propagation not propagation, we have already counted it. Processing delay of the frame
it. Processing delay of the frame and then transmission delay of acknowledgement and then propagation delay of acknowledgement.
This is what the total time it will take for the whole process. Do you agree with this or you have any problem?
You have any doubt you can ask. Now let
me repeat again. What happens? We have
this frame. First of all the frame will be transferred here onto this uh link.
So the time taken will be transmission delay. Now this frame will travel to the
delay. Now this frame will travel to the receiver B. Time taken will be
receiver B. Time taken will be propagation delay. And this will wait in
propagation delay. And this will wait in the queue or it will take the time to process. So the queueing delay and
process. So the queueing delay and processing delay will also be included.
And then what will happen? B will
generate the acknowledgement.
Acknowledgement will be transferred onto this link. So the transmission delay of
this link. So the transmission delay of acknowledgement will also come and then the acknowledgement will travel from B to A again. So propagation delay of
acknowledgement will also come. Now what
you can tell is propagation delay does not depend upon the size of message.
It depends upon what? It depends upon the link speed. It depends upon the link speed or the velocity and it depends on the distance. So the distance between A
the distance. So the distance between A and B remains the same in both cases.
The distance remains the same and the velocity also remains the same because link is same. So I can say propagation delay for the frame or the acknowledgement will be the same. So
what I can do I can just multiply it by two and remove this.
Is it clear? Okay. Now in some cases what happens? Transmission delay of
what happens? Transmission delay of acknowledgement is way way way smaller than the transmission delay of frame. Why? So
can anyone think why so?
This is an easy question. Very easy
question. Why do you think the acknowledgement delay acknowledgement acknowledgements transmission delay is lesser than the frames transmission delay? Why do you think so?
delay? Why do you think so?
If you're not able to understand this concept, try to convert this into formula.
What was the formula of transmission delay?
Message upon bandwidth.
Message of acknowledgement is less less less than message of frame divide by bandwidth. You can cancel the bandwidth.
bandwidth. You can cancel the bandwidth.
What do we know here that the acknowledgement size is way lesser than the frame size? Because in
acknowledgement you just mention the number that I want the next frame now.
But in the frame we have the full message. So message size is way greater
message. So message size is way greater than the acknowledgement size. So in
some cases what we do we ignore this we ignore this and in some cases these are also ignored.
So what we have the approximated formula of the total time transmission delay of frame plus 2 into propagation delay.
Okay, this is the total time taken by the frame to be to be transferred on the link and then sent to B and then acknowledgement to be transferred on the
link and then sent to A. This is the total time. Now there comes a concept of
total time. Now there comes a concept of efficiency.
What is efficiency? Useful time
upon total time.
And we see or we perceive this efficiency with respect to sender.
And when we are talking about the useful time, we are talking about the time at which sender was doing the work. So out
of these times which I mentioned the transmission delay of frame, the propagation delay of frame, queuing delay, prop uh processing delay, transmission delay of acknowledgement and then propagation delay of
acknowledgement. Where do you think
acknowledgement. Where do you think sender was functional?
Some people are mentioning transmission delay and propagation delay. No, sender
is not responsible for this propagation.
Sender is not responsible for the propagation. Sender is just responsible
propagation. Sender is just responsible for transmitting or transferring the frame onto the link and the link will manage the propagation
part. It is the duty of transmission
part. It is the duty of transmission medium to propagate the frame from one point to another. Sender's work is just
to transfer the frame onto the link.
So what was the useful time according to the sender? Transmission delay of frame.
the sender? Transmission delay of frame.
And what is the total time? Transmission
delay of frame plus 2 into propagation delay. You can also write like this one
delay. You can also write like this one upon you take this downward transmission delay of frame upon transmission delay of frame plus 2 into propagation delay
upon transmission delay of frame.
So you can write like this 1 upon 1 + 2 propagation delay upon transmission delay and you call this as a we are giving just a name so that
formula may look simpler. So this
becomes 1 + 2 a. So this is the efficiency of stop and wait.
Is it clear?
The total time is also known as round trip time.
Round trip time because it goes and then comes back. The data packet goes and
comes back. The data packet goes and acknowledgement comes back. So this
total pack this total time is called the round trip time.
Okay, let me repeat again so that you may understand better. What is the total time? Transmission delay of frame.
time? Transmission delay of frame.
Propagation delay of frame and then queuing delay of frame. Processing delay
of frame and then transmission delay of acknowledgement and the processing delay of and the propagation delay of acknowledgement
not the processing delay because processing will happen at the sender side of acknowledgement.
So we are not considering that part. We
are just considering roundtrip time in which the sender start transferring the frame onto the bandwidth or the link and
the link will take the frame to the receiver. Receiver will generate the
receiver. Receiver will generate the acknowledgement. Acknowledgement will be
acknowledgement. Acknowledgement will be sent over the link which will include transmission delay of the acknowledgement and propagation delay of the acknowledgement.
We are considering just this time. We
call this as the total time.
or the roundtrip time. Okay. Now this
and this is same propagation delay do not depend upon the message size. So
propagation delay will remain the same for for the frame and the acknowledgement. So you can just write
acknowledgement. So you can just write propagation delay into two. Now
transmission delay of acknowledgement and transmission delay of frame they have a very large uh difference between them. So transmission delay of frame is
them. So transmission delay of frame is way way way larger than transmission delay of acknowledgement. So you can just ignore this acknowledgement.
Chewing delay and processing delay if they are mentioned you will count.
Generally you will notice that they are not mentioned. So you're going to ignore
not mentioned. So you're going to ignore that also. So what is roundtrip time?
that also. So what is roundtrip time?
Now transmission delay plus 2 into propagation delay. And now
now what is the efficiency? Useful time
upon total time. What is useful time?
Just the transmission delay of frame because this was the time only when sender was working. So transmission
delay upon transmission delay plus 2 into propagation delay. This becomes 1 + 2 a where a is propagation delay upon transmission delay.
Is it clear?
Do you have any doubt? You can ask now.
Okay. So
we represent efficiency using this symbol.
We also call efficiency as line utilization or you can also call it as link utilization or sender utilization.
Okay. And you must remember you must remember that this is an approximated formula not the exact formula.
approximated formula.
Is it clear?
So you can just write simply as efficiency equals to 1 + 2 a in approximation.
Okay. Now you may heard of another name that throughput. What is throughput?
that throughput. What is throughput?
Throughput.
Throughput is effective bandwidth or bandwidth utilization or maximum data rate possible. You'll hear the
rate possible. You'll hear the throughput with different name. And what
does it mean? Frame size
divided by the roundtrip time. If let's
say in some different protocol 10 frames were transmitted. So we'll just multiply
were transmitted. So we'll just multiply by this 10. So what is throughoot? the
number of bits transmitted in one round trip time.
So you can write like this frame size upon round trip time.
Okay.
Now you have a homework. You have to set up a relation between throughput, efficiency and bandwidth. We'll discuss
it in the next lecture. What is the relation between throughput efficiency and bandwidth? You have all the
and bandwidth? You have all the formulas. You have to set up a relation.
formulas. You have to set up a relation.
Is it clear?
Okay, then we'll meet in the next lecture.
So the homework from the last lecture was that you have to find the relationship between throughput efficiency and bandwidth. Have you
solved it?
Okay, I'll solve here again. So what is throughput actually?
What is throughut?
number of bits or the frame size divided by total time. Frame size
divided by total time.
Okay. So this was throughput. So what is the frame size? We call it as L. And
what is the total time? Total time is transmission delay of frame and then transmission delay of acknowledgement.
Propagation delay of frame. Propagation
delay of acknowledgement, queueing delay and processing delay. For now, we are going to ignore these terms queueing delay, processing delay and the
transmission delay of acknowledgement by taking the assumption that acknowledgement is way way smaller than the frame. Now what we are going to do
the frame. Now what we are going to do this will become transmission delay of frame plus two into propagation delay as propagation delay of frame and
acknowledgement is same. Now we are going to divide and multiply with bandwidth.
So this will become bandwidth into transmission delay of frame as this means this is what this is transmission
delay of frame divided by transmission delay of frame plus 2 into propagation delay. Now if I pull up pull this down
delay. Now if I pull up pull this down then this will become 1 + 2 into propagation delay upon transmission
delay and we call this as a so this will now become b upon 1 + 2 a
now this is what this is efficiency so I can say that throughput
equals to efficiency into bandwidth Okay. So this is our result. Is it
Okay. So this is our result. Is it
clear?
Okay. Now you know during the whole time during the whole time in stop and wait we are just sending a single packet. Let me explain
here. Let's say this is sender and this
here. Let's say this is sender and this is receiver. Sender want to send a
is receiver. Sender want to send a packet. So this will be the transmission
packet. So this will be the transmission delay the time taken by the sender to upload the whole packet on the link.
Now let's say this is propagation delay of the acknowledgement or not the acknowledgement but the frame and this is the propagation delay of acknowledgement.
So this is what 2 into propagation delay. So this is total time
delay. So this is total time transmission delay plus 2 into propagation delay and this was the useful time. So we called that the
useful time. So we called that the efficiency was transmission delay upon transmission delay plus 2 into propagation delay. Okay. And then we
propagation delay. Okay. And then we modified it it into the formula 1 upon 1 + 2 a. Now what is one here? 1 is the
number of packets sent.
And this 1 + 2 a is the number of packet that could be sent. This is the maximum and this is what actually is done.
You know this is what efficiency is.
What is efficiency? For example, you could have read at your best possible capacity. Let's say 100 pages of the
capacity. Let's say 100 pages of the book but due to let's say some distraction or you were lazy or something you have read just 20 pages.
So this was your efficiency 20%.
Okay, same case will apply here. What
was the maximum possible packets that could be sent? 1 + 2 a. And what were the package that were actually sent?
One, just a single one.
Now why in the stop and wait protocol we are not sending multiple packets at once, just a single packet due to a concept of
window size.
due to the concept of window size. Now
what is the window that we are talking about? The window is when a packet is
about? The window is when a packet is sent from sender to receiver. Sender
keeps a copy of that packet in its window or let's say with itself and receiver also have one window which means receiver can only work on a single
packet at a time.
Are you getting the point? Both sender
and receiver have just a window size of one. What if I increase the window size
one. What if I increase the window size of the sender which means which means that now sender can send multiple packets
until the acknowledgement comes sender can keep the copy of those multiple packets with itself. Initially in the stop and wait protocol sender sender's window size was just one which means
sender could send a packet and sender will have to keep the copy with itself till the acknowledgement comes and as you know the window size was just one so
sender could send just a single packet in one go what if I increase the sender sender's window size which means sender can send multiple packets in one go and can still keep the copies of all those
multiple packets ates with itself till the acknowledgement comes.
Is it clear?
So in that case we could have sent multiple packets and in this manner the efficiency improves and this is exactly the case what
happens in the upcoming protocols which is go back end and selective repeat.
In go back end the sender window size becomes n while the receiver window size remains one which means what does that mean?
Which means receiver cannot receive the packet out of order. Well, in selective repeat the sender window size is also n
and the receiver window size is also n which means the receiver can receive n packet maybe in out of order fashion.
Okay, we are not going to focus about this here. We will read about it when
this here. We will read about it when the time will come. Now did you get the concept? What is the relation between
concept? What is the relation between throughput efficiency and bandwidth? We
have seen the formulas. Let's revise
those formulas. So initially we begin with transmission delay. What was
transmission delay? Message size upon bandwidth. Then we move to propagation
bandwidth. Then we move to propagation delay. What was it? Distance upon speed.
delay. What was it? Distance upon speed.
Then we know that queuing delay and processing delay didn't have any specific formula. So we are going to
specific formula. So we are going to skip that.
Now what was throughput?
Throughput was frame size divided by total time. What was total time or roundtrip time? Transmission
delay of acknowledgement.
Transmission delay of frame.
Propagation delay of acknowledgement.
Propagation delay of frame.
Queuing delay and processing delay.
Processing delay. This is what the total time is. Now in some question what
time is. Now in some question what they're going to do they're going to give you the transmission delay
of acknowledgement and of frame also.
Then you have to figure out yourself that you are going to ignore this acknowledgements transmission delay or you will take it into the consideration.
Let's say if transmission delay of frame is let's say 10^ 6 and transmission delay of acknowledgement is just 10. In
that case it is obvious that you're going to ignore this transmission delay of acknowledgement because 10^ 6 + 10 is almost 10^ 6.
Okay. But when this transmission delay of frame is 1,000 and transmission delay of acknowledgement is 10 then they are
not 1,000 then you have to add them. So
in that case when the difference is not that much you cannot apply this formula 1 upon 1 + 2 a where you directly calculate this and you call this as
efficiency. No, you cannot apply this
efficiency. No, you cannot apply this formula directly if transmission delay of frame and acknowledgement are comparable.
Okay, same goes with queuing delay and processing delay. If queuing delay and
processing delay. If queuing delay and processing delay are given then you cannot apply this formula. This was an approximated formula.
Okay. Now the last formula which was throughput equals to efficiency into bandwidth. Till now if you have any
bandwidth. Till now if you have any doubt then you can ask me now otherwise we'll move to the problem solving part.
Do you have any doubt?
No. Then let's move.
You know in stop and wait what we do we send a packet and then we're going to wait till the acknowledgement of that packet comes and then we're going to
send the other packet. Okay. Now what
happens? Let's say sender want to send 10 packets. This is not a question. The
10 packets. This is not a question. The
question is the next one. This is just uh the foundation. Let's say the sender want to send 10 packets and every fourth packet is lost. Every fourth packet is lost.
So by stop and wait protocol, how many total transmissions will be there?
You solve this till now. Till then I'm going to write the actual question.
Okay. How many total transmissions?
Okay. Did you solve 13 transmissions? Yes, you are all
13 transmissions? Yes, you are all correct. So, first, second, third,
correct. So, first, second, third, fourth. Now, this packet is lost. We're
fourth. Now, this packet is lost. We're
going to send it again. Then, fourth,
fifth, 6th, 7th. Now, this is first, second, third, fourth packet. So,
seventh packet is going to be lost again. So, this is lost again. Seventh,
again. So, this is lost again. Seventh,
8th, 9th, 10th, and then 10th packet is lost again. So, we're going to send 10th
lost again. So, we're going to send 10th again. So, how many packets we have
again. So, how many packets we have sent? 10 packets and then three
sent? 10 packets and then three retransmissions. So, total 13 packets
retransmissions. So, total 13 packets are sent. This is clear. Now let's move
are sent. This is clear. Now let's move to the next question. We have 500 packets and the probability of a packet
being lost is 0.2 or the link having error is 0.2. You can
call whatever we you want. Now using
stop and weight protocol find how many total transmissions will be required. We
want to send n packets and the error probability is 0.2.
How many total transmission will be required? And you also have to solve if
required? And you also have to solve if we have to send n packets and the error probability is P then how many total transmission we have to uh we we have to
send.
Okay. I mean you have to also find the general formula and the specific one.
Okay. So, we'll begin with let's say 500 packets need to be sent. For example,
here 10 packets need to be sent and three need to be retransmitted. So, five
pack 500 packets need to be sent and how many need to be retransmitted?
those who have errors. How many have errors? 500 and then 0.2. That's the
errors? 500 and then 0.2. That's the
probability. Okay. Now when these will be retransmitted, they will also going to have errors with them. How many out of them will have errors?
100 into 0.2.
Now when these will be retransmitted, they they have to face errors. How many
errors? What is this? This is 20. So 20
into 0.2. So when these will be retransmitted they will also have to face errors. How many errors
face errors. How many errors it will keep on it will keep on going it will be like an infinite ZP. So 500
and then 100 and then 20 and then four and it will keep on going because whatever packet you send it will have some error. Okay. So what is the formula
some error. Okay. So what is the formula of an infinite ZP?
So instead of writing like this I will use just this 500 and then these will be the retransmission
500.2 plus 0.2 + 0.2 this is what this is 500.2 into 0.2 and
this is what 500.2 2 raised to power 3. Okay. So I have taken 500 common and this will keep on going. Now what is the formula of
going. Now what is the formula of infinite GP? If a is 0.2
infinite GP? If a is 0.2 and r is 0.2 what is the formula? A upon
1 - r 0.2 upon 1 - 0.2 this is 0.2 divided by 0.8 this is 1x4. So 500 plus
W wait a minute I'm getting a call hello why okay so 500 plus this is what 125
so the total transmission that needed to be done will be 625 is it
clear now what about the general formula You can solve like this np then np.
So first will be n then np + np² npq and it will keep on. So n + n p + p² pq
and then it will keep on. So n + now this time what is a? a is p. What is
r? r is again p. So this is p upon 1 - p. So this is p upon 1 - p. So this is n
p. So this is p upon 1 - p. So this is n + np upon 1 - p. When you're going to solve, you'll find the answer is n upon
1 minus p.
Is it clear?
Okay. So if you have ever encountered question from a stop and wait what you need to focus upon either questions from the delay part or
the time calculation you have to focus upon the units they'll play in the units.
You have to focus upon negligibility that you can consider transmission delay frame queuing delay processing delay
negligible or not.
Okay. Apart from these two tricks the most of the questions will be formula based. Is it clear?
formula based. Is it clear?
Is it clear?
Apart from that you can also see questions like this the stop and weight protocol. Uh how is efficiency going to depend on the
distance and the packet size?
Can you solve it? How efficiency going to depend on the distance and the packet size?
Okay. So the question can be like this.
uh for example if efficiency need to be minimum or for the case we can call worst what should you prefer would you prefer longer link
length I should write like this link length it should be longer or shorter and about transmission rate or you can
also call it as packet size or let's say transmission rate transmission rate which means bandwidth
You want lower or higher?
What about packet size?
You want smaller packets or larger packets?
Let's keep the efficiency maximum. For
maximum efficiency, what you want? Link
length should be longer or shorter.
Transmission rate should be lower or higher. And what about packet size?
higher. And what about packet size?
So when you discuss about these things you consider them as individual cases.
So what about link length? What is
efficiency? First of all efficiency is 1 upon 1 + 2 a. So efficiency is inversely proportional to a. Now what is a? A is
propagation delay upon transmission delay. So I can write like this
delay. So I can write like this transmission delay upon propagation delay. Which means efficiency is
delay. Which means efficiency is directly proportional to transmission delay. and efficiency is inversely
delay. and efficiency is inversely proportional to propagation delay. Now
link length.
Which of the following parameters do you think that link length is related to?
Transmission delay or propagation delay?
Yes, propagation delay. So what is propagation delay? Link length which is
propagation delay? Link length which is distance upon speed.
We will consider speed as constant here.
So this is like speed upon distance. Why? Because it is
upon distance. Why? Because it is inversely. Now this efficiency is
inversely. Now this efficiency is directly proportional to speed and inversely proportional to distance.
So what about link length? We will
prefer we will prefer shorter link length.
Okay? Because efficiency is inversely proportional to distance.
So for maximum efficiency, we'll prefer shorter distance.
Is it clear? You can also think like this in a very logical way. For example,
this is sender. This is receiver. This
was the transmission delay taken. And
this was two into propagation delay. And only
this was the useful time.
Only this was the useful time. So what
do I want? I will
I will or I would want that PD should be minimum so that TD + 2 PD will be minimum and if the denominator is less
the whole things increases so I prefer PD to be minimum and when will PD to be PD will be minimum when distance is less then the propagation
delay will be minimum is it clear okay now what about transmission rate you Bandwidth will be like L by BW. So
efficiency is directly proportional to transmission delay. What is transmission
transmission delay. What is transmission delay? Packet size upon bandwidth. Which
delay? Packet size upon bandwidth. Which
means efficiency is inversely proportional to bandwidth.
Is it clear? So what would I prefer?
What would I prefer for the transmission rate? I'll prefer lower transmission
rate? I'll prefer lower transmission rate for the maximum efficiency. What
about packet size? Now
n is directly proportional to transmission delay while transmission delay is directly proportional to packet size. So n is directly proportional to
size. So n is directly proportional to packet size. So for maximum efficiency I
packet size. So for maximum efficiency I want maximum packet size. And you can also think from this propagation delay will be considered a
constant here. And if I want the useful
constant here. And if I want the useful time to be maximum, I want that the packet size would be so large that sender will spend very high time, very
high time and uploading the packet onto the link and transmission and propagation delay will be less. Let me
explain again which case would you prefer for maximum efficiency. You're
going to prefer this case or you going to prefer this case? Obviously this case is better when transmission delay is more.
Okay, if you are not understanding by this analogy, you can solve with the help of formula. Okay, so I hope this is enough for stop and wait protocol.
Now the biggest problem stop and wait protocol faces is that you can send only one packet at a time. You can send only one packet at a time.
The total total time was transmission delay plus 2 into propagation delay.
This was transmission delay and this was 2 into propagation delay. This was the useful time.
Okay. This was the total time and this is the useful time. Okay.
So in one transmission delay or in transmission delay second we are sending one packet.
Okay. So in 1 second how many packets we are sending? We are sending this much
are sending? We are sending this much packet.
We are sending this much packet. And in
this much time how many packets we are sending? We are
sending TD + 2 PD divided by TD packet.
This was this was the amount of packet which was sent in 1 second. So in this much second these packets we can send these many packets. Is it clear?
So in the total time we can send transmission delay plus two this much packets can be sent in total time.
Okay. So if I simplify this this will become transmission delay divided by transmission delay plus two propagation delay divide by transmission delay. This
is one and this is a. So in total time these many packets could be sent. In
total time these many packets could be sent and how many we are actually sending just a single packet.
That's why the efficiency formula was 1 upon 1 + 2 a. The packets which we are actually sending and the packets we can actually send.
We can actually send this is what we are doing and this is what we can do. The
maximum thing or the maximum capacity.
These are the number of pages which you have read and these are the number of pages which you could have read at the maximum capability.
Is it clear?
Okay. So how we can improve the efficiency by sending more packet at a time by sending more packets instead of
a single packet we want more packets to be sent. But you know there is a
be sent. But you know there is a problem. For example, if sender has just
problem. For example, if sender has just a single a single window size, it cannot send multiple packets in one go. For example,
sender want to send one two three packets. Let's say if it has sent one
packets. Let's say if it has sent one two three packets. Now it can only store a single packet. Let's say it has stored packet one. Now if packet two and packet
packet one. Now if packet two and packet three are lost, it's lost forever.
Sender do not have the copy of these packets. Receiver have not received
packets. Receiver have not received these packets. they are gone.
these packets. they are gone.
That's why sender cannot send more than one packet because the sender window size was just one. How can we improve
that? By increasing the window size. By
that? By increasing the window size. By
increasing the window size. Okay. So
let's say we have increased the window size. We have increased the window size.
size. We have increased the window size.
Let's say window size is now keep any number four. So we have 1
number four. So we have 1 Or you can name the packet like this. 0
1 2 3 and then four five. We have many packets to send 6 7.
Okay. Let's say we have to send eight packets. And the window size is now
packets. And the window size is now four. This is sender. This is receiver.
four. This is sender. This is receiver.
So now what will happen? Sender will
send four packets. 1 2 3 4. And as soon as the acknowledgement of zero packet comes, it's going to shift the window.
It's going to shift the window like this and it will delete the zeroth copy from its buffer. Are you getting the point?
its buffer. Are you getting the point?
Why we cannot send multiple packets?
Because if some packet is lost and we do not have a copy of it, it's lost forever. That's why now what we have
forever. That's why now what we have done, we have increased the window size.
And now what's going on?
The window size is four. So in one go we have sent four packets. And as soon as the acknowledgement of first packet is received, the window is shifted. And as
soon as the acknowledgement of this packet is received, we will send another packet named packet 4. 0 1 2 3. And zero
packet is deleted from the sender side because acknowledgement has been received by the sender that receiver have received zerooth packet. So there
is no point of keeping copy of zeroth packet. Is it clear? And now what will
packet. Is it clear? And now what will happen? As soon as the first packet
happen? As soon as the first packet acknowledgement comes, it will again shift the window size or shift the window and then first packet is also
deleted. So in this manner it will go.
deleted. So in this manner it will go.
So we call this concept as sliding sliding window concept and with the help of this concept we going to implement
the two upcoming protocols which is GBN and selective repeat.
Is it clear? So let's understand the naming also.
Let's say we have packet 0 1 2 3.
These packets are transmitted and acknowledge acknowledged. Okay.
acknowledge acknowledged. Okay.
Window contains the packet 4 5 6 7. What
does that mean? This means these packets are transmitted but not acknowledged.
And and the upcoming packets 8 9 10 11.
These packets are neither transmitted nor acknowledged or they are next to be transmitted.
Okay. So what does the sliding window concept says that whatever be the window size you send those many packets back to back back to back and as soon as the acknowledgement of the initial package start coming you shift the window
simultaneously okay is it clear now what could be the maximum window size can you guess what could be the maximum
window size the maximum window size could be 1 + 2 And in stop and wait what was the window size? The window size was just one.
size? The window size was just one.
Okay.
So for the maximum window size we have a concept of sequence number also or sequence number concept.
What does it say that you need to number the packets also? You need to number the packets also. So for maximum windows
packets also. So for maximum windows maximum window size let's say uh 1 + 2a packets.
So the minimum sequence number required will be 1 + 2a because you need to individually uh number a packet. We have
discussed why because if you do not number the packet the receiver cannot understand whether it is a duplicate packet or not until it processes it and waste its resources on
a duplicate packet. So we have to number a packet. We have to number
a packet. We have to number acknowledgement also so that the concept of delayed acknowledgement may not fool the sender.
We have discussed all of these things.
So I'm not going to repeat that. So
maximum window size be a let's say 1 + 2 a packet. So how many sequence number we
a packet. So how many sequence number we require? We require 1 + 2 a sequence
require? We require 1 + 2 a sequence number.
You know for just one bit we can give two sequence number 0 and 1. With two
bits we can give four sequence numbers 0 0 0 1 1 0 and 1 1.
So if we require 1 + 2 a sequence numbers here require four sequence numbers. So two bits were required. So
numbers. So two bits were required. So
if we require 1 + 2 a sequence number how many bits we are going to require?
Log 2 1 + 2 a.
Okay. This till now if you have any doubt you can ask.
No doubt. So we'll meet in the next lecture. In the last lecture we have
lecture. In the last lecture we have seen introduction to sliding window protocol. In this lecture we'll begin
protocol. In this lecture we'll begin with GBN and we'll also understand selective repeat.
Okay. By the way I hope you are all solving the DBPS.
I'll consider that this will be the last lecture for flow control module.
From the next to next lecture we will begin the new module of IPv4 header and fragmentation. But before that we will
fragmentation. But before that we will solve all of your doubts from the DPPS that you have faced. You can also ask doubt from the previous DPPS of error
control and IP addressing. By the way, I've taken one doubt class where we have discussed your doubts. Whichever doubt
you have asked. In the next lecture, we will do it the same for flow control.
Okay.
Now let's begin with sliding window protocol. In this concept, instead of
protocol. In this concept, instead of sending one packet and wait for the acknowledgement like we did in stop and wait, we send W packets, we send W
packets and wait for the acknowledgement where W is what? The sender window size.
Sender window size.
Okay. So this was the theoretical concept based on which we will implement GBN and selective repeat. Now let's
start with GBN which means go back N.
In GBN the sender window size is N itself. So if I say GB5 which means I'm
itself. So if I say GB5 which means I'm talking about the sender window size as five. What about receiver window size?
five. What about receiver window size?
In GBN receiver window size always remains one. Always remains one. Okay.
remains one. Always remains one. Okay.
So n is the sender window size and receiver window size is always one.
Okay. So if I write like gb 10 then receiver window size is 1 and sender window size is 10. If I like GB 15 same here sender window size 15 and receiver
window size is one. Let's see with the help of a diagram. This is our sender.
This is our receiver. Okay, let's talk about GV5. We have sender window size as
about GV5. We have sender window size as five and receiver window size as 1.
Okay, we we want to send the package 0 1 2 3 4 5 6. Let's take seven also. Okay, let me
6. Let's take seven also. Okay, let me write it properly.
0 1 1 2 3 4 5 6 7 and if window size is five which means this will be in a window.
So we were supposed to send these many packets in one go like 0 1 2
3 4 Okay. Now what happened?
Zero is received, one is received, two is received and three is lost somewhere.
Three is lost somewhere. Now when 012 and received an acknowledgement will be sent. So
sent. So this will be shifted to this. Now these will be deleted from
to this. Now these will be deleted from the sender side and this will be our window.
So when 0 1 2 and received which means five 6 these are already sent. I I think this was our initial. So 012 which means
this will be our window now. Okay. Now
what happened? Three was not received by the receiver. It was lost somewhere. It
the receiver. It was lost somewhere. It
was lost somewhere uh due to noise. Now
what will happen? Receiver
will discard this packet of four silently. Receiver will silently discard
silently. Receiver will silently discard four.
So zero acknowledgement was received.
First acknowledgement was received.
Second was received and the third was not received. And you know
not received. And you know these many packets are were already sent. Fifth, sixth, seventh were already
sent. Fifth, sixth, seventh were already sent. Fifth was sent, sixth was sent and
sent. Fifth was sent, sixth was sent and seventh was sent. So what will receiver do? receiver will discard them also
do? receiver will discard them also silently.
Receiver will discard them silently.
Why? So why is receiver not accepting these fourth, fifth, sixth, seventh packets? Because receiver has a window
packets? Because receiver has a window size of just one. Which means receiver received the
one. Which means receiver received the packet zero sent to the upper layer. Receiver
received the packet one sent to the upper layer. Receiver cannot store two.
upper layer. Receiver cannot store two.
Send to the upper layer. Processed. Now
it's waiting for three. It received
four. But you know upper layer will not receives the packet from receiver in in out of order. The upper layer wants packet in order
and receiver do not have the window.
Receiver do not have a space to arrange them. For example, it cannot just keep
them. For example, it cannot just keep four, five, six with itself. It has to send the packet to upper layer. Now
three is not received by the receiver.
So receiver is not going to send four, five, six to the upper layer and will say I will send the three later. No,
this doesn't happen because the receiver window size is just one. So what
receiver want? Receiver want these packets in order.
Okay, so receiver is going to discard these packets silently.
Receiver will wait for the packet three.
But till now what sender has done?
Sender has also sent the packet four 5 6 7. So receiver going to discard them
7. So receiver going to discard them also.
Okay. Now what will happen as receiver has not received three. So receiver will not send the acknowledgement or will not uh tell the sender that I have not received three. This doesn't happen.
received three. This doesn't happen.
What will happen? Sender will wait for the acknowledgement of three so that it can slide the window more. Let's say there is another packet
more. Let's say there is another packet so that sender is waiting for the acknowledgement of three so that it can slide the window and delete three from its space. But what happened?
its space. But what happened?
Receiver has not received three. So
receiver will not send acknowledgement also. Then what will happen? A timeout
also. Then what will happen? A timeout
timer will occur. A timeout will happen.
So when a timeout will happen re sender going to send another packet of three and then the whole window will be transmitted
3 4 5 6 7 these are sent back to back because what is the whole concept of GPN what was the whole concept of sliding window protocol that whatever be the
window size you're going to send those packets back to back and we'll wait for the acknowledgement of the sent packet If you are receiving the acknowledgement, you shift the window
size one by one. You shift the window one by one.
This is what we were doing. We sent
zero, we sent one, we sent two and then we sent three and four also. But what
happened? We received the acknowledgement of 0 1 and two but not of three.
So as the acknowledgement of 012 was received we have already shifted the window to 5 6 and 7 and we have already sent these packets. In the last lecture
I have discussed the terminology that if the window is on these packets which means these packets were transmitted but not acknowledged. So these are the
not acknowledged. So these are the packets which were already transmitted but not acknowledged. So what receiver going to do when the time what the sender will going to do when the timeout will occur? Sender going to send these
will occur? Sender going to send these packets again 3 4 5 6 7 back to back back to back back to back. 3 4 5 6 7 these are sent and the same thing will
repeat again. Did you get it? Let me
repeat again. Did you get it? Let me
explain you again in just uh 1 minute.
What happened? 0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 Okay, this was our window size. Window size of five. So
window size. Window size of five. So
what we are supposed to do? We are we are supposed to send these packets back to back. 0 1 2 3 4 0 1 2 3 4 because
to back. 0 1 2 3 4 0 1 2 3 4 because this was our window size of the sender.
Now what happened? Receiver received
zero send the acknowledgement. As the
acknowledgement was sent, the window will be shifted.
Now five is sent. As the acknowledgement of one is received, the window is again shifted and one will be deleted.
Six will be sent.
As the acknowledgement of two is received again the window is shifted and two is deleted.
Seventh will be sent. But what happened?
Receiver received 0 1 2 but three is not received. So receiver going to discard
received. So receiver going to discard them silently. What will happen? Time
them silently. What will happen? Time
out will occur because receiver has not received this three. So time out will occur. Sender will assume that as
occur. Sender will assume that as receiver has not received three.
Receiver must have discarded 4 5 6 7 also. So sender will send these packets
also. So sender will send these packets 3 4 5 6 and 7. And the same concept will happen again. Let's say this time three
happen again. Let's say this time three is received. So sender going to shift
is received. So sender going to shift the window size three will be deleted and eight will be sent. Did you get it?
Okay. So this was the concept of GBN where the sender window size is N. Here
in this case it was five. That's why we were sending five backto back packets and the receiver window size was just one. That's why receiver can cannot
one. That's why receiver can cannot receive out of order packets.
Can't receive out of order packets.
Okay.
Is it clear?
Let me write here. Out of order, not received by the receiver. And you
know the special thing is you have noticed here the timer is maintained.
Timer is maintained only for the first frame of the window. Here the timer was maintained only for the frame three because if frame three is not received
then this 4 5 6 7 will also be discarded by the receiver. Sender will assume this. So sender will only maintain the
this. So sender will only maintain the timer for the first frame of the window.
So timer will be maintained for the let me write here second point timer maintained
for the first frame only first frame of the window only.
Why so? Because if it's its timer expire then sender assume that the rest of the frames are not received by the receiver.
Why? because out of order packets is rejected.
Now what if what if we also increase the receiver window size let's say five.
What if we also receive what is we also increase the receiver window size to five and the sender window size is also five. What will happen in this case?
five. What will happen in this case?
0 1 2 3 4 5 6 7 What was the sender window size? Five.
Which means we are supposed to send five packets back to back. 0 1 2 and then the same case happened here. Three was not
received and four was sent because we are supposed to send five packets. So
these five packets are sent in a single go. Now what happened?
go. Now what happened?
Receiver have received like this 0 1 2.
Now what will happen? 0 1 2. Receiver
will also maintain a window. As soon as 0 is received, it will send the acknowledgement of zero and will shift the window forward.
Now 1 2 3 4 5. Now what will happen in the same case? It will receive one, shift the window forward, receive two, shift the window forward. Now this is at three. Three has not been received. So
three. Three has not been received. So
what will happen?
What will happen? It will receive the packet four. We'll consider three
packet four. We'll consider three as that this packet will be received later when the timeout of the sender will expire. So this will be received, four
expire. So this will be received, four will be received and as soon as the acknowledgement of one is sent, five will be received also because this is included in the window. Six and seven.
These packets will be received as they are in the window of the receiver. Five
is received. The packet acknowledgement of two will come. Six will be received.
And then and then what will happen?
As timeout will expire, three will be sent.
Okay. Now what will happen in this case?
Timeout will be maintained for each and every packet. In the previous case, the
every packet. In the previous case, the timeout was maintained for the first packet of the frame only. In this case, as you know, receiver can receive out of order packets. So, timeout will be
order packets. So, timeout will be maintained for each and every packet of the frame. Is it clear? So, this was the
the frame. Is it clear? So, this was the concept of selective repeat because you have to repeat the selected packets only. And why go back N? Why is
packets only. And why go back N? Why is
the naming go back N? Because in this case, you have to send the entire window back. Because you were sending the
back. Because you were sending the entire window back 3 4 5 6 7 the whole window was being sent again. So go back how many packets? N which means the
sender window size the entire window.
Did you get it? So this was the concept of SR protocol. Now let's solve some of the problems so you can understand better.
Let's say in GB3 if every fifth packet is lost if every fifth packet is lost and we have to send 10 packets
then how many transmissions are required. We have solved a similar
required. We have solved a similar question for a stop and wait. Consider
this as a level up. Try to solve.
If it is a ZB3 and every fifth packet is lost and the total packet that need to be sent is 10 packets. How many total retransmissions or how many total
transmissions will be required?
Okay. We'll begin like this 1 2 3 4 5 6 7 Okay. So this will be the window. Now
7 Okay. So this will be the window. Now
every fifth packet is lost. So one will be received, second packet will be received, third packet will be received and as soon as they will be received, the window will be shifted. So window
will keep on shifting. Three and then fourth will also be received and fifth packet is lost. So window will be here.
You know third packet was lost. You can you can muck this up that only the first packet of the window can be lost.
Only the first packet of the window can be lost.
These packets were already received.
Let's say let's say third was received.
If third was received and fourth was lost then window would already been shifted here. So fourth will be lost. So
shifted here. So fourth will be lost. So
what will happen here? Let's say if they have asked that every sixth packet is lost. You can just directly assume like
lost. You can just directly assume like this 1 2 3 4 5 will be sent. I'll make
the window here 6 7 8 and then if sixth is lost then entire window will be retransmitted. For example, in this case
retransmitted. For example, in this case it was fifth packet. So 1 2 3 4 5. So
every fifth packet is lost. This will be the lost packet. And these were the packets that were already being transmitted. What I have told you that
transmitted. What I have told you that the if the window are on these packets, this signify that these packets were transmitted but acknowledgement has not
been received.
So fifth packet is lost while sixth and seventh were already been sent. Now what
will happen? Receiver will silently discard sixth and seventh. So fifth will all fifth, sixth and seventh will be sent again. Now what will happen? This
sent again. Now what will happen? This
was the fifth packet. Now 1 2 3 4 5.
This packet will again be lost.
Then they will be sent again. 7 8 9 10.
And then what will happen? 1 2 3 4 5.
This ninth packet will again be lost. So
9 and 10 will be sent again. Are you
getting the point? You have to remember this case. You have to remember this
this case. You have to remember this case. Okay. The first packet whatever
case. Okay. The first packet whatever they have given you, let's say nth packet is lost. So you're going to count from 1 to n and you will make a window here. Let's say n n n n n n n n n n n n
here. Let's say n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n + 1 n +2 GB3. So if nth packet is lost, these two
GB3. So if nth packet is lost, these two packets were already sent. Now what will happen? this n + 1 and n plus2 will be
happen? this n + 1 and n plus2 will be sent again.
Did you get it? This is the same thing which we have done here.
What happened?
First packet, second packet, third, fourth and fifth is lost while sixth and seventh were already sent. So what will be happen? What will happen now? 5 6 7
be happen? What will happen now? 5 6 7 will be sent because the window this whole window will be retransmitted. I
hope the point is clear. So how many transmissions? 1 2 3 4 5 6 7 8 9 10 11
transmissions? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 transmissions were needed.
How many retransmissions?
Eight retransmissions because 10 were the total packets and eight extra transmissions were needed.
Did you get it?
Okay.
Now let's see the concept of independent acknowledgement and cumulative acknowledgement.
Independent and cumulative acknowledgement. What you can guess from
acknowledgement. What you can guess from the name?
Yes, correct. In independent
acknowledgement, every packets every packet must have its own acknowledgement from the receiver side. For example, the case which we
side. For example, the case which we were discussing before 0 1 2 each packet was having its own acknowledgement.
While in cumulative acknowledgement just a single acknowledgement can be enough for the whole window. 0 1 2 3. Now if
these are already received why to increase the why you have to increase the traffic while you can just say okay send four. This acknowledgement four
send four. This acknowledgement four means that I have already received 0 1 2 3 you can send four.
Okay. So this works best in the case of GBN.
How so? Because if sender is getting the acknowledgement named four which means sender know that receiver cannot receive an out of order fashion. Now receiver is
asking for the packet four which means receiver has already re received 0 1 2 and 3.
Okay.
So this was the concept of independent and cumulative acknowledgement. What
about stop and wait? Stop and wait uses independent acknowledgement. Stop and
independent acknowledgement. Stop and wait. Independent. What about GVN?
wait. Independent. What about GVN?
Cumulative works best.
Okay. And acknowledgement number defines the number of next expected frame.
Is it clear?
And you know there is some very logical concept or you can say of common sense that acknowledgement number and timeout timer. What will be the relation between
timer. What will be the relation between them? Who will be more and who will be
them? Who will be more and who will be less? Acknowledgement time not
less? Acknowledgement time not acknowledgement number. Acknowledgement
acknowledgement number. Acknowledgement time and timeout time.
Who should be more?
Yes, obviously timeout time should be more. Why? Because let's say if timeout
more. Why? Because let's say if timeout timer of zero packet expired before this acknowledgement four could even come.
For example, timeout timer of zero was expired here. Before this
expired here. Before this acknowledgement four could come what will happen? Sender will retransmit
will happen? Sender will retransmit unnecessarily increasing the network traffic. So this was also a concept I
traffic. So this was also a concept I couldn't remember. I thought I could
couldn't remember. I thought I could share another concept that the sender window size plus the receiver window
size should be less than available sequence number. Otherwise the problem
sequence number. Otherwise the problem of duplicate packet will come. Why?
Because if the available sequence number are less than the sender window size plus receiver window size then you cannot distinguishly
identify each packet or distinctly identify each packet and the problem of duplicate packet could arise. So
this is also a relation that you should remember that sender window size plus receiver window size should be less than the available sequence number.
So you can modify these formulas based on the protocol which we are discussing.
For example, if we are discussing GBN then you can write N here, one here and then available sequence number. So the
center window size should be less than available sequence number minus one in the case of GBN.
Well, what happened in the case of selective repeat?
In selective repeat the sender window size is also n and the receiver window size is also n. This should be less than available sequence number. So 2 n should be less than available sequence number.
So n is less than available sequence number divided by two. Now this was in a way this was in a way. Now we can also
look at opposite way. What is it? What
about let's say if sequence number is of k bit which means what could be the maximum sequence number 2^ k. Now
how we going to divide these sequence number based on the protocol. Let's say
what about zbn and what about uh selective repeat in gbn you want to divide like this 2^ k minus one will be given to the sender
and one will be given to the receiver.
What about selective repeat? As you know that the sequence number are divided.
Why? Because sender window size is also n and the receiver window size is also n. So they will be divided equally. 2^ k
n. So they will be divided equally. 2^ k
minus one. This time this was one here and this one is in the power 2^ k minus 1 or you can also write like this 2^ k /
2id 2. Is this clear?
2id 2. Is this clear?
Okay. Now we should also discuss the efficiency part. What about the
efficiency part. What about the efficiency in stop and wait? This was the case. We
were uploading a packet on the link and the packet will come back to us in 2PD.
So this was the total time and this was the useful time. So the efficiency was useful time upon total time.
Now what if what if we can increase the sender time. How so? By keeping the
sender time. How so? By keeping the sender busy.
And how we can keep the sender busy? By
giving it the task that you need to upload these many packets back to back on the link. How many packets equals to receiver or the sorry sender
window size. So if sender window size is
window size. So if sender window size is n which means we can send l packets back to back. So now what will happen
to back. So now what will happen this transmission delay will increase and you know propagation delay remains the same. So what will be efficiency?
the same. So what will be efficiency?
Now in the previous case it was just uploading a single packet. In this case it is now uploading n packets. So the
efficiency will be multiplied.
This will now be the new efficiency because it is uploading n packets now.
Sender window size sender window time.
Uh what I'm saying man if it is this is now the new efficiency.
Is it clear? Let me write very properly.
The efficiency has become n into transmission delay of frame divided by transmission delay of frame or you can write total time total
time. And now this will also include the
time. And now this will also include the queueing delay, processing delay and all these concepts. If the difference
these concepts. If the difference between transmission delay of frame and acknowledgement is not much then you cannot ignore. If the difference is much
cannot ignore. If the difference is much then you can ignore and we have discussed all these things already.
So what I'm going to do now we will do the comparison. We'll do the comparison
the comparison. We'll do the comparison between stop and wait GBN and selective repeat. First of all let's understand the concept. What was
stop and wait? You send a packet. You
wait for the acknowledgement. As soon as acknowledgement arrive you send another packet because the sender window size and receiver window size were both one.
Neither receiver can receive an out of order packet nor sender can send multiple packets at once. So this was the case of stop and wait. What about
GBN? In GBN sender window size was N while the receiver window size was just one. So sender can send multiple packets
one. So sender can send multiple packets back to back and shift the window as soon as the acknowledgement is received.
What if some packet is lost in between?
In that case the whole window will be retransmitted again.
Okay, this was the case of GBN. What if
we increase the we increase the receiver window size also. So in SR protocol window sender size is equals to the receiver window size and it is n and SR
protocol uses what independent acknowledgement stop and weight used independent while cumulative acknowledgement were used by GBN.
Okay. And the acknowledgement number defines the number of error-free packets received or the next expected frame.
Okay. And one special thing about SR is it can receive out of order packet. Why?
Because this time receiver window size is also n. So we need a special sorting logic at the receiver side. So if someone ask
in which protocol you require a sorting logic at the receiver side, you say SR protocol because this is the only protocol which we which can receive out
of order packets.
Okay. And you know in GBN timer was maintained by for the first packet of the window only. In SL protocol timer will be maintained for all of the
packets.
Okay. So if first out of order delivery or if the packet received is corrupted then you know n ak for the respective packet is sent uh by
the by the receiver to the sender. What
is this? This is not acknowledgement which means that you know three is not received. So how sender going to know
received. So how sender going to know that which packet it has to send? The
sender may know with the help of acknowledgement that if acknowledgement is not received by the sender which means the sender will wait for the timeout timer and as
the timeout timer expires sender will send again. But why you have to wait
send again. But why you have to wait till the timeout timer of the sender expire. What you can do if three is not
expire. What you can do if three is not received and rest the rest of the packets are received. You're going to send n a k3.
So what will happen? Sender will search in the window where is three and will send immediately before even the timeout timer expires.
Are all these protocols clear to you?
Okay, we have discussed all of the major concept regarding the stop and weight, GBNN, selective repeat. So the homework from
selective repeat. So the homework from the last lecture was that you have to find the relationship between throughput, efficiency and bandwidth. Have you
solved it?
Okay, I'll solve here again. So what is throughput actually?
What is throughut?
Number of bits or the frame size divided by total time. Frame size
divided by total time.
Okay. So this was throughput. So what is the frame size? We call it as L. And
what is the total time? Total time is transmission delay of frame and then transmission delay of acknowledgement.
Propagation delay of frame, propagation delay of acknowledgement, queuing delay and processing delay. For now, we are going to ignore these terms. Queuing
delay, processing delay and the transmission delay of acknowledgement by taking the assumption that acknowledgement is way way smaller than
the frame. Now what we are going to do
the frame. Now what we are going to do this will become transmission delay of frame plus 2 into propagation delay as propagation delay of frame and
acknowledgement is same. Now we are going to divide and multiply with bandwidth.
So this will become bandwidth into transmission delay of frame as this means this is what this is transmission
delay of frame divided by transmission delay of frame plus 2 into propagation delay. Now if I pull up pull this down
delay. Now if I pull up pull this down then this will become 1 + 2 into propagation delay upon transmission
delay and we call this as a. So this
will now become B upon 1 + 2 A.
Now this is what this is efficiency. So I can say that throughput
equals to efficiency into bandwidth.
Okay. So this is our result. Is it
clear?
Okay. Now you know during the whole time during the whole time in stop and wait we are just sending a single packet. Let me explain here.
Let's say this is sender and this is receiver. Sender want to send a packet.
receiver. Sender want to send a packet.
So this will be the transmission delay.
The time taken by the sender to upload the whole packet on the link.
Now let's say this is propagation delay of the acknowledgement or not the acknowledgement but the frame and this is the propagation delay of acknowledgement.
So this is what 2 into propagation delay. So this is total time
delay. So this is total time transmission delay plus 2 into propagation delay and this was the useful time. So we called that the
useful time. So we called that the efficiency was transmission delay upon transmission delay plus 2 into propagation delay. Okay. And then we
propagation delay. Okay. And then we modified it it into the formula 1 upon 1 + 2 a. Now what is one here? 1 is the
number of packets sent and this 1 + 2 a is the number of packet that could be sent. This is the maximum
and this is what actually is done.
You know this is what efficiency is.
What is efficiency? For example, you could have read at your best possible capacity, let's say 100 pages of the book, but due to let's say some distraction or you were lazy or
something, you have read just 20 pages.
So this was your efficiency, 20%.
Okay, same case will apply here. What
was the maximum possible packets that could be sent? 1 + 2 a. And what were the package that were actually sent? one
just a single one.
Now why in the stop and wait protocol we are not sending multiple packets at once just a single packet? Due to a concept
of window size due to the concept of window size. Now
what is the window that we are talking about? The window is when a packet is
about? The window is when a packet is sent from sender to receiver. Sender
keeps a copy of that packet in its window or let's say with itself and receiver also have one window which means receiver can only work on a single
packet at a time.
Are you getting the point? Both sender
and receiver have just a window size of one. What if I increase the window size
one. What if I increase the window size of the sender? Which means
which means that now sender can send multiple packets until the acknowledgement comes sender can keep the copy of those multiple
packets with itself. Initially in the stop and wait protocol sender sender's window size was just one which means sender could send a packet and sender
will have to keep the copy with itself till the acknowledgement comes and as you know the window size was just one.
So sender could send just a single packet in one go. What if I increase the sender sender's window size which means sender can send multiple packets in one
go and can still keep the copies of all those multiple packets with itself till the acknowledgement comes.
Is it clear?
So in that case we could have sent multiple packets and in this manner the efficiency improves.
And this is exactly the case what happens in the upcoming protocols which
is go back n and selective repeat.
In go back n the sender window size becomes n while the receiver window size remains one. Which means what does that
remains one. Which means what does that mean?
Which means receiver cannot receive the packet out of order. While in selective repeat the sender window size is also n
and the receiver window size is also n which means the receiver can receive n packet maybe in out of order fashion.
Okay, we are not going to focus about this here. We will read about it when
this here. We will read about it when the time will come. Now did you get the concept? What is the relation between
concept? What is the relation between throughput efficiency and bandwidth? We
have seen the formulas. Let's revise
those formulas. So, initially we begin with transmission delay. What was
transmission delay? Message size upon bandwidth. Then we move to propagation
bandwidth. Then we move to propagation delay. What was it? Distance upon speed.
delay. What was it? Distance upon speed.
Then we know that queuing delay and processing delay didn't have any specific formula. So we are going to
specific formula. So we are going to skip that.
Now what was throughput? Throughput was
frame size divided by total time. What was total time or roundtrip time? Transmission
delay of acknowledgement.
Transmission delay of frame.
Propagation delay of acknowledgement.
Propagation delay of frame.
Queuing delay and processing delay.
Processing delay. This is what the total time is. Now in some question what
time is. Now in some question what they're going to do?
They're going to give you the transmission delay of acknowledgement and of frame also.
Then you have to figure out yourself that you are going to ignore this acknowledgements transmission delay or you will take it into the consideration.
Let's say if transmission delay of frame is let's say 10^ 6 and transmission delay of acknowledgement is just 10. In
that case it is obvious that you're going to ignore this transmission delay of acknowledgement.
because 10^ 6 + 10 is almost 10^ 6.
Okay. But when this transmission delay of frame is,000 and transmission delay of acknowledgement is 10, then they are
not 1,000 then you have to add them. So
in that case when the difference is not that much you cannot apply this formula 1 upon 1 + 2 a where you directly calculate this and you call this as
efficiency. No you cannot apply this
efficiency. No you cannot apply this formula directly if transmission delay of frame and acknowledgement are comparable.
Okay. Same goes with queuing delay and processing delay. If queuing delay and
processing delay. If queuing delay and processing delay are given then you cannot apply this formula. This was an approximated formula.
Okay. Now the last formula which was throughput equals to efficiency into bandwidth. Till now if you have any
bandwidth. Till now if you have any doubt then you can ask me now otherwise we'll move to the problem solving part.
Do you have any doubt?
No. Then let's move.
You know in stop and wait what we do? We
send a packet and then we're going to wait till the acknowledgement of that packet comes and then we're going to send the other packet. Okay. Now what
happens? Let's say sender want to send 10 packets. This is not a question. The
10 packets. This is not a question. The
question is the next one. This is just uh the foundation. Let's say the sender want to send 10 packets and every fourth packet is lost. Every fourth packet is lost.
So by stop and wait protocol, how many total transmissions will be there?
You solve this till now. Till then I'm going to write the actual question.
Okay. How many total transmissions Okay. Did you solve
Okay. Did you solve 13 transmissions? Yes, you are all
13 transmissions? Yes, you are all correct. So, first, second, third,
correct. So, first, second, third, fourth. Now, this packet is lost. We're
fourth. Now, this packet is lost. We're
going to send it again. Then fourth,
fifth, 6th, 7th. Now this is first, second, third, fourth packet. So seventh
packet is going to be lost again. So
this is lost again. 7th, 8th, 9th, 10th.
And then 10th packet is lost again. So
we're going to send 10th again. So how
many packets we have sent? 10 packets.
And then three retransmissions. So total
13 packets are sent. This is clear. Now
let's move to the next question. We have
500 packets and the probability of a packet being lost is 0.2 or the link having error is 0.2. You can
call whatever we want. Now using drop and weight protocol find how many total transmissions will be required. We want
to send n packets and the error probability is 0.2.
How many total transmission will be required? And you also have to solve if
required? And you also have to solve if we have to send n packets and the error probability is P then how many total transmission we have to uh we we have to
send.
Okay. I mean you have to also find the general formula and the specific one.
Okay. So, we'll begin with let's say 500 packets need to be sent. For example,
here 10 packets need to be sent and three need to be retransmitted. So, five
pack 500 packets need to be sent. And
how many need to be retransmitted?
Those who have errors, how many have errors? 500 and then 0.2 that's the
errors? 500 and then 0.2 that's the probability. Okay. Now when these will
probability. Okay. Now when these will be retransmitted they will also going to have errors with them. How many out of them will have errors?
100 into 0.2.
Now when these will be retransmitted they they have to face errors. How many
errors? What is this? This is 20. So 20
into 0.2. So when these will be retransmitted they will also have to face errors. How many errors?
face errors. How many errors?
It will keep on it will keep on going.
It will be like an infinite ZP. So 500
and then 100 and then 20 and then four and it will keep on going because whatever packet you send it will have some error. Okay. So what is the formula
some error. Okay. So what is the formula of an infinite GB?
So instead of writing like this I will use just this 500 and then these will be the retransmission
500.2 + 0.2 + 0.2 this is what this is 500.2 into 0.2 and
this is what 500.2 2 raised to power 3. Okay. So I have taken 500 common and this will keep on going. Now what is the formula of
going. Now what is the formula of infinite GP? If a is 0.2
infinite GP? If a is 0.2 and r is 0.2 what is the formula? a upon
1 - r 0.2 upon 1 - 0.2 this is 0.2 divided by 0.8 this is 1x4. So 500 plus
wait a minute I'm getting a call. Hello
class.
Okay. Okay. So 500 plus this is what 125.
So the total transmission that needed to be done will be 625. Is
it clear? Now what about the general formula?
You can solve like this. NP then NP.
So first will be N then NP + NP² NPQ and it will keep on. So N + N P + P² PQ
and then it will keep on. So N + now this time what is A? A is P. What is
R? R is again P. So this is P upon 1 - P. So this is P upon 1 - P. So this is N
P. So this is P upon 1 - P. So this is N + NP upon 1 - P. When you're going to solve, you'll find the answer is N upon
1 minus P.
Is it clear?
Okay. So if you have ever encountered question from a stop and wait what you need to focus upon either questions from the delay part or
the time calculation you have to focus upon the units they'll play in the units.
You have to focus upon negligibility that you can consider transmission delay frame queuing delay processing delay
negligible or not.
Okay. Apart from these two tricks the most of the questions will be formula based. Is it clear?
formula based. Is it clear?
Is it clear?
Apart from that you can also see questions like this.
The install and weight protocol. Uh how
is efficiency going to depend on the distance and the packet size?
Can you solve it? How efficiency going to depend on the distance and the packet size?
Okay. So the question can be like this.
Uh for example, if efficiency need to be minimum or for the case we can call worst what should you prefer? Would you prefer longer link
you prefer? Would you prefer longer link length? I should write like this link
length? I should write like this link length.
It should be longer or shorter.
And about transmission rate or you can also call it as packet size or let's say transmission rate.
transmission rate which means bandwidth.
You want lower or higher?
What about packet size?
You want smaller packets or larger packets?
Let's keep the efficiency maximum. For
maximum efficiency, what you want? Link
length should be longer or shorter.
Transmission rate should be lower or higher. And what about packet size?
higher. And what about packet size?
So when you discuss about these things you consider them as individual cases.
So what about link length? What is
efficiency? First of all efficiency is 1 upon 1 + 2 a. So efficiency is inversely proportional to a. Now what is a? A is
propagation delay upon transmission delay. So I can write like this
delay. So I can write like this transmission delay upon propagation delay. Which means efficiency is
delay. Which means efficiency is directly proportional to transmission delay. and efficiency is inversely
delay. and efficiency is inversely proportional to propagation delay. Now
link length.
Which of the following parameters do you think that link length is related to?
Transmission delay or propagation delay?
Yes, propagation delay. So what is propagation delay? Link length which is
propagation delay? Link length which is distance upon speed.
We will consider speed as constant here.
So this is like speed upon distance.
Why? Because it is inversely. Now this
efficiency is directly proportional to speed and inversely proportional to distance.
So what about link length? We will
prefer we will prefer shorter link length.
Okay? Because efficiency is inversely proportional to distance.
So for maximum efficiency, we'll prefer shorter distance.
Is it clear? You can also think like this in a very logical way. For example,
this is sender. This is receiver. This
was the transmission delay taken. And
this was two into propagation delay. And only
this was the useful time.
Only this was the useful time. So what
do I want? I will
I will or I would want that PD should be minimum so that TD + 2 PD will be minimum and if the denominator is less
the whole things increases.
So I prefer PD to be minimum and when will PD to be PD will be minimum when distance is less then the propagation delay will be minimum. Is it clear?
Okay. Now what about transmission rate?
You see bandwidth will be like L by BW. So
efficiency is directly proportional to transmission delay. What is transmission
transmission delay. What is transmission delay? Packet size upon bandwidth. Which
delay? Packet size upon bandwidth. Which
means efficiency is inversely proportional to bandwidth.
Is it clear? So what would I prefer?
What would I prefer for the transmission rate? I'll prefer lower transmission
rate? I'll prefer lower transmission rate. for the maximum efficiency. What
rate. for the maximum efficiency. What
about packet size? Now
n is directly proportional to transmission delay while transmission delay is directly proportional to packet size. So n is directly proportional to
size. So n is directly proportional to packet size. So for maximum efficiency I
packet size. So for maximum efficiency I want maximum packet size and you can also think from this propagation delay will be considered a
constant here. And if I want the useful
constant here. And if I want the useful time to be maximum, I want that the packet size would be so large that sender will spend very high time, very
high time and uploading the packet onto the link and transmission and propagation delay will be less. Let me
explain again which case would you prefer for maximum efficiency. You're
going to prefer this case or you going to prefer this case? Obviously this case is better when transmission delay is more.
Okay, if you are not understanding by this analogy, you can solve with the help of formula. Okay, so I hope this is enough for stop and wait protocol.
Now the biggest problem stop and wait protocol faces is that you can send only one packet at a time. You can send only one packet at a time.
The total total time was transmission delay plus 2 into propagation delay.
This was transmission delay and this was 2 into propagation delay. This was the useful time.
Okay. This was the total time and this is the useful time. Okay.
So in one transmission delay or in transmission delay second we are sending one packet.
Okay. So in 1 second how many packets we are sending? We are sending this much
are sending? We are sending this much packet.
We are sending this much packet. And in
this much time how many packets we are sending? We are
sending TD + 2 PD divided by TD packet.
This was this was the amount of packet which was sent in 1 second. So in this much second these packets we can send these many packets. Is it clear?
So in the total time we can send transmission delay plus two this much packets can be sent in total time.
Okay. So if I simplify this this will become transmission delay divided by transmission delay plus two propagation delay divide by transmission delay. This
is one and this is a. So in total time these many packets could be sent in total time these many packets could be sent and how many we are actually
sending just a single packet that's why the efficiency formula was 1 upon 1 + 2 a packets which we are actually sending and the packets we can
actually send we can actually send this is what we are doing and this is what we can do the maximum thing or the maximum capacity these are the number number of pages
which you have read and these are the number of pages which you could have read at the maximum capability.
Is it clear?
Okay. So how we can improve the efficiency by sending more packet at a time by sending more packets. Instead of
a single packet we want more packets to be sent. But you know there is a problem
be sent. But you know there is a problem for example if sender has just a single a single window size it cannot send multiple packets in one go. For example
sender want to send one two three packets. Let's say if it has send one
packets. Let's say if it has send one two three packets. Now it can only store a single packet. Let's say it has stored packet one. Now if packet two and packet
packet one. Now if packet two and packet three are lost, it's lost forever.
Sender do not have the copy of these packets. Receiver have not received
packets. Receiver have not received these packets. They are gone.
these packets. They are gone.
That's why sender cannot send more than one packet because the sender window size was just one. How can we improve
that? By increasing the window size. by
that? By increasing the window size. by
increasing the window size. Okay. So
let's say we have increased the window size. We have increased the window size.
size. We have increased the window size.
Let's say window size is now keep any number four. So we have one
number four. So we have one or you can name the packet like this. 0
1 2 3 and then four five. We have many packets to send six seven. Okay. Let's
say we have to send eight packets and the window size is now four. This is
sender. This is receiver.
So now what will happen? Sender will
send four packets. 1 2 3 4. And as soon as the acknowledgement of zero packet comes, it's going to shift the window.
It's going to shift the window like this and it will delete the zerooth copy from its buffer. Are you getting the point?
its buffer. Are you getting the point?
Why we cannot send multiple packets?
Because if some packet is lost and we do not have a copy of it, it's lost forever. That's why now what we have
forever. That's why now what we have done, we have increased the window size.
And now what's going on?
The window size is four. So in one go, we have sent four packets. And as soon as the acknowledgement of first packet is received, the window is shifted. And
as soon as the acknowledgement of this packet is received, we will send another packet named packet 4. 0 1 2 3 and zeroth packet is deleted from the sender
side because acknowledgement has been received by the sender that receiver have received zeroth packet. So there is no point of keeping copy of zero packet.
Is it clear? And now what will happen?
As soon as the first packet acknowledgement comes, it will again shift the window size or shift the window and then first packet is also
deleted. So in this manner it will go.
deleted. So in this manner it will go.
So we call this concept as sliding sliding window concept. And with the help of this concept we going to implement the two upcoming protocols
which is GBN and selective repeat.
Is it clear? So let's understand the naming also.
Let's say we have packet 0 1 2 3.
These packets are transmitted and acknowledge. Acknowledged. Okay.
acknowledge. Acknowledged. Okay.
Window contains the packet 4 5 6 7. What
does that mean? This means these packet are transmitted but not acknowledged.
And and the upcoming packets 8 9 10 11.
These packets are neither transmitted nor acknowledged or they are next to be transmitted.
Okay. So what does the sliding window concept says that whatever be the window size you send those many packets back to back back to back and as soon as the acknowledgement of the initial packets start coming you shift the window
simultaneously okay is it clear now what could be the maximum window size can you guess what could be the maximum
window size the maximum window size could be 1 + 2 a And in stop and wait what was the window size? The window size was just one.
size? The window size was just one.
Okay.
So for the maximum window size we have a concept of sequence number also or sequence number concept.
What does it say that you need to number the packets also? You need to number the packets also. So for maximum windows
packets also. So for maximum windows maximum window size let's say uh 1 + 2a packets.
So the minimum sequence number required will be 1 + 2a because you need to individually uh number a packet. We have
discussed why because if we do not number the packet the receiver cannot understand whether it is a duplicate packet or not until it processes it and waste its resources on
a duplicate packet. So we have to number a packet. We have to number
a packet. We have to number acknowledgement also. So that the
acknowledgement also. So that the concept of delayed acknowledgement may not fool the sender.
We have discussed all of these things.
So I'm not going to repeat that. So
maximum window size be a let's say 1 + 2 a packet. So how many sequence number we
a packet. So how many sequence number we require? We require 1 + 2 a sequence
require? We require 1 + 2 a sequence number.
You know for just one bit we can give two sequence number 0 and 1. With two
bits we can give four sequence numbers 0 0 1 1 0 and 1 1.
So if we require 1 + 2 a sequence numbers here we require four sequence number. So two bits were required. So if
number. So two bits were required. So if
you require 1 + 2 a sequence number how many bits we are going to require? Log 2
1 + 2 a.
Okay. Is this till now? If you have any doubt you can ask.
No doubt. So we'll meet in the next lecture. We have addressed the flow
lecture. We have addressed the flow control DPP doubts. So the last class was the doubt class. From this class we are starting our new module which is
IPv4 header and fragmentation.
So we'll begin with the basics.
This is application layer. We start with a message and then this is transferred to transport layer and header is added to the message.
Now this was message and we call this as segment.
So when segment is transferred to network layer another header is added. We call it as H1 and this as H2 and we call this as
datagramgram.
So in the module of IP header we are talking about this header. Okay. So I'm
going to expand this header here. So
what happens? We have version Four bits. Four bits.
Four bits. Four bits.
What does this version means? Version
means that you are talking about IPv4 header or IPv6 header. Okay. So, how are you going to represent IPv4? We have
four bits. You have to represent four. 0
1 0 0. And what about six? 0 1 1 0. Is
it clear? So version represents the IP version IPv4 or IPv6. Then we have
header length of 4 bit again. So IP
header consists of several sections and we are going to address each of the section in the upcoming classes. Okay. So
version header length and then we have services of 8 bits and then total length
total length of 16 bit. So each row will be of can you count 32 bits or four bytes.
Okay. Now coming to the next row we have identification identification number of 16 bits.
We have flag of three bits and fragmentation offset of 13 bits.
Okay. So you can divide it into or let's leave that. This is again four bit four bytes 32 bits in total. 32 bits
in total and four by each row is of 32 bits. Okay. Now what about third row? We
bits. Okay. Now what about third row? We
have time to live of 8 bit and then protocol of again 8 bit and then header checkum of 16 bit.
What about fourth row? We have source IP address of of 32 bits. Yes, we have discussed the
32 bits. Yes, we have discussed the section of IP addressing already. And
what about destination IP of again 32 bits. So this is 4 by and this is 4 by. Now till this till this the first row, second row, third row,
fourth row and fifth row. We are talking about the mandatory part that should be present in each and every IP header. So
what will be the mandatory part? Five
rows of each four byte which means 20 by part should be mandatory.
So is there any part which is optional also? Yes. So we have options
also? Yes. So we have options of 40 is it bit or bite? 40 byt actually.
So we have options of 40 byt. Okay. Now
if I someone ask what is the minimum IP header size then you are going to reply 20 bytes.
What is the maximum IP header size when you're using complete options which is 60 byt.
So what is the minimum IP header size?
20 byt. What is the maximum 60 byt?
Okay. So this header length actually represent what is the what is the header size. Okay. Now header length is of 4
size. Okay. Now header length is of 4 bit. As you can see four bit can
bit. As you can see four bit can represent till 0 to 15 and we actually have to represent the minimum represent
20 and the maximum should represent 60.
How we are going to do? We will set the limit that the header length will range between 4 to 15 and the scaling factor or I should write 5 to 15 and the
scaling factor should be four. So this
will be representing 20 to 60 byte header. Is it clear? See the header
byte header. Is it clear? See the header length can be ranging from 20 bytes to 60 bytes. 20 byt is the mandatory part
60 bytes. 20 byt is the mandatory part and the 60 byt will be 20 byt + 40 byt of options
and this header length represent what is the actual header size and header size could range between 20 to 60 but these four bits can actually
represent 0 to 15 that's why we have to use a scaling factor is it clear Okay.
Now you you have to actually remember all of these. You have to remember this complete section with the size also. You
have to remember each and every section in the order which I have written and you have to also remember the size of each. So you have to remember that
each. So you have to remember that identification bit come in the second row first section and the size is 16 bit
have to remember like this. Okay.
Now we have discussed about the header length that the header length is actually of 4 bit. So it will range from 5 to
15 actually. Is it clear? So if I if
15 actually. Is it clear? So if I if someone askked if header size is 20 byt then you will write five in the IP header.
What about if it is 32 byt then you're going to write 8 because the scaling factor is four.
Clear? So here you will write 0 1 0 1 and here you will write 1 0 0 at this place.
Okay. We have already discussed the version of four bits header length of four bit. Now what about the services
four bit. Now what about the services part? So in services the interpretation
part? So in services the interpretation of the third first three bits. So
services is of services is of eight bits. Okay. See
here 8 bits. So in services the first three bits are called precedence bits. First three bits are
precedence bits. First three bits are preceded bits. precedence bits or you
preceded bits. precedence bits or you can also uh call it as priority priority bit and the next four bit will represent
the type of services type of services and the last bit is actually it's funny that it is not used
see in services three bit are the priority bit out of eight bits three bits are the priority bits four bits are the uh bits which will represent the type of services and the last bit is
useless.
Okay.
Okay. Now what about priority bit? What
is the meaning of this priority bit?
Priority bit means that what is the priority of your packet?
Okay. So priority field is needed if the router is congested and we need to discard some datagramgram. So those
datagramgram which will have the lowest priority will be discarded first. Okay.
For example the router is congested from all sides and it has to discard some of the datagramgrams. So it will discard the ones with the lowest priority. So that's
why the priority bit. Okay. Now what about the type of services? So it is a four bit subfield type of services.
Okay. Now out of these four bits each bit each bit have a special meaning.
Although bit can be zero or one but we are not going to represent like something like this 1 0 uh 1 zero. No
out of these these four bits only one can be one at a time and rest three will be zero. Why so?
be zero. Why so?
Why so?
Think about it. See this type of services is going to represent some of the services and only a single service can be on at a time and the rest three
cannot be that's why it could be either 0 or 1. So what does that mean 0 0 1 0 which mean this service is on or the router is priorit prioritizing for this
facility.
Is it clear? So let me uh write that in a very clear manner. So this will be the eight bits of services part. The first
three will be the priority bits PP.
The next four DT D T R C. These are the type of services. And the last bit is useless. It's not used. Now what does D
useless. It's not used. Now what does D means? D means minimum delay.
means? D means minimum delay.
Can you guess what will T mean?
Absolutely perfect guess. Maximum
throughput.
Now can you guess again what does R means?
Yes. High reliability
instead of maximum. Listen listen you were typing maximum reliability. Instead
of maximum we call it as high. Okay.
High reliability.
And what about C cost? Yes, minimum
cost.
So when I saying that out of these four only single can be one.
Which means for example if we are minimizing the delay then we will not look at the throughput. We will not look at the reliability. We will not look at the cost. We will just focus on
the cost. We will just focus on minimizing the delay.
And where when we will look at the minimum cost, we will not care about the delay. We will not care about the
delay. We will not care about the throughput. We will not care about the
throughput. We will not care about the reliability. We'll just care about the
reliability. We'll just care about the minimum cost.
Okay? So if I write like this 0 1 0 0 which means maximum throughput. If I
write like 0 0 1 0 which means maximum reliability 1 0 0 0 minimum delay 1 0 0 0 1 which means minimum cost. Is it
clear? Now we'll move to the next section which is total length.
We have discussed these three version which means which version you are using IPv4 or IPv6. Header length
can be from 20 to 60. We will use this ging factor of four. It will begin from 5 till 20 not 20 5 till 15 because 4 bit can represent from 0 to 15 and the
minimum is 20. So we are going to use five. We'll use the scaling factor of
five. We'll use the scaling factor of four. So 5 into 4 is 20 and then 15 into
four. So 5 into 4 is 20 and then 15 into 4 is 60. So this is how header length will work. And then the services part
will work. And then the services part the first three bit will be priority bits. The next four bits will be the
bits. The next four bits will be the type of services and the last will be useless. Now we are moving on to this
useless. Now we are moving on to this the total length part. Okay let's move down total length. Okay so total length
means data plus header. We already have the header length. Now why is there another section for the total length?
Because of the data part also. Okay. So
data plus header will be forming the total length. Now total length as you
total length. Now total length as you have seen is of 16 bits which means it can represent from 0 to 65535.
I've told you to remember this number 2^ 16 - 1. So it is 2^ 16 - 1 65535. Okay.
Now let's say this was the message from the application layer sent to the transport layer to become the segment
header is added and then this segment will be sent to the network layer segment and the header will be added
again. This is what this is what the
again. This is what this is what the total length.
Okay, this is what the total length. Now what
could be the total size? The maximum
size can be 65535.
So the total size total size including the data which is the segment and the header
is 65 65535.
Now this is the total size. Now the
header is of let's say minimum 20 bytes.
Then what is the maximum amount of data we can carry? The maximum size maximum data size at network layer this is 6 55
515 what we did just subtracted 20. So
this is the maximum amount of data size at network layer.
Is it clear?
Is it clear? So this was the use of total length 16 bit. Now let's move toward the new section. Identification
number identification.
Identification we also call it as datagram number. Datagram datagram
datagram number. Datagram datagram number. This is of 16 bits.
number. This is of 16 bits.
Okay. Now what does that mean? What do
you mean by identification? So what will happen? Each datagramgram will be
happen? Each datagramgram will be associated with a sequence number and we call it as datagram or identification number. So this is what I mean by
number. So this is what I mean by datagram. This was what datagram is.
datagram. This was what datagram is.
Each datagramgram will be associated with a specific number. That number is known as identification number. So we
had a message sent to transport layer.
Header will be added. This will become the segment and the segment will be sent to the network layer. header will be added again. Now this will become the
added again. Now this will become the datagram and each datagramgram is assigned a specific number. We call it as
specific number. We call it as identification number. It is used to
identification number. It is used to identify all the fragment of the same datagramgram. Now what do I mean by
datagramgram. Now what do I mean by fragment? See
fragment? See let's say our packet size is of 1,000 byte and the router capacity is of 500
by only. So what we will do? We'll
by only. So what we will do? We'll
divide the packet. we we divide the packet and we call them fragment. Now
what will happen if the fragments are divided the identification number should be same so that we can identify that these fragments belong to a single packet.
They are not individual packet they belong to a single packet. So for that purpose identification number is used.
It is used to identify identify what?
Identify all the fragments of same datagram. Same datagram.
So what will happen? Let's say this was our datagram with identification number of 101. And
when we will be it will be divided into smaller fragments. All of them will have
smaller fragments. All of them will have identification number of 101.
So that we may identify that these fragments belong to the a single datagram or a single packet. Okay. So
what is identification number used for?
It is used to identify all the fragment of the same datagram. Okay. So all the fragment of same datagram will have same identification number. Is it clear? Now
identification number. Is it clear? Now
let me clarify more with the help of a diagram. Suppose this is our sender.
diagram. Suppose this is our sender.
This was a router in between and the maximum transfer unit for the router is let's say 100 bytes and this is the receiver.
Okay. So what we will do let's say this was our packet or datagramgram and we we have identification number of 100 and the size of the packet is 300 byt.
So what we will do we'll divide the packet into three sections or three fragments. We will say three fragments
fragments. We will say three fragments and each fragment will have identification number of 100 100. Is it
clear? So when these fragment will reach the receiver, receiver may identify that they all belong to a single datagram.
Okay. So this was identification number used for.
Till now is everything clear? We have
discussed five sections. Till now is it clear?
five sections. Till now is it clear?
Okay, let's move to the next section of flag.
Flag see flag is of just three bit. It's
just a three bit field. One bit, two bit and three bit. And in these three bit also the first bit is not used. It's
useless. The second bit is called DF and the third bit is called MF. What is DF and MF? DF is called as don't fragment
and MF? DF is called as don't fragment and MF is called as more fragment.
Okay. So what does don't fragment mean?
If I have set don't fragment bit as one which means we are saying to the router that you are not going to fragment the packet even if
your capacity is 100 bytes. Let's say
here my packet was of 300 bytes and the capacity of router is of 100 byt only.
And if we have set the don't fragment bit to one which means we are saying the router that don't you dare to fragment the packet.
Okay. If you are not able to forward it you can send it back but don't you dare to fragment. So don't fragment means the
to fragment. So don't fragment means the router will not fragment it. And what do we mean by more fragment? More fragment
means that there are more fragments to come that that this is not just a one packet.
Is it clear? So let me write in a formal way. Don't fragment. This could be zero
way. Don't fragment. This could be zero or one. One means can't be fragmented.
or one. One means can't be fragmented.
Datagram can't be I should write properly. Datagram
properly. Datagram can't be fragmented.
and zero means it can be okay.
Now what will happen? Let's say this was our sender and this was our receiver.
Don't fragment bit is set to one and we have again 100 let's say 300 byt packet and the router capacity MTO is 100 by only. So what will happen when this
only. So what will happen when this packet will be sent to the router?
Router will see that I'm not able to forward the 300 byt packet forward because my capacity is of 100 byt only.
So what router will do? Router will send back an ICMP message that buddy you have set the don't fragment bit to one. So I cannot forward
it because my capacity is 100 by only.
Okay. So this was the case of don't fragment.
Okay.
What if the drone fragment bit is zero?
Now let's discuss that case also.
So this was our data. Now 20 byt header will be there. 20 byt header will be there. So when this whole packet or the
there. So when this whole packet or the datagramgram is sent to the router, router will see that the size of the datagram is 320 bytes while the size of
maximum transfer unit of router is 100 by only. So what will this do? What will
by only. So what will this do? What will
or let's change it to 120 by. So what
will router do? Router will divide the packet into 100 by 100 by of data and 20 byt of header. 100
by of data and 20 by header. You know
header will be added to fragment fragmented packets also otherwise they will not not know or the upcoming routers because there can be more routers in between and routers may not
know where this packet or this fragment need to be forwarded if fragment do not have the headers. So headers
will be added to packet also and headers will be added to datagram fragment also.
Okay. So these are datagram fragments.
And this is packet or datagram.
So header will be added to both of them.
So this was 300 byt of data divided into 100 byt, 100 byt and 100 byt. And 20 byt of header will be added to each of the fragment.
Okay. Now identification number let's say identification number is 100. So
here also identification number will be 100 100 and 100 and don't fragment bit was already set to zero.
Okay. So now how many how many bits are actually transferred?
How many bits are actually transferred?
360 120 120 120. So 360 bits or I should say bite bite. So 360 bytes are actually
bite bite. So 360 bytes are actually transferred. So can you calculate the
transferred. So can you calculate the efficiency useful bytes upon total bite?
If you ever catch me uh mixing the word of bite and bits, so please forgive me.
It's just a silly mistake. You can
understand where I'm referring bite and where I'm referring bits.
So what is the useful bite that should be sent?
300. And what is actually sent 360. So
what is the efficiency?
0.833 or you can write 83.33%.
Okay. So if someone ask you to find the efficiency in this scenario then what you can do? So this was just the packet uh the data which need to be sent and
what is the actual uh bytes that are sent 360.
Okay. Now you can you could have guessed that the lesser the router forwarding capacity the more fragments will be the more headers will be attached and the
more byes needed to be transferred lowering the efficiency.
Is it clear?
Let me repeat. If the forwarding capacity of router is less then there will be more fragments more headers will be attached lowering the efficiency by
increasing the total bytes that were transmitted. Okay. So this was the case
transmitted. Okay. So this was the case of more fragment. Now oh sorry don't fragment what was what will be for the more fragment
it could be zero or one again zero or one.
What does more fragment bit one means?
Which means that this is not the last fragment.
Which means there are more fragments to come or more fragments after this fragment. And what about zero? That
this fragment. And what about zero? That
this is the last fragment.
Last fragment. So here
don't fragment bit will be zero and more fragment bit will be one. Don't fragment
bit will be zero. More fragment bit will be one. Don't fragment bit will be zero
be one. Don't fragment bit will be zero and more fragment will be zero here.
Why? Because this is the last fragment.
Is it clear?
Why don't fragment zero here also?
Because sender has no problem in breaking down the packets.
Sender has no problem to let the router break down the packets. So this router will also have no problem to let other routers break down the packet. Okay, that's why
don't fragment bit. If set zero by the sender, it will remain zero by the zero for the whole time. But what about more fragment?
The last fragment, the last fragment will have the more fragment bit as zero.
While the non-last fragment or the previous fragments will have the more fragment bit as one. What does one represent? That this is not the last
represent? That this is not the last fragment. There are more fragments after
fragment. There are more fragments after this. And what does zero represent? That
this. And what does zero represent? That
this is the last or only fragment.
Is it clear? Okay, let's move to the next segment of fragmentation offset of 13 bits. What
does fragmentation offset mean? So let
me write here fragmentation offset means that indicate the number of datab ahead of this packet in the ahead of this fragment in a
particular packet. Let me repeat
particular packet. Let me repeat fragmentation offset will indicate number of databyte databyte ahead of this particular
fragment in the packet. For example,
for example, let's say this this was the these are the three fragments fragment one, fragment two and fragment three.
Okay, more fragment one more or you can also write like this or it's okay 1 2 and three this was the last fragment the first and the second
one okay now what will be the fragmentation offset how many bytes are ahead of this how
many bytes are ahead of this fragment how many bytes are ahead of this fragment well this is the first fragment So none of the bytes are ahead of this
fragment. So we will set the
fragment. So we will set the fragmentation offset as zero.
Now how many bytes are ahead of this fragment the fragment two? Well we have the first fragment before fragment two.
So I'll say 100 bytes are before fragment two. So the fragmentation
fragment two. So the fragmentation offset for the second packet will be 100 byt. What about third packet? How many
byt. What about third packet? How many
bytes how many bytes are before the packet three or the fragment three? I'll
say 200 bytes. So 200 bytes will be the fragmentation offset for packet 3.
Now you know in fragmentation offset we were only looking at the datab. Let me
write here properly. Fragmentation
offset.
What does that mean? The number of datab datab ahead of a particular fragment ahead of particular fragment
in a packet.
For example, 100 bytes or 300 bytes were divided into 100 byt, 100 byt and 100 bite.
Now this was the first packet. How many
bytes are ahead of this first packet?
Zero. This is the second bucket. How
many bytes are ahead of this 100 byt?
Now this is the third. How many bytes are ahead of this? 200 bytes. So for
this fragmentation offset will be zero.
For this it will be 100. And for this it will be 200. It look like this. 0 100
and 200. I hope it is clear.
Now what will be the range of this fragmentation offset as it is of 13 bits. So the range will
be from 0 to 2^ 13 minus 1.
It will be 8 1 91 0 to 81 91.
If you have any doubt till now you can ask.
So we have discussed this fragmentation offset also. There's more to discuss in
offset also. There's more to discuss in fragmentation offset. We will discuss it
fragmentation offset. We will discuss it later when we will discuss the miracles of the that we have a division factor of eight here. Okay, we will discuss that
eight here. Okay, we will discuss that later. Now
later. Now the next rows of TTL protocol and header check sum and source IP destination IP options we'll discuss in the next lecture.
Till now if you have any doubt you can ask.
Everything clear?
Okay then in the last lecture we have discussed the first two rows of IP header. In this
lecture we are going to discuss the further more rows. So we'll begin with this TTL time to live. Okay. This is of
8 bit field time to live.
8 bits. Okay.
Now what is the use of this time to live and what is this? This TTL field is used to control the maximum number of hops
visited by datagram to limit maximum hops visited by a datagram. And
why? So can anyone guess limit maximum hop visited by datagram?
And this is done to can anyone guess?
Why are we limiting the maximum number of hops visited by datagram? Why are we doing so?
Think think of it like this that you have to reach from one place to another and I'm limiting that your car can takes let's say x number of turns why I'm
doing so yes exactly to avoid infinite looping.
Infinite looping should be avoided. So
TDL field is used to control the maximum number of hops visited by datagramraph to avoid infinite looping. So when a source host when a source host sends a
datagram it stores a number in this field each router that process a datagramgram. So
when this will be passed to router one let's say that datagram decrements this field by one and if DTL field reaches zero before the datagramgrams arrive
destination then what will happen then the datagramgram is discarded and the ICMP message will be sent to the sender that your
packet has been discarded due to TTL limit reached. Is it clear what we are
limit reached. Is it clear what we are doing?
Why are we doing so? Let's discuss like this. For example, due to some mistake,
this. For example, due to some mistake, the router keeps forwarding the packet.
R1 forwards the packet to R2. R2
forwards the packet to R3 and R3 forwards back to R1. What will happen?
What will happen? Resources will be wasted. Congestion will increase.
wasted. Congestion will increase.
Traffic will increase and the network will collapse. To avoid this, what we
will collapse. To avoid this, what we are doing? We are setting a limit
are doing? We are setting a limit on this time to live. What will happen?
Let's say the TTL limit set by the source is let's say TTL limit is six. So
what will happen when this will send by the router? Router will process it.
the router? Router will process it.
Router will decrement this limit to before forwarding router will decrement this limit to five. So six will be the limit when it is received by the router and five will become the limit when the
router forwards it. Now this packet reached to R2.
When R2 will forward the limit will be four. So when R3 will forward limit will
four. So when R3 will forward limit will be three. In this manner the soon limit
be three. In this manner the soon limit will be zero before reaching the destination. At that time
destination. At that time the packet will be discarded and ICMP message will be sent. ICMP message is like a error message will be sent to the source that your packet has been
discarded due to TTL limit reached.
Is it clear?
Okay. Now one another point that TTL limit is only decreased when network layer is touched.
Are you getting the point?
You remember a few lectures before I have made this diagram.
We start with application layer, transport layer, network layer, data link layer and physical layer on source and receiver. But at the router we reach
receiver. But at the router we reach only till the network layer or we require the services of network layer only. So what will happen? We will reach
only. So what will happen? We will reach till network layer and will go down again.
If there is some another intermediary node which don't even require the services of network layer then what will happen? The TTL failed will not be
happen? The TTL failed will not be decremented.
Is it clear?
So do you remember the subnetting uh lecture where we have discussed that if router receives a packet it has to decide that at which network it will forward network one network 2 network 3
or network 4 and if there's no match then it will use the default route default route.
Okay, do you remember this? So and we have a routing table and we had a routing table. So do you remember this concept? So what will
happen as soon as the packet will be sent to the router?
Router will process it and during processing what will router do? Router
will do the end do the bitwise end between what?
Do you remember the concept? Router will
do the bitwise ending between what?
Exactly.
And when the N ID will match what will happen a router will forward the packet to that network ID or the that network.
Okay. So this is what I mean by processing. Now as soon as the router
processing. Now as soon as the router receive a packet it will process and during processing it will decide at which network it has to forward the
packet and it will forward the packet with a modified header. with a modified header. Forward it
header. Forward it with modified header and what will be modified? TTL
will be decreased by one.
Is it clear? So that at at one time infinite looping will be prevented.
Okay. Now what will happen if the TTL become one at the receiver because receiver also have this network layer physical layer data link layer network layer transport layer and application
layer you know let's say we started with TTL value two received TTL value two and when it is
forwarded to the receiver the TTL value will be one and when it will be received by the receiver and you know network layer will be reached Again modification will happen and TTL will layer will
become zero during this point. If TTL
becomes zero at the receiver then it will be accepted. If TTL becomes zero before the receiver then it will be discarded. ICMP packet will be sent to
discarded. ICMP packet will be sent to the sender that your packet has been discarded due to TTL limit reach.
Okay, is this point clear? So those who have have network layer only they will be decrementing the TTL field.
Okay. For example here if we have some LAN cables in between. Now LAN do not require network layer. So is LAN going to decrease the TTL? No.
Will router decrease? Yes. Because
network layer will be reached there.
Okay. So I think the TTL part is also clear. Now we will move to the next
clear. Now we will move to the next protocol.
Okay. Similar to TTL protocol is also of eight bits. Okay. So the 8 bit field
eight bits. Okay. So the 8 bit field tell us which protocol is encapsulated in the IP packet.
Which protocol is encapsulated in the IP packet. So if let's say protocol number
packet. So if let's say protocol number is one then we'll assume that it is ICMP.
If it is if it is two then it is IGMP.
If it is 17 then it is UDP. If it is six then it means TCP.
And at the time of traffic at the time of traffic some packets must be discarded and some must not be and some must be uh maintained. Why? So because
the property of these protocols are different. For example, TCP is reliable.
different. For example, TCP is reliable.
TCP is reliable. TCP will ensure that packet should not be lost. While UDP is not reliable, UDP do not care about the packet. It care about the speed. So what
packet. It care about the speed. So what
will happen if congestion happens if at the time of traffic some packet must be discarded and we will notice at the protocol field
if the value is six which means it is TCP then we have to ensure that this packet should not be discarded if the let's say protocol value is one which
means it is ICMP it's just a error message some going back to let's say some sender it's not that important So the ICMP will be discarded
first and then the IC IGMP will be discarded and then UDP will be discarded and the last priority will be given to TCP.
Is this clear? So the order in which the router eliminate the datagramgram from the buffer will be this ICMP packet will be the first to be discarded. Why? It is
just an error message. Okay. So this is what protocol means.
Is it clear?
Now let's move to our next section of what is the next section. We have
completed protocol. The next section is header checksum and it is of what? 16
bits.
Header checksum.
16 bits. Okay, we have learned about the checksum. What is checksum? We have
checksum. What is checksum? We have
discussed already. Let's discuss again.
Let's say we have data of 0 1 1 0 1 1 0 0 0 or 0 1 1 0. Okay, let's say this is the data. What will happen? We will
the data. What will happen? We will
divide it into four. Let's say k equals to 4.
Okay, now what we will do? What is the number in uh decimal? It is 7. What is
this in decimal? It's 11. This is 12.
This is 0. And this is 6. So what we will do in check sum? We will sum them all.
It will be at 36 or yeah 36. Okay. So
the check sum will be 36.
Now if any of the bit is changed, for example, it's it becomes 0 to 1 or 1 to let's say this become 0 to 1. In that
case, this will not remain 36. So what
will happen?
This will be sent to the receiver. What
receiver will do? Receiver along with the check sum. What receiver will do?
Receiver will calculate the check sum.
Again, if receiver also calculate 36, which means there is no error. If
receiver calculate something else, let's say some error happened and this bit changed from 1 to 0. Now what will happen? and this will become 8 and this
happen? and this will become 8 and this will become 32. Now the 32 do not matches with 36. In this case the error has occurred. We will do we will
has occurred. We will do we will calculate the check sum for header only because the complete part will be
covered in the TCP checksum. So you can understand it by this analogy. Let's say
we create a truck Optimus Prime. So what
will happen? The truck driver will only care about their stuff. They do not bother about what's there in the cart.
Okay. So this is like uh caring for the header part only or caring for their cabin only. Okay. So it will be
cabin only. Okay. So it will be calculated for header only. And you know header changes at every router or every uh intermediary node whichever include
network layer. Why? So because TTL value
network layer. Why? So because TTL value is changed. As TTL value is changed
is changed. As TTL value is changed which means the complete checksum will be changed and if the whole checks sum is changed it must be calculated at every router. So it is calculated for
every router. So it is calculated for header only and will be calculated at every router.
Okay. So the next will be source IP and the destination IP. Source IP
destination IP.
Okay. Let me say it formally. As you
already know, we have discussed what source IP and destination IP mean in the first module only. So the 32bit these are of 32-bit.
These 32 bits defines the IP address of the source. This field remain unchanged
the source. This field remain unchanged during the time the IPv4 datagramgram travel from source host to destination host. Okay.
host. Okay.
And these source IP and destination IP remains unchanged. The 32-bit field
remains unchanged. The 32-bit field defined the IP for address of the destination. This also remain unchanged
destination. This also remain unchanged during the time that IP datagramgram travels from source host to destination host. Is that point clear? I have spoken
host. Is that point clear? I have spoken in a very bookish language.
You already know what source IP and destination IP is. Okay. Now one table is important. Let me draw that table.
is important. Let me draw that table.
not changed maybe and definitely changed. Okay.
So what is definitely changed? You have
to tell what is definitely changed among those uh sections of IP header which we have discussed.
TTL yes RAM to live and header checkum.
Yes, we have just discussed this. And
what is not changed?
Start with the first. Is version
changed? Do version changes? No, it do not change.
It do not change. Does services or header length change? No. Header length
is also not changed. Do
services changes? No. Services are also unchanged. What about identification
unchanged. What about identification number? No, they are also not changed.
number? No, they are also not changed.
Don't fragment. No, they're also fixed.
Well, more fragment may be changed because for the first packet it could be one and for the last packet it could be zero. So more fragment may change. What
zero. So more fragment may change. What
about protocol? Protocol also remain fixed. What about source IP and
fixed. What about source IP and destination IP? They do not change it.
destination IP? They do not change it.
Okay. See you can transfer this header length into here. Okay. What about total length? While total length may change as
length? While total length may change as options can change.
Okay. So total length more fragment you can write fragmentation offset these may change. While which of the section which
change. While which of the section which will be definitely be changed TTL and header section.
Okay. Now what about options? The last
section.
What about option?
Okay. So the full header the full header is divided between two part the mandatory part and the options. The
mandatory part is of 20 byt and options is of 40 by. We have already discussed this. Okay you can also call mandatory
this. Okay you can also call mandatory part as fixed part and options as variable part.
Okay the fixed part is 20 byt long and the variable part is a maximum of 40 bytes.
Okay. Now what are there in the options?
So options we have we'll discuss them all. Strict source routing
all. Strict source routing we have lose source routing. What is
strict loose source? Strict and loose source routing. Strict source routing
source routing. Strict source routing means that we are giving exact path that a packet should follow. For example,
this was our segment which we received from the transport layer and we added a header here. Okay. So this is our
header here. Okay. So this is our header.
Okay. Now what what do you mean by strict source routing that we are telling the driver that you have to follow this strict path only. This path
only. And if there is some problem in the path let's say some construction work is going on you do not change another path. you tell me as the sender
another path. you tell me as the sender and how does the driver tell me with the help of ICMP packet.
So what I'm telling let's say this is sender and this is receiver these are the routers
okay or I should make like this path now sender has specified strictly that you have to follow this path but what happened there is some
problem in this link so what will uh this router will do router will send a ICMP packet that there is a problem in the link link and you told me to follow
this path only. So here is the problem.
So ICMP packet will be delivered to the sender but root will not change. Okay, the road will remain same. So in strict source
routing we exactly or specifically tell that these these routers should be encountered or this path should be followed. While in loose source routing
followed. While in loose source routing what we will do we will say that you have to encounter or you will
cross this router. Okay then if you have options you can follow whatever option you want. These router are fixed that
you want. These router are fixed that these should come in between and for the remaining router it's your choice. And
what about strict source that each and every part is already decided and source will decide the root. Okay,
strict and low lose. Is it clear?
What about recall routing?
What about time stamp and padding?
So these are the features offered by options.
Okay, so we have already discussed what is source routing, strict source routing. So we started with source
routing. So we started with source router one, router two, router four and then receiver. Here we have router
then receiver. Here we have router three. So in strict source routing we
three. So in strict source routing we exactly tell which routers you have to follow. Okay. So the packet will follow
follow. Okay. So the packet will follow the same path.
Okay. And will reach the receiver.
In loose source routing, we tell the packet that you have to encounter or you will go through the path of R1 and then later you can uh follow
whatever path you want.
So lose is similar to strict source routing but it is less rigid. Each
router in the list must be visited but the datagramgram can visit other routers as well.
Is it clear? So what about recall routing? What is recalled routing?
routing? What is recalled routing?
record routing from whichever router the datagramgram passes through the datagramgram will record that I have passed from this router.
Is it clear? So record root options is used to record the internet routers that handle the datagramgram. Okay. So a
packet reached router one first. So
packet going to register that I have gone through router one and then when it is went to router two then the packet going to register that I have now uh
reached router two. So this is what record routing is. Record route option is used to record the internet routers that handle the datagramgram.
So it can list up to nine router addresses. This is a fixed limit
addresses. This is a fixed limit addresses.
Okay, is it clear? Okay, so we have discussed this, this and this. Now what about time stamp and padding?
Somehow the recording was paused here.
Let me speak again. During the time stamp, what we do? We calculate the delay. For example, a packet arrived at
delay. For example, a packet arrived at 9:5 a.m. and it leave at or left at 9:10
9:5 a.m. and it leave at or left at 9:10 a.m. So the delay will be of 5 minutes.
a.m. So the delay will be of 5 minutes.
So to calculate the delay at each router we are using time stamp. What about
padding? For example we studied that for the header length if it is 32 byt we write at we write as 8. If it is
20 byt we write it as five. If it is 60 byt we write it as 15 at the section of this header length. Okay. Now what if
instead of 32 byt it is 30 byt. So in
that case we are not going to write 7.5 there. We will add two by as a padding.
there. We will add two by as a padding.
We will add these two by as a padding and then it will become 32 and then we will write eight there. Okay. So this
was the padding part. Now we have discussed the whole uh IP4 header in one go. Let's discuss that again. So in
go. Let's discuss that again. So in
version what we do? we write as either four or six in binary to represent IPv4 and IPv6. What about header? Header
and IPv6. What about header? Header
length header length have the range of 5 to 15. It's of four by it could have
to 15. It's of four by it could have range from 0 to uh 15 but the minimum header length should be 20 and the scaling factor is of four. That's why it
began from five and ended at 15 because the maximum header length could be 60 from using 40 bits of 40 bytes of op
options. Okay. For the services part we
options. Okay. For the services part we had three bits of priority four bits for the services DTRC delay throughput reliability and cost and the
last bit was useless. What about total length? Total length of 16 bit that
length? Total length of 16 bit that represent the data plus the header part.
The maximum amount of data that can be there in the network layer will be 65515 assuming that the header is minimum consisting of mandatory part only. What
about identification bit? It is used to identify the different fragments of the data ground. Okay. What
about flag? The first bit is useless.
Don't fragment suggest that the sender do not allow the routers or intermediary nodes to divide the complete packet into fragments. More fragment means it could
fragments. More fragment means it could be zero or one. Zero means this is the last fragment and one means that there are more fragments to come. What about
fragmentation offset? It represent the number of bytes of data that is before transferred to a particular fragment.
For example, fragment one, fragment two, fragment three. If you are talking about the
three. If you are talking about the fragmentation offset of this fragment two, then you will be writing the number of bytes transferred before fragment two, which means number of bytes of data
that is transferred in fragment one.
What about TTL? TTL is used to avoid infinite looping. It will be of 8 bit
infinite looping. It will be of 8 bit only. What about protocol?
only. What about protocol?
Again 8 bit it will be used to describe or it is it is used to uh prioritize which all packets that can be discarded in the case of congestion or in the case
of traffic. For example TCP packet is
of traffic. For example TCP packet is way more important than ICMP error packet. So we are going to discard ICMP
packet. So we are going to discard ICMP packet first then in the last the TCP packet. Okay. What about header
packet. Okay. What about header checksum?
It is used for error control for the header part only and header check sum is calculated at every router. Why? Because
header is changed at every router. How
so? TTL is changed. TTL is decremented.
Okay? And we have source IP, destination IP and the end options. In options we discussed about strict source routing in which there is a strict path given. What
about loose source routing in which it is given that these many routers you must cover and the remaining it's on your choice. Then we discussed about
your choice. Then we discussed about padding.
We have just discussed that two bits will be added so that a proper number will be formed. Then we discussed about time stamp. Time stamp is used to
time stamp. Time stamp is used to calculate the delay part and then in the end record routing.
We can record that from the packet has encountered which of the routers. Okay.
And the limit is nine. We can record nine routers.
So this was our module for IP header and fragmentation. But before ending this
fragmentation. But before ending this module, let's discuss more about fragmentation.
Fragmentation offset.
Okay, we can uh discuss it with the help of an example. Suppose the IP datagramgram size is of uh datagram size is of
1,000 bytes and this arrives at a router. Okay. And the router has to
router. Okay. And the router has to forward a packet on a link whose uh MTU whose MTU is 100 bytes okay assume that
the size of IP header is as you already know but it's okay that I should mention 20 byt. Okay, the header is 20 by
20 byt. Okay, the header is 20 by options are not used.
Now tell me the number of fragments that IP datagramgram will be divided into for transmission.
Okay, now there's one thing which I have not discussed in the fragmentation offset. We will address that part in
offset. We will address that part in here. For example, here we have
here. For example, here we have we have the datagramgram size the datagram size
of 1,000 byt which means the data is 980 and the header is 20.
Okay. And this is transferred to a router which is empty of 100 byt only.
Okay.
And then it is sent to the receiver. Now
what happens? What happens? How many
number of fragments will be there? So 80
and 20 80 and 20. So in this manner it will be divided. Now we want let's say X fragments which has 80 byt of data and how many
fragment we are going to require? So
that 980 will be the total data transferred. So 980 divided by 80
transferred. So 980 divided by 80 this will be 12.25.
Now see here 12 with with 12 packets with 12 packets or with 12 fragments how many data you can transfer?
How many bytes of data you can transfer?
12 into 80. This is 960. Now in the last fragment you require 20 byt of data here and then 20 by header. So how many total
fragments you require?
You should apply the ceiling function for this 0.25. So we require total 13 fragments. Till now it's clear this was
fragments. Till now it's clear this was not a hard question. Is it clear? Now
one thing which I want to tell that the scaling factor the scaling factor for the header length was four. You know
there is another scaling factor or you can call it as descaling factor whatever you want to call for fragmentation offset the similar concept fragmentation
offset. Let's say if for this this was
offset. Let's say if for this this was the case that we have already discussed.
So if you're calculating the fragmentation offset for this packet two, you will be looking at the amount of data. We are not talking about the
of data. We are not talking about the size of datagram. We are talking about the amount of data which means this part only this packet one has transferred. So the
number of bytes before this fragment. So
let's say the number of bytes are 800.
So what you will write in the fragmentation offset of this two? You
are not going to write 800. You are
going to write 100. So 8 will be the scaling factor.
Okay. So if you find that the fragmentation offset is 100 then you are going to assume that scaling factor is 8. So 800 will be the amount of data
8. So 800 will be the amount of data that has been transferred before this particular segment.
Okay. So the scaling factor for fragmentation offset will be eight. Good
morning class.
In the last lecture we have addressed the doubts from the DPV of IP header and fragmentation.
Okay. So as promised with this lecture we are starting our new module of TCP UDP. But before moving on to the TCBOP
UDP. But before moving on to the TCBOP part, we must first understand the basic connectionless
and connection oriented protocols.
So can you guess what do we mean by connectionless and connection oriented?
Yes, everyone would guess this first.
Everyone will guess that connection less and connection oriented means that we are talking about the physical connection. Connection less means that
connection. Connection less means that we are talking about wireless and connection oriented means that we are talking about the wired connection. But
you know we are not talking about the physical connection here.
We are talking about the logical connection.
Okay. So let's say this is a sender and this is a receiver.
Okay.
So each and every frame sent by the sender to the receiver if they are somehow logically related then I'll say it is connection oriented
and if the frames sent from the sender to the receiver are independent then I'll say it is connectionless protocol.
Okay. So let me uh speak in the formal way. Let me define in a formal way.
way. Let me define in a formal way.
Connectionless protocol means frames are sent from one node to another without any relationship between the frames.
Each frame is independent which means there is no connection between the frames.
It does not imply that there is no physical link between the nodes. Okay,
we are not talking about the physical connection here. We are talking about
connection here. We are talking about the logical connection here. Okay. So
what about connection oriented?
In connection oriented, a logical connection should be first established between the two nodes. Okay, we call it as setup phase. So this is important. We
call it as setup phase where a logical connection is first established.
Logical connection is first established.
Okay. After all the frames that are somehow related to each other are transmitted and we call it as transfer phase and then the tear down phase where the
logical connection is then terminated.
We connect, we transfer, we terminate.
The frames are numbered and sent in order. So one another
order. So one another specialty of connection oriented protocols is that frames are sent in order. Why so?
Because they are related with each other. They can be numbered like this is
other. They can be numbered like this is frame one, this is frame two, this is frame three and four.
This is a relation. While in connection less there is no relation between the frames. frames can be received out of
frames. frames can be received out of order.
Okay. So even if in the case of connection oriented the frames are received or the frames are not completely
received there are some frames remaining then receiver will wait and will rearrange them and then deliver to the network layer in order. Are you
getting the point?
In order delivery to the upper layers is important in the case of connection oriented protocols while in the case of connection less receiver may receive out
of order.
Is it clear? So here connection less and connection oriented means we are talking about the logical connections not the physical one.
Okay. So now we are ready to start with transport layer layer services.
Okay. So transport layer is responsible for process to process process to process or you can also call it as porttoport
or end to end delivery end to end communication which involves delivering message directly to the specific application or process running
on the computer. How we are going to identify the process with the help of port number. Okay, we have learned that
port number. Okay, we have learned that network layer manages host to host connect communication ensuring message reach the correct destination on the computer.
Okay, message reach the correct destination or the computer.
However, how to forward it to appropriate process that part is handled by transport layer. We have already discussed all of these things uh before when we discussed about the port
numbers.
Okay, clear.
In connection, in transport layer, we have connection oriented protocol, connection oriented and connectionless two.
In connection oriented, we have the TCP transmission control protocol.
Transmission control protocol.
Okay.
So what does TCP do? It establishes a connection with the destination transfer layer before the data transfer. We
already discussed that. After the
transfer connection is terminated. We
have discussed this. We have setup phase, transfer phase and termination phase.
Okay. And TCP it is known as a reliable protocol. Reliable protocol. Connection
protocol. Reliable protocol. Connection
oriented and reliable is what? TCP.
Okay. And we have connection oriented.
We have UDP. The full form is user datagramgram protocol.
Okay. It is connectionless and nonreliable but it is fast as it has less overhead.
Okay. It's treat it treat each segment as independent packet as it is connectionless. So each frames or each segment is will be considered as
independent and there is no setup phase no tear down phase so less overhead it is reliable oh sorry it is unreliable nonreliable but
it is fast is it clear okay so in transport layer the key facilities or the key uh
responsibilities is flow control and error control and the most important part is reliability.
Okay.
So if I tell you the summary, we studied connectionless and connection oriented.
Connectionless means there is no uh relationship between the frames sent from sender to receiver. Receiver can
receive out of order and connection less protocol from the transport layer is UDP while connection oriented means
the frames have relationship among them.
Receiver will send in order fashion to the upper layers and the transmission control protocol is the connection
oriented protocol in the transport layer. Till now is it clear?
layer. Till now is it clear?
Flow control, error control, congestion control also it is actually included in flow control is the responsibility of transport
layer. Okay,
layer. Okay, we have already discussed about the port numbers. Were you absent in the class?
numbers. Were you absent in the class?
We have discussed this I think in the IP addressing somewhere about the port number.
Okay. So let let me repeat again what happens for example in a computer there are several processes.
So a device received a message. How will
the device know that which process is demanding that message or for that or for which process is the message received? That is identified with the
received? That is identified with the help of port number. So port number is useful in identification of the process.
It is a 16 bit number.
It is a 16- bit number. From 0 to 1023 as the range of 16 bit number is 0 to 65535. So from 0 to 1023 they are
65535. So from 0 to 1023 they are well-known port numbers and the remaining are used by the normal users.
The famous ones that you should remember is of FTP of DNS of uh TNET, SMTP,
DHCP, POP, POP 3, IMAP, HTTP, HTTPS.
Okay. SNMP.
You can remember the port number of all these if you want. for HTTP. Anyone
remember what was it? 80 for HTTPS. I
remember I have told you to find the port number of HTTPS as a homework. Did
you find?
Yes. 443. What about POP 310 1. What about IMAP? I remember it's it's
1. What about IMAP? I remember it's it's like 143. What about SNMP? 161. FTP it
like 143. What about SNMP? 161. FTP it
has two 20 21. What about DNS 53?
What about SMTP? 25.
What about DHCP?
It has two 67 and 68. What about Telnet?
Do you remember?
22. Okay. These are the famous ones you can remember.
Okay. So 0 to 1 2 3. These are
well-known port numbers assigned by INA.
See these are used by servers.
These are used by servers to identify well-known process. For example, uh port
well-known process. For example, uh port number 80 means you are requiring a web service. So, HTTP will be there. So,
service. So, HTTP will be there. So,
these numbers are standardized and used to ensure what I should say client server communication.
There are registered ports. The
remaining are from 1024 to later. They
are not controlled by the authorities and can be registered to prevent duplication. That's it.
duplication. That's it.
Okay.
Now when we are talking about port numbers, I think we should talk more. We should
talk about socket address also. So
let's discuss a new concept. Socket
address.
So you know socket address is nothing but IP address with port number with port number.
For example, uh IP address is 200.23.56.8 and port number is let's say 69. So when
you just club them, they become the socket address.
Okay, it's nothing new. IP address and port number when they are written together it act as a socket address okay
so that's why I encourage you to ask doubts if this guy has not asked what is port number then you would have not known the
concept of socket address okay so is it clear till now if you have any doubt you can Okay. Now we'll move toward the TCP
Okay. Now we'll move toward the TCP header part. We have already discussed what IP
part. We have already discussed what IP header is. We discussed the sections. In
header is. We discussed the sections. In
the same way we'll begin with TCP header. So let's begin.
header. So let's begin.
We have source port address. Here we
talk about port not the IP address.
source port address and destination port address in the first row
of 16 bit each 16 bit 16 bit. So the
first row is again 32 bit which means four bytes.
Okay. The second bit is sequence number.
You know this is alone 32bit and then acknowledgement number. This is
again 32 bit.
So again four by four byte.
Okay. Now what about fourth row? Fourth
row is you know a bit lengthy or we have header length
four bit. We have reserved eight 8 bits
four bit. We have reserved eight 8 bits not eight bits six bits and then we have
the flag bits.
Urgent pointer acknowledgement.
We have push flag. We have reset. We
have send flag and we have finish flag.
Okay. And then we have a window size of 16 bits. So total 6 and 4 10 and 10 and
16 bits. So total 6 and 4 10 and 10 and 16. So this is total again 16 and this
16. So this is total again 16 and this is 16 16 32 four bytes again. And in the
end the last row you have checksum of 16 bits. And you know this is not header checksum. This is now complete
header checksum. This is now complete checksum data plus header. And we have urgent pointer
of 16 bits. So again four by. So these
are all the mandatory parts. These are
all the mandatory parts. Again
20 bytes.
Five rows all mandatory each of four bytes the total will be 20 bytes.
Okay.
So in the end you have options again of 40 bytes options or padding.
Okay. Now let's understand one by one.
So we have discussed uh the source port address and destination port address as transport layer is process to process uh communication
uh layer. So the process from the sender
uh layer. So the process from the sender size sender side will be representing the source port address and the process receiving at the destination side will
be the destination port address. Okay.
Now what about by bite numbering in TCB?
Byte numbering in TCP.
Okay. TCB assign unique number to each data bite in the connection. Each datab
unique number is assigned. What happened
in the IP protocol?
The IP was packet oriented protocol. The
TCP or the transport layer is what? Bite
oriented. So what happens? TCP assign a unique number to each datab. Unique
number is assigned to each datab.
Okay. We uh the numbering is independent in each direction. Okay. So we do not start numbering from zero. We do not start numbering from zero. And you know
we have we have 32 bit to number.
Okay. So we do not start from zero and end at 2^ 32 minus 1.
We start at a random number.
We start at a random number. Let's say
we started at 1 1 1. Who is stopping? We
can start with 1 2 3. You can choose any random number and you can start numbering from there. Okay. Till now is it clear? So what I'm saying TC will
it clear? So what I'm saying TC will assign a unique number to each datab.
Unique number to each datab.
And the unique number is of 32 bit. So how
many total numbers can be possible? 0 to
2^ 32us 1. And you do not start numbering from zero. You start with some random number. Okay.
random number. Okay.
So why do we do so? Why do we number each and every bite? To help maintain order and ensure reliable delivery in each TCP connection. You know TCP is
very strict on reliability. So we are uh you can say we are focusing on each and every datab so that none of the datab can be lost.
That's why we are numbering each and every datab. Okay. For this we have a
every datab. Okay. For this we have a sequence number field in the TCP.
Okay, we have discussed the source port address, destination port address. We
are discussing this sequence number. So
for bite numbering we have the sequence number field in the TCP. It is a 32-bit field that specify the number assigned
to the first bite in a segment.
Okay. So the range will be from 0 to 2^ 3 to minus 1 by starting from random number. So during the connection setup
number. So during the connection setup this all happens during the connection setup.
Okay. Each side each side which is sender and receiver each side randomly generate uh number to prevent duplicate data.
Duplicate data and it's also important for the security part that we start with a random number. So receiver also start with some random number and sender also
start with some random number. Okay. to
number their bytes.
And the next segment is calculated as the sum of the current segment plus the number of bite in the segment. For
example, 1 2 3 4 1 2 3 4 5. Let's say five bytes are there in the first segment. So first
segment we started numbering with 1 0 1 0. The next will be 101 1
0. The next will be 101 1 2 1 10 1 10 1 10 1 10 1 10 1 10 1 10 1 10 1 10 1 10 1 3 and then 10 1 4. Now
the next segment 1015. So we will see like this the segment one the this is segment one
this is segment two. So segment one has the numbering of 10 1 0 while segment two has a numbering of 1015. Is it
clear? So each datab is numbered.
Okay.
What happened in the IP case? In IP
case, we count the packet. This this was packet one.
This was packet two. Okay. This was the case in the IP layer. But here we are counting each and every datab. That's
why we are naming it like this. Okay.
The sequence number of next segment is calculated as the sum of the current segment 1 0 1 0 and the number of bytes in that
segment. How many bytes? Five bytes. So
segment. How many bytes? Five bytes. So
1015. This is the number. Is it clear?
Is the sequence number part clear? In
IP? Let me write. In IP
every packet is counted while in transport layer every bite is counted.
What can you guess about the DLL here?
Every bit is counted.
Okay, is it clear? Now we are moving to onto the next concept of wraparound time.
Wrap around time. So although the TCP numbers ranges from 0 to 2^ 32 minus 1 but still this is not an unlimited range.
Okay.
What is 2^ 32? It's 4 GB.
It's 4 GB. So TCB allow sequence number to wrap around and start from zero once the maximum number is reached.
Are you getting the point? Let's say if you're starting from zero, you are starting from zero and then 1 2 3 4 each bite is getting numbered. Okay? And then
you end with 2^ 32 minus 1. This is the last bite you can number. Now what will happen? we can go again
happen? we can go again start with the zero.
Okay. So that continuous data transmission happens.
Is it clear? TCB allows sequence number to wrap around and start from zero once the maximum number is reached enabling continuous data transmission. Okay. We
call it as wraparound time. The time
taken during this whole thing. So the
time taken to exhaust all 2^ 32 sequence number these are 2^ 32 sequence number. So the
time taken to exhaust all these 2^ 32 sequence number and wrap around to zero is called wraparound time. Is it clear?
So is it a fixed thing or it depends.
Is it a fixed thing? The wraparound time is fixed or it depends.
Obviously it depends man. Depends on
what?
It depends on the bandwidth. It depends on the bandwidth.
bandwidth. It depends on the bandwidth.
Now can you guess it is directly dependent or inversely dependent?
Yes. Yes. It's inversely proportional to. So you can write wraparound time is
to. So you can write wraparound time is inversely proportional to the bandwidth.
You can write the formula wraparound time is equals to the total 2^ 32 divided by
let's say the bandwidth is x bytes per second. So divided by x
second. So divided by x is it clear? So this is what wraparound time is. Wraparound time is equals to 2^
time is. Wraparound time is equals to 2^ 32 divided by bandwidth in bytes per second. Is it clear?
second. Is it clear?
Okay. Now the concept of lifetime of a TCP segment comes in.
Lifetime of TCP segment.
So it is fixed. The lifetime is generally fixed. It do not depend upon
generally fixed. It do not depend upon the bandwidth.
180 seconds or 3 minute is generally considered lifetime of a TCP segment.
This is the maximum time a TCP segment is expected to take to reach the destination. It do not depend upon the
destination. It do not depend upon the propagation delay. Do not depend upon
propagation delay. Do not depend upon the bandwidth nothing. This is fixed.
This is the maximum limit that is set that this will be the time at max taken by a TCP segment to reach the receiver.
Okay.
Now what will be the consideration for the wraparound? Why I'm discussing this
the wraparound? Why I'm discussing this lifetime here? So we will discuss two
lifetime here? So we will discuss two scenarios. The first one and the second
scenarios. The first one and the second one. The first one is
one. The first one is when there will be no problem and when there will be a problem.
If you think you can guess where I'm heading.
If wraparound time is generally greater than lifetime of a TCP then there is no issue with reusing of sequence numbers because uh
till till this will wrap around and and will reach back to zero the packet will be already dead. the
packet will be already dead because wraparound time is greater than the lifetime of the packet. So there is there will be no issue for reusing the
sequence number the duplication problem nothing. If wraparound time is greater
nothing. If wraparound time is greater than the lifetime itself then there will be no problem.
What if lifetime is greater than wraparound time? Which means the packet is still
time? Which means the packet is still alive while we are reusing again. If
wraparound time is lesser than the lifetime, then the risk of receiver encountering a duplicate packet is still there and so it will lead to
confusion.
Are you getting the point? So this was the concept of sequence number. Let's
move to the next acknowledgement number.
Okay.
Acknowledgement number.
So if the receiver has received let's say byte X successfully received by X from the sender then it defines X + one
as the acknowledgement number. And you
know acknowledgement and data can be piggybacked together. So when receiver
piggybacked together. So when receiver will send the data, it will also send that I am expecting the next bite as I have already received the by text.
Is it clear?
And acknowledgement number is cumulative which means the party or the receiver takes the number of the last bite that it has received safe and sum adds one to
it and announce this sum as the acknowledgement number. Is it clear? So
acknowledgement number. Is it clear? So
you have to remember one line that piggybacking is possible. Piggybacking
is possible. What do you mean by piggybacking? That data and
piggybacking? That data and acknowledgement can be sent together.
Okay.
So this was the concept of acknowledgement number. In the next
acknowledgement number. In the next lecture we'll begin this row header length reserve these flags and then window size check some urgent pointer.
we'll discuss in the next lecture.
In the last lecture, we have studied till acknowledgement number. In this
lecture, we'll begin with header length.
Now, this header length is exactly similar to what we have studied in IPv4.
Okay. So, here also this is 4 bit. So,
the range can be from 0 to 15. But you
know the mandatory header should be of 20 byt and the maximum could be of 60 byt. So you can scale but uh this will
byt. So you can scale but uh this will be into four. This will be 5 into 4. So
the range will be from 0 to not from 0 to 15 but from 5 to 15 and the scaling factor will be four.
Okay.
Okay. So this was header length. Now
checksum in the IP header we have studied header checksum which means this was the truck IP header was giving security for this
part only the header part but this checks sum is giving security for the full because this time it's not header check sum it's checksum which include data
plus the header And you know there is one special thing also. The special thing is IP studio
also. The special thing is IP studio header.
So it not only provide the security for or the error control mechanism for data and header part but is but it also include the IP pseudo header. What is IP pseudo header? It's like a simpler or
pseudo header? It's like a simpler or the minimalistic version of uh IP header. IP pseudo header include the
header. IP pseudo header include the source IP, the destination IP, the reserved protocol and the length.
Okay, here this is TCP header and the data part is the TCP data.
Is it clear? So this is what checksum here is in IP. The checksum was just for the header part. But here the checksum is for data header and
pseudo IP header also.
Is it clear?
Okay. The next was of window size.
Window size or we call we also call it as advertisement window.
Well this is a very important concept for the flow control mechanism. This was
for the error control and in transport layer and this is important for flow control in transport layer. Okay. So the basic idea of this
layer. Okay. So the basic idea of this is the sender should not send what receiver cannot receive.
So this field defines the size of window in bytes that receiver have reserved for the incoming data from the sender. Is
that clear? Let me repeat. For flow
control mechanism, what is the basic idea that sender should not send what receiver cannot receive. So here the window size or the advertisement window is the field that defines the size of
window in bytes that receiver has reserved for the incoming data from the sender.
Okay.
And this is of 16 bits which means the maximum window size can be 6 55 35 bytes.
Okay. So this value is normally referred as the receiving window which is determined by the receiving party. Okay.
And whatever be this window size or whatever be the window that receiver advertise the sender must obey the dictation of the receiver in this case.
Okay. And you know this window size is not some static value. It dynamically
change based on what sender send to the receiver.
Okay. So it is like uh receiver saying dynamically to the sender that in the current time I have this much space to
uh accept your data and to process it.
Do not send do not send the data greater than this space. Okay. So this is what advertisement window is. I hope the point is clear.
Okay.
Okay. So what will happen in the case when receiver will say I do not have any uh advertisement window or my advertisement window is zero by.
So sender ask the receiver what is your advertisement window or receiver advertise that this is my advertisement window and in that case it advertise
zero byte as the window size. So what
will happen? Will sender uh lose hope and will stop? No, this doesn't happen.
Persistent timer comes in persistent timers. So sender is not
persistent timers. So sender is not going to lose hope. It will going to ask again after some time. So to deal with zero window size deadlock situation, TCP
uses what? Persistent timer. Is it okay?
uses what? Persistent timer. Is it okay?
So when the sending TCP receives an enclosment with a window size of what?
Zero byte, it start a persistent timer.
So when the persistent timer goes off, when it goes off, it's going to ask again. Sender uh and how does it ask? By
again. Sender uh and how does it ask? By
sending a special segment called probe.
What do we call it as probe? So this
segment contain only one bite of new data. It has a sequence number. But this
data. It has a sequence number. But this
sequence number is never acknowledged.
So the prob causing the receiving TCB to resend the acknowledgement which was lost.
So what will happen as soon as receiver will advertise that it has zero bite sender will ask again as the persistent timer goes off by
sending a probe and how will receiver going to reply? Receiver is going to reply its advertisement window.
Okay, is it clear? Now let's move towards the flags. First one is urgent pointer.
flags. First one is urgent pointer.
Urgent pointer first of all there is difference between urgent pointer and urgent flag. Urgent
flag is a value. Urgent flag is like zero or one. This urgent pointer value is only valid when the urgent flag is
set. If it is not set then
set. If it is not set then this will this won't be considered. So
the urgent flag need to be set.
And in that case only urgent pointer is considered active or valid. So what does urgent pointer indicates? It indicates
the position position of the last bite last bite of argent data by sending this value to the sequence number. So what
will happen? Let's say if I uh give you some data and I will say five byte is my pointer value. So I will consider that
pointer value. So I will consider that the first initial five bytes are the urgent bytes and these byes need to be taken special care of. So this help
identify which part of the data is urgent and need immediate attention.
Okay.
And you know urgent flag is a part of control flags. TCP has six control
control flags. TCP has six control flags. Six control flags. So the first
flags. Six control flags. So the first was argent flag we have discussed. The
second one is push flag. So what does push say? For example, uh when you are
push say? For example, uh when you are chatting with someone and you type hi.
Now when the push flag is not set, the TCP will wait until it has a substantial amount of data to send. For example, it
suppose you have one bite to send.
Suppose you have one bite to send. Now
TCP can go with two approaches. Either
it can attach all the overhead and send just one bite or it can wait for some time to receive more data from the upper layer protocols or upper layers. So that
when it has a substantial amount of data greater than uh a few or greater than a threshold
now TCP find it worthy to attach all the overhead and send this hole over the network.
Okay, are you getting the point? When
push flag is set, even if one bite has to be sent, it will send one bite immediately. So when push flag is not
immediately. So when push flag is not set, it will wait for a substantial amount of data to come from the upper layers and after that it will send
for the chatting applications. So when
you have to send let's say hi, you want that high should be immediately be sent.
The layer should not wait for some more messages to take high with it.
Okay. So this is the use of push flag.
Okay. Let me read. Uh push flag is used when immediate data delivery is required. What is required? Immediate
required. What is required? Immediate
data delivery. As I have said uh regarding the chat application, immediate data delivery is required.
Okay. So by default TCP wait to accumulate enough data to fill a segment before sending it to minimize the network traffic. Why so? Because of this
network traffic. Why so? Because of this overhead.
Look at this one bite of data and so much of overhead. One bite of data and so much of overhead. Are these packet looking good? No. They will cause
looking good? No. They will cause traffic in the network.
Okay. So generally what TCP will do? it
will wait for some amount of data enough to fill a segment before sending to minimize the network traffic. Okay. So
for interactive application like chat push flag need to be set as one. Okay.
Third reset flag.
Reset flag.
It is used to abort a TCP connection.
about a TCP connection in the case when something goes wrong or when the uh when the connection is deemed invalid. So in that case let's
deemed invalid. So in that case let's say uh when something is wrong or the connection itself is deemed invalid. In
that case you have to abort the whole connection. So for that reset flag is
connection. So for that reset flag is used. So it can be sent by the receiver
used. So it can be sent by the receiver when the packet arrives unexpectedly or when there is some error detected in the DCB connection. Okay. So this is to a
DCB connection. Okay. So this is to a bault. It is sent by a receiver when the
bault. It is sent by a receiver when the packet arrives with some anomaly. Okay.
Is it clear? So let me summarize. First
one was the urgent pointer or urgent flag. Urgent pointer is the value. For example, five byte. This is
value. For example, five byte. This is
the value. So from the the first initial five bytes will be the urgent byes that require immediate attention. And this
five byte is insignificant or invalid if urgent flag is not set to one. Okay. So
urgent flag the value of the this sets value of urgent pointer pointer valid.
What about acknowledgement? This value
or this sets value of acknowledgement field as valid. Okay.
What about push? It pushed the data.
What about reset? reset
it. Abort the connection or reset the connection.
Reset the connection.
Now we have the two remaining flags that is sin flag and fin flag. Now what is this? So to understand this we need to
this? So to understand this we need to understand the three-way handshake.
Okay. But for the sake of the notes I'll write for sin. This is used to synchronize sequence number. Synchronize
sequence number during connection.
Okay. And for fin this is used to terminate the connection. Terminate the
connection.
Okay.
These initial two flags are to validate. If these are not uh set then the value at the urgent pointer or the value at the acknowledgement field
will be considered as garbage value. So
they must be set.
Now let's understand the three-way handshake of the TCP. Okay. So we have a client process
and then we have a client transport layer. Okay. And then we have a server
layer. Okay. And then we have a server transport layer and the server process.
Okay. So client process since the this we represent as a active open active open
and this has connection closed connection closed okay here as this is a server process so server is like passive
open we'll understand what is the meaning of this active open and passive open and then connection
opened.
So passive open means server is sitting idle passively and client which is active will send a request to the server for establishing a connection and server
will uh acknowledge the process or acknowledge the request and will establish the connection. Okay, that's
why server is passive and client is active. Now how does that happen? We
active. Now how does that happen? We
call this process as three-way handshake.
Three-way handshake. Okay, it goes like this. Sin,
this. Sin, sin plus acknowledgement and then acknowledgement.
So what do we do? We send a packet. We
send a packet with sequence number. As
you know, we start with random 8,000 and we set the send flag as one. So what we do we want to synchronize we want to establish a connection that's why the
client transport layer of the client process is requesting the server transport layer of the server process that we want to open a connection we
want to establish a connection. So
this will be this packet will be sent to the server transport layer. Now server
will again do what? Server will choose is its own sequence number from the random. So let's say 15,000 is chosen
random. So let's say 15,000 is chosen and then acknowledgement as you know acknowledgement is of the next expected bite. So 8,1
and you know it is acknowledgement and it is synchronization also as you know uh syn sequence number. So
this the first packet is sin. So sin
flag must be sent as one set as one. So
we have set the sin flag as one. Now the
second is sin and acknowledgement from the receiver side. So we have to set the sin flag as one and acknowledgement flag as one also.
Is it clear? And then
what happened till now? The client has requested the server to establish a connection. Server has acknowledged it.
connection. Server has acknowledged it.
And now what will client do? Client will
acknowledge the server's message that yes I have received your message. So
what will client send back now sequence number will be 8,01 as requested by the as requested by the
server or the receiver and in the end acknowledgement number is one. So acknowledgement flag will be set
one. So acknowledgement flag will be set as one and acknowledgement number will be it
has received 15,000 so it will ask for 15,0001.
Is it clear?
And you know with it sender will also advertise its window. So let's say 5,000 is the window. Here sender will also advertise its window. Here 10,000 is the
window. Receiving window. Okay. So let's
window. Receiving window. Okay. So let's
say if I am sending message to you, so I will advertise my window to you. Okay.
Sender advertises the window. Okay.
So let's say if I am sending a message to you, I will also advertise that I have a receiving window size of 10,000 or 5,000. Is it clear? Let me repeat
or 5,000. Is it clear? Let me repeat again. So what what do we do? This is
again. So what what do we do? This is
client. This is server. Client sends
sin. It set the sin flag as one. Selects
a random sequence number. Let's say
8,000. Now server has received the sin request that there is some client who want to establish a connection. Server
will acknowledge that and server also want to establish a connection. Why so?
Because you know in the first lecture we have studied that this is two lane thing.
Because between sender and receiver between sender and receiver when sender is sending to the receiver this is sender this is receiver and when
receiver replies to the sender then this becomes sender and this becomes receiver. So connection should be
receiver. So connection should be established both way that's why here client is establishing the connection.
Server acknowledges it. Yes. And then
server also asks to establish a connection. That's why sin is sent and
connection. That's why sin is sent and then client acknowledges it. Now two-way
connection has been sent. Two lane
connection has been sent. And what is the process? Three-way handshake. The
the process? Three-way handshake. The
first handshake, the second handshake and the third handshake. Is this clear?
So what happens? Initially client send is sends sin packet to the server.
server replies with sin plus acknowledgement of the packet which client has sent and then in the third handshake or in the third way uh what
will client do? Client will acknowledge the sin packet received by the server. I
hope the point is clear. So this was the case of connection establishment. What
about connection termination? The same
thing will happen but this time now instead of sin consider sin as a request to establish a connection and fin as a request to terminate the connection. So
what will client do? Client will send a spin packet asking the server that I want to terminate the connection. Server
will say okay if you want to do so I also want to terminate the connection because there is no point of keeping just a one side connection. So server
will send a fin plus acknowledgement packet and client will also acknowledge the server's fin packet. So this was client,
this was server. Server initially
acknowledges the packet fin which was sent by the client and then the client acknowledges the packet fin which was sent by the server.
Is this clear? So sin is used for request to establish a connection and fin is used for request to terminate a connection. This is used for
connection. This is used for establishment and is used for termination.
Is this clear?
Is this clear? So in this case FIN flag need to be sent need to be set as one.
In this case FIN and ACK acknowledgement flag need to be set as one. In this
case, acknowledgement flag need to be set as well. Is this clear? So, you can also create with sequence number. For
example, sequence number is X, acknowledgement number, sequence number as X, acknowledgement number as Y, acknowledgement
set and FIN is also set. Now, why
acknowledgement is set? Because this is we are talking about the connection termination. it must have received some
termination. it must have received some packet from the uh previous case or in previous time scenario let's say the time is starting here at t equals to0
before that time it must have received some packet from the server so that's why acknowledging the packet that I have received the packet which you have sent and now I want to terminate the
connection that's why finish set to one okay now what will happen server will acknowledge that okay you want to terminate you want to terminate the connection that's fine
Now server will send as this will be Y.
Why? So
client is asking for the packet Y. What
is acknowledgement? Acknowledgement
means I have received the previous packet. Now I want a packet with
packet. Now I want a packet with sequence number Y. This is what acknowledgement was. Now client is
acknowledgement was. Now client is sending acknowledgement as Y which means client is expecting Y. Okay. So sequence
is Y. Now acknowledgement number will be this bracket was X. Now server is expecting x + one and acknowledgement
flag will be set as one. Finn is also set as one. Now client will send what sequence number. Server is expecting x +
sequence number. Server is expecting x + 1. So client will send a packet with
1. So client will send a packet with sequence number x + 1. And what client is expecting? It has just received
is expecting? It has just received sequence number y. So it is expecting y + 1. What about uh fin?
+ 1. What about uh fin?
No, there's no need to set up FIN now.
Just acknowledgement.
Okay, is it clear? So for connection establishment, you have to follow SIN SIN plus ACK and then ACK. For
connection termination, similarly you have to follow fink and then ACK. Few things that you have
to be very uh careful for that initially when you select a sequence number for the sin you have to select randomly that's why here when we started we
selected a random sequence number of 8,000 and then receiver will also select a random sequence number of 15,000.
It's okay.
We will start randomly. Now you have to make sure that what does acknowledgement mean? Acknowledgement means next
mean? Acknowledgement means next expected frame. I have already received
expected frame. I have already received your previous frame. Now I am expecting the next expected frame. That's it.
These two concept you have to uh remember.
Okay.
So now how many sections of TCP header we have discussed. We have discussed header
discussed. We have discussed header length reserved bit. These bits these six bits are reserved. We have discussed these flags. We have discussed window
these flags. We have discussed window size. We have discussed check sum. We
size. We have discussed check sum. We
have discussed urgent pointer. Now what
about options?
Let's discuss them too. What is option?
Here it is again 40 by optional information in the TCP header. Optional
info in TCP header.
Here we have timestamp.
Here we have window size extension.
Windows size extension and padding.
Okay. So this is not that much important. In the next lecture uh or in
important. In the next lecture uh or in this lecture also we can study this sin flooding attack.
What is this?
You know what is sin? Sin is
synchronization. Sin is requesting for establishing a connection.
Is it clear? What does sin means?
Requesting for establishing connection.
So a client sends a send packet to a sender or to the server. Now what will server do? Server will acknowledge this
server do? Server will acknowledge this and will send a send packet to the client.
Okay. So this is how a normal three-way handshake looks like.
Okay. Now but the problem is client is not interested in making connection.
Client is not interested in making connection. See this happens.
connection. See this happens.
This is client. This is server. Client
asked the server to establish a connection. And what server will do?
connection. And what server will do?
Server will request the client. Okay,
I'm interested in making the connection.
Let's make the connection. So, server
will send a sync packet to establish a connection and acknowledging that yes, I'm interested in making the previous connection. So, this connection will be
connection. So, this connection will be made. But for this connection, server is
made. But for this connection, server is waiting for the acknowledgement from the client side. So, so that a proper
client side. So, so that a proper connection will be made. But this
doesn't happen.
So in a sin flooding attack a malicious attackers send numerous numerous I mean lots of sin segments to the server using
a fake source IP address. Okay. So each
segment appears to come from a different client.
Now what will happen? So the server allocate the resources such as some blocks and setting up the timers that yes in some time that client this
client will send me the acknowledgement.
Server will keep on waiting for that. It
will set up the timers in response from the acknowledgement from the client side. But this is not going to happen.
side. But this is not going to happen.
Client is not interested in making the connection.
Okay. So when no response when when there is no response of this sin plus ACK to the fake clients and these clients do not exist. These client do not exist.
not exist. These client do not exist.
These are fake clients to uh disturb the server or to uh somehow deceive the server to allocate
its resources on some fake clients. As a
result these responses are lost. These
responses are lost and the server never received the final acknowledgement to complete the handshake.
Now what are what is the purpose of this genreing attack? The purpose is resource
genreing attack? The purpose is resource exhaustion.
The server waits for the server is waiting for this ACK but in meantime consumes resources without establishing an actual connection.
So if many segments are sent if many sins are sent from let's say in this case it was just a single client what if what if there are multiple clients
they are sending sin packets now server will send susckk here also simpl but no response of this s plusk.
So what will happen eventually server will run out of resources and will this will lead to denial of service for the legitimate clients. Let's say these
legitimate clients. Let's say these clients are fake but this one is legitimate but as these clients have exhausted the resources of the server so
server will deny the actual service to a legitimate client.
Is this clear?
In the next lecture, we'll begin with congestion control. Congestion control.
congestion control. Congestion control.
Now, we had sender, we have a receiver and we have transmission medium. Sender will keep on
transmission medium. Sender will keep on sending at its own speed. Receiver will
discard if it is not able to manage. So,
sender and receiver are both kind of chill. Now who is getting tensed? Who is
chill. Now who is getting tensed? Who is
getting stretched? The network medium.
And if network medium collapses, the entire system is gone.
Okay. So, congestion refers to a network state where message traffic becomes so heavy that it slows down the network response time.
Okay. So congestion control these uh this congestion control will include techniques or mechanism that can either
prevent congestion before before it happens or remove congestion after it has happened. Are you getting the point?
has happened. Are you getting the point?
So you can either uh prevent or react after it has happened.
or remove prevent before it happens or remove after it has happened.
Okay. Now, how is TCP going to manage the congestion control? Who is first of all responsible for this congestion?
Sender. Because sender is sending so much of data that receiver cannot process. Receiver cannot match with the
process. Receiver cannot match with the sender speed. Receiver is getting
sender speed. Receiver is getting overwhelmed. Receiver is dropping the
overwhelmed. Receiver is dropping the packets.
Okay. And
the network medium is getting tensed. So
sender is kind of responsible for the congestion. So how TCP going to prevent
congestion. So how TCP going to prevent TCP react to congestion by reducing the reducing the sender window size. Okay.
TCP uses a combination of GBN and SR protocols to provide reliability.
Okay. Now
let's understand the concept of congestion control. What happens
congestion control. What happens actually? So we have a sender window.
actually? So we have a sender window.
The size of sender window is determined by the two factors. Sender window size.
This is determined by two factor. The
first one is the receiver window size and the second one is congestion window size.
Okay. What is receiver window? Sender
should not send data greater than what receiver can process. Which means sender should not send data greater than receiver window size. Otherwise it will
lead to dropping the TCB segment and that will lead to retransmission.
So when receiver going to drop the packets and sender will wait for the acknowledgement and acknowledgement will not come. So sender will retransmit.
not come. So sender will retransmit.
Why this h this problem has happened?
Because the sender window size was greater than the receiver window size. Okay. So
sender window size sender window size should always be less than or equal to the receiver window size.
Okay. So receiver dictates it window side to sender through TCP header. We
have already seen this. We have already seen the advertisement window concept.
Okay. So this is necessary. Otherwise
what will happen? If the sender window size is greater than the receiver window size, sender will send more packets what than what receiver can manage.
So receiver will discard the packet or drop the packet and when acknowledgement will not come then sender will retransmit causing pressure on the network medium or causing the
congestion. Okay. Now we have understood
congestion. Okay. Now we have understood the concept of receiver window. What
about congestion window? So sender
should not send data greater than the congestion window size otherwise it lead to the dropping of TCP segment which cause again the TCP retransmission.
Are you getting the point?
Suppose the capacity of network medium is five packets and sender is sending what? 10 packets. So five packets will
what? 10 packets. So five packets will be dropped. Now what will happen? Sender
be dropped. Now what will happen? Sender
will receive uh no acknowledgement from the receiver as receiver has not received them. So what will happen?
received them. So what will happen?
Again retransmission again more congestion. So
congestion. So the center window size should also be less than the congestion window or yeah
congestion window size. So to uh merge them I can write the sender window size should be minimum of what receiver window versus congestion window is.
Whichever is minimum that should be sender window size. For example receiver window is 10 congestion window is seven.
So the center window size should be should be lesser than seven. Is this clear?
Otherwise if I have chosen just one of the thing for example if it is just less than the receiver.
For example if I take eight then what will happen? Retransmission will happen
will happen? Retransmission will happen due to the congestion due to the congestion in network medium.
And if I have chosen greater than receiver window then retransmission will happen due to the dropping of packets uh at the receiver side causing retransmission.
So this is necessary that the sender window size should be minimum should be less than equal to the minimum of receiver window and the congestion
window. Is this clear?
window. Is this clear?
Okay. Now this receiver window size and congestion window size they are both dynamic they are not fixed they are not static they change with time.
Okay so we will study the TCP congestion policy.
TCP congestion policy.
Okay. So in this policy we have three phases. The first phase is slow start
phases. The first phase is slow start phase, exponential increase.
The second is congestion avoidance phase, avoidance phase, additive increase. Additive increase and
additive increase. Additive increase and the congestion detection phase.
Congestion detection phase.
Now what happens in slow start phase? We start the sender window size. We are trying to determine
window size. We are trying to determine the sender window size. So we going to start with 1 MSS. What is MSS? The
maximum segment size. Maximum segment
size. So we're going to start with 1 MSS.
Is this clear?
So here we are saying that this is slow start phase and here we are saying that this is exponential increase phase. So
are not they opposite?
Aren't they opposite?
No, we are saying it slow start because we are starting with just one mss. The
sender window size we are starting with just one mss. And why we are saying exponential increase? because we are
exponential increase? because we are doubling it 2 ms and then 4 mss and then 8 mss.
Is this clear? So let me write very formally. So what is slow start phase?
formally. So what is slow start phase?
Slow start phase or the exponential increase phase. Initially we said the
increase phase. Initially we said the congestion window size as 1 mss.
Okay. Now after receiving each acknowledgement the size of congestion window increases exponentially. So after one roundtrip
exponentially. So after one roundtrip time we double it it becomes 2 ms. Then after one round trip time it becomes 4 mss and
then one round trip time it becomes 8 ms. Okay. Now what will be the threshold and
Okay. Now what will be the threshold and we have to wait at some threshold. So
what will be the threshold here? I will
write what is threshold.
We'll start with one. We'll keep on doubling it until we reach the threshold. Now what is the threshold?
threshold. Now what is the threshold?
Maximum number of TCP segment that receiver window can accommodate. It is
maximum or the maximum TCP segment that receiver window can accommodate. receiver
accommodate. receiver window can accommodate divided by two.
Okay. So this is what this is what threshold is. You can also write like this receiver window size divided by maximum segment size divide by two. Okay.
by two. Okay.
But this is the uh threshold. What
threshold is maximum number of TCB segment that receiver window can accommodate divided by two. Okay. So if
I show you the graph, we begin with exponential increase and then as soon as we reach the threshold,
we move to the second policy or the second phase which is congestion avoidance phase. In congestion avoidance
avoidance phase. In congestion avoidance instead of exponential increase we move toward the additive increase. So we will increase linearly linearly linearly and
then when we will reach the maximum receiver capacity let's say if the capacity is uh 100 then the threshold will be 50. Okay. So when
we will reach the maximum receiver capacity this was half of it which was threshold then we will just keep it fixed. Okay.
So this is what congestion congestion detection phase. I should write in some
detection phase. I should write in some other. Okay. So this is congestion
other. Okay. So this is congestion detection. This was congestion
detection. This was congestion avoidance phase and this was the slow start phase. Is
this clear? In slow start phase we start with one. That's why we call it as slow
with one. That's why we call it as slow start. Otherwise we will move
start. Otherwise we will move exponentially.
1 MSS 2 MSS every roundtrip time 4 MSS 8 MSS 16 until we reach the threshold after threshold let's say the maximum is 32 so what is the threshold 16 so as
soon as we reach 16 we have reached the threshold and then we will move like this 17 18 19 till we reach 32 and as soon as we reach 32 we
have to be very uh constant Okay, is this clear? So this was what the congestion policy is. Now let's
learn more about timers.
Okay, so we have different timers in TCP. The first is time wait timer.
TCP. The first is time wait timer.
Okay, so time timer it prevent the issues with late packets after the connection is closed. Okay, we call it as 2 into lifetime. The value of time
weight timer is 2 into lifetime. Second
one is uh keep alive timer. Keep alive
timer.
This is used for detecting and closing the idle connections. The ones which are not actually being useful the idle connections. So for keep alive timer is
connections. So for keep alive timer is used for detecting and closing the idle connections. Okay. So what do we do in
connections. Okay. So what do we do in this?
The server actually the server periodically checks if the connection is still active or not. Is it active or not? Is it active or not? If there's no
not? Is it active or not? If there's no response within this timer, let's say the timer is set to 10 minutes and server will keep on checking is the
connection is still active and there is no response within this 10 minutes. Then
what will happen? 10 probe messages 10 probe messages will be sent during the interval of or at the interval of 75 second. So at every 75
seconds trend 10 probe messages will be sent okay up to up to so it is not uh necessary or
it's not fixed for the 10 probes state 10 probe the maximum 10 probes will be sent so as the keep alive timer will go off
during this keep alive timer the sender the server will keep on checking is the connection still active After this keep alive timer, the server
will send 10 probes to check before closing the connection. Are you active?
Are you active? It will ask 10 times. If
no reply is received, the connection is closed. Okay. Persistent timer. We have
closed. Okay. Persistent timer. We have
already discussed it. Persistent timer.
This was used in the case of zero window size advertisement. So if sender ask for
size advertisement. So if sender ask for the uh window size of the receiver and receiver reply with as zero that receiver is not currently able to
receive any data packet from the sender then what will happen? Sender will send just one bite of data. We call it as
probe to ask if uh the receiver is now able to uh handle or ask the receiver about its current window size. Okay. For
example, sender asked the receiver.
Receiver replied that it is zero. So now
sender is not going to lose hope. What
will sender do? It will wait for the persistent timer and then will occasionally checks if the window size of the receiver has changed by sending
the probe. Okay.
the probe. Okay.
Acknowledgement timer.
Okay. This is used to send cumulative acknowledgements with the help of piggybacking. We have discussed what
piggybacking. We have discussed what piggybacking was sending data with acknowledgement. So this acknowledgement
acknowledgement. So this acknowledgement timer is used to uh send cumulative acknowledgement efficiently. What do we
acknowledgement efficiently. What do we do in this? So when the segment arrives when the segment or data packet arrives the station start acknowledgement timer.
Okay. If all the segment received within this timer are acknowledgement we call let let me give you an example.
send a receiver. A packet is received.
Now it will start a acknowledgement timer.
Let's say 10 packets are received in this acknowledgement timer. So of all these 10 packets, it will send a cumulative acknowledgement back.
Okay. So as soon as the first packet is arrived it will start the acknowledgement timer and within that those timer I will bundle those packet up and will
send a one single cumulative acknowledgement of all those packets which have come within the acknowledgement timer.
Is this okay?
Is it clear?
Okay. So this was all about TCP. Now
let's move toward UDP. Okay. So UDP is connection connection less.
And what do I mean by connectionless?
That the frames which are sent are independent from each other.
Okay. And receiver can receive those frames out of order. Okay. So this
connectionless unreliable transport protocol. So unlike TCP, UDP
transport protocol. So unlike TCP, UDP does not guarantee reliability. But then
why this UDP is used? because it is simple for its simplicity for its low overhead.
Okay. So it provides process to process communication using IP address and port numbers. We call it as socket address.
numbers. We call it as socket address.
We have already seen socket address is used. And
used. And you know how is the UDP user datagramgram will look like. This is UDP datagram.
In TCP we call it as segment. In UDP we call it as datagramgram. We have header of eight bytes.
We have eight byt of header.
Okay. And the remaining will be the data.
Okay. Now how is the header? How does
the header look like? So in header we have just two rows four byt four byt each.
We have source port number. We have
destination port number. And we have total length. Total length and checksum.
total length. Total length and checksum.
That's it. UDP is so simple. And you
know even the checksum here is UDP is optional.
This is optional.
So here in UDP you have eight by header four byte and four by two rows. In the
first row we have source port, destination port. In the second row we
destination port. In the second row we have total length and checks sum and even that checks sum is header check sum is optional. Okay. So you can directly
is optional. Okay. So you can directly tell from this what are the features of UDP. First of all it is lightweight.
UDP. First of all it is lightweight.
What do I mean by lightweight?
I mean low overhead.
Overhead fast faster than TCP. Okay. And
it is used for quick communication.
quick communication. Okay. So you know when we will use the UDP it is ideal for applications that do not require the heavy interaction between sender and
receiver. Okay. So low overhead it's
receiver. Okay. So low overhead it's fast quick for communication.
Okay. And you know it's connectionless.
So there is no numbering on the frames and receiver can receive them out of order.
So these were like the pros of UDP. What
are the cons?
Because as it is so lightweight, it's so it has so lesser overhead. It doesn't
have the features which TCP had. It
doesn't have uh flow control, inbuilt flow control, error control or congestion control mechanisms. It relies on a simple check sum for basic error checking and even that is
optional. So the whole focus of UDP is
optional. So the whole focus of UDP is it's suitable for scenarios with uh short and just a request response request response request response
communication. Are you getting the
communication. Are you getting the point? It's commonly used in
point? It's commonly used in applications when the process include its own error flow control. So the
process do not rely on the UDP. Okay.
And it's preferred for realtime interactions realtime applications due to its tolerance for uh
fall tolerance minor if if it has minor data loss delays then UDP will manage it's utilized for multiccasting and all
okay so this was all about UDP I think I should make a table for you so that you can understand better TCP and UDP So
keep this interactive. You also suggest me what are the differences and I'll keep on adding it. So first of all we'll start with very basic thing. We'll start
with the header. So TCP header has a dynamic header. Why dynamic? Because it
dynamic header. Why dynamic? Because it
has options. It can range from 20 to 60 byt. It can change. While UDP has just a
byt. It can change. While UDP has just a fixed header of 8 byt. Very simple
header consisting of just two rows.
Okay.
suggest me we have completed the TCP and UDP module now whatever differences you remember
type here and I will add that yes one point we came end to end flow end to end flow control we have here in
TCP and there in UDP there is no flow control another point think yes error control. It has error control.
There is no error control. Even check
sum is optional. No error control. Okay.
What is the most basic difference between them or what is the flagship difference between them?
Correct. This is connection oriented and this is connectionless.
Think more. What is the property? What
is the property of TCP that significantly uh difference between them or significantly uh make them different?
What is the use case?
Think for like that. Yes, reliability.
This was the word I was searching for.
Reliable and nonreliable.
This has sequence number. You can derive more differences from the header only.
This has sequence number. No sequence
number. It has acknowledgement number.
It has no acknowledgement number. Its
overhead is high. Overhead is high.
This has low overhead.
It keep track of order.
In order here it is out of order.
Okay, we have protocols like HTTP, uh HTTP FTP,
SMTP, POP. These are all based on
SMTP, POP. These are all based on transport layer. And here in UDP we have
transport layer. And here in UDP we have DNS, we have SNMP, we have TFTP,
NFS, RIP, BWTP, DHCP. There are so many.
So all realtime and multimedia protocols are included in this UDP part. Is this
clear?
Is this clear? So in the next lecture we will take all your doubts from the DPP.
The next class will be a doubt class and from the next to next class we'll begin our new module media access control.
We'll begin our lecture with this. We
had data link layer. Data link layer is divided into two part. The LLC and MAC layer.
This LLC is responsible for error control and flow control while the MAC layer is responsible for the access control.
Okay. So we have multiple access protocols. We are going to study this in
protocols. We are going to study this in this module.
So we'll begin with random access protocols. We'll then move to control
protocols. We'll then move to control access protocols and then centralized access protocols. Random include Aloa.
access protocols. Random include Aloa.
Then we will study CSMA and then CSMA CD and CSMA CA.
In controlled access, we'll begin with reservation and then polling and then token passing and then in centralized FDMA,
CDMMA and TDMA.
Okay.
So we'll first talk about links. In
links we have studied pointtooint and broadcast link.
Broadcast link. What is pointtooint?
that we have a sender, we have a receiver. That's it. While in broadcast
receiver. That's it. While in broadcast link, this is a shared link. There are
several senders and several receivers.
These are the nodes A, B, C, D, there are several senders, several receivers.
And let's say in the broadcast link at one time, sender A sent the message to let's say sender C and sender D send the
message to receiver B. A send the message to C and D send the message to B at the same time. What will happen?
Collision will happen. Corruption of
bits will be there. Okay. So we call it as collision. Now you understand this
as collision. Now you understand this point. Let's start random access
point. Let's start random access protocol. What is random access? Give
protocol. What is random access? Give
you an idea of what idea does random access protocol gives you. Random access
protocol says that any station can send the data at any time. Okay. So in random access we'll begin with Aloha. In Aloha
we'll start with pure Aloha and slotted Aloha. Okay.
Aloha. Okay.
So in random access no station is superior to other. These all are of equal priority equal capability. No
station is superior to other station and none is assigned control over the other station. That is no station permit or
station. That is no station permit or stop other station to send the data. Is
this clear?
Okay. And you know any station can send the data at any time whatever whatever amount of data that it want. Okay. If
more than one station tries to send then there is a access conflict we call it as collision and the frames will be either destroyed or will be modified. We call it as
corrupted. Corruption will happen.
corrupted. Corruption will happen.
Okay. Now to avoid collision to avoid collision one must send data by executing a procedure or there should be in synchronization or some condition
defined by the protocol so that collision may be avoided. While in
random access you know there is no fixed order in which the station sends the data. That's why they are known as
data. That's why they are known as random access. Anyone can access the
random access. Anyone can access the channel randomly.
Okay. and each station compete for the channel. Hence these are also known as
channel. Hence these are also known as contention methods.
Here we have a dedicated channel between the two. Here it is sharing. So
the two. Here it is sharing. So
competition will be there.
Am I clear? What do I mean by random access protocol? Any stations can send
access protocol? Any stations can send the data whenever it want. To avoid we must ensure that there must be some protocol working among them.
Okay. So we'll begin with Aloha. Aloha
was developed in the University of Hawaii's Hawaii. I guess in 1972
Hawaii's Hawaii. I guess in 1972 or '7s was the time. Okay. So it was basically designed for the wireless land
wireless land but you know it can be used in any shared medium and each station sends equal size frame. Okay. So
in Aloha we will study pure Aloha or original Aloha and the second part is slotted aloha.
In pure Aloha we allow the station to transmit data at any time whenever they want. The pure Aloha is pure randomness.
want. The pure Aloha is pure randomness.
Here pure randomness.
Anyone can send the data at any time.
Hence you know collision chances will be very high. Collision
very high. Collision chances will be high in pure Aloha or original Aloha. Now after transmitting
original Aloha. Now after transmitting the data packet a station must wait for the acknowledgement and you know if acknowledgement does not arrive after a timeout period. The timeout has happened
timeout period. The timeout has happened and acknowledge have not arrived then it will be meant that the frame has been destroyed or
acknowledgement has been destroyed.
Is this clear?
Now let's draw the diagram again. There are
four station competing for this broadcast link. Now let's say if you
broadcast link. Now let's say if you have to set a timeout timer, what time out timer you will send. How will you identify that after this much time if packet has not arrived? I will assume
that either the packet or the acknowledgement has been destroyed.
So what I will count? I will count that from A till D this will the propagation delay. So propagation delay will be the
delay. So propagation delay will be the propagation delay will be the maximum distance delay.
Okay. Now
PD will be the time taken by the packet to reach and one more PD will be the time taken by the acknowledgement to reach. Now 2 PD can be the timeout time.
reach. Now 2 PD can be the timeout time.
Even after 2 PD acknowledgement has not arrived which means that either the packet was destroyed or the acknowledgement has been destroyed. So I
will say timeout will be 2 PD.
Is this clear?
So after timeout station will send the data again. But you know if collision
data again. But you know if collision has happened when will collision happen?
Let's say A has sent the data and B has also sent the data. Collision will
happen. What? Then what? They'll both
wait for 2 PD and then and then they will send again.
Let's say there are two stations. They
send the data. Let me simplify this.
Okay. There are two station A and D.
Now they want to send the data to C.
They have sent A has also sent. D has
also sent. But what happened? Collision
happened before C can access. Now what
will happen? A and D both will start their timeout timer and both timeout timer will expires simultaneously and both will send again and the same
scenario will repeat.
As soon as timeout expire A and D both will send again and collision will happen again at the same place and then what will happen? Again timeout timer will expire both will send again and the same case will keep on repeating. So
what is the solution? Station must not send the frame immediately. Immediately
the frames should not be sent. They must
wait for some time. Now what is the better thing to say? They must wait for random time.
Let's say again A and D both decide that they will wait for 5 minutes. Then the
same case will happen. So A and D should both wait for random amount of time.
Then A decide let's say I will wait for 3 minutes and D B said I will wait for 7 minutes. In this case,
minutes. In this case, collision chances will be reduced. Okay.
So, we'll wait for random amount of time.
And this this random amount of time is we call as back off time.
Back of time. Okay.
K. So, back of time. The formula of back of time is K into slot time. K into slot time. Now
what is slot time? Slot time is not fixed. Some people uh assume slot time
fixed. Some people uh assume slot time as transmission delay. Some people
assume slot time as propagation delay.
Some will assume it as roundtrip time.
So it will be given in the question or the context will be provided what is slot time. But the important formula is
slot time. But the important formula is of back of time that back of time is K into slot time and K will be a random
number a random number between 0 to 2^ N minus one and N will be the collision number collision number
is this clear so K will be the random number from 0 to 2^ N minus 1 while N is the collision number so let's say if N= to five which means fifth collision is
going on.
Okay. So let me give you an example so that so that you can understand better.
Now let's say what happens is some do in some rare scenario collision is keep on going on ascender send and collision happens. Sender send and
collision happens. Sender send and collision happens. So there should be a
collision happens. So there should be a limit that even after collision happens there should be a limit that after that sender cannot send or sender cannot attempt for
more otherwise you know traffic will increase and there is no output. So we
will give sender 15 chance or I should write maximum number of attempts for station is
15. Is this clear?
15. Is this clear?
Okay. Now let's take an example so that you can understand. We have A and B.
Both want to send and some due to some factor collision has happened.
Okay. So this was data packet of A. This
was data packet of B. They both
collided. Now what will happen? They
both should back off. What is the collision number? This is the first
collision number? This is the first collision. So N is one. N is one here
collision. So N is one. N is one here again. So k will be 0 to 2 power n minus
again. So k will be 0 to 2 power n minus 1 which is 0 to 1. So k can be either 0 or 1. Same case here k can be either 0
or 1. Same case here k can be either 0 or one. Okay. Now again here if both a
or one. Okay. Now again here if both a and b select the same number then they will back off for the same amount of time and then collision will happen again. Let's say let's make a table.
again. Let's say let's make a table.
Let's say a waited for zero which means a sent immediately this case.
And with this case there could be two possibility either B wait either B we do not wait. This was the possibility where B do not wait and this
is the possibility when B waits. Now
second possibility A waits. It also have the possibility that B do not wait and B waits.
Okay. So don't wait.
Wait here. Don't wait.
And this is wait. Are you getting the point? What we are doing? In Aloha, we
point? What we are doing? In Aloha, we divided the Aloha into two parts. Pure
Aloha and slotted Aloha. Pure Aloha
means pure randomness. A and the A and B can send the data at any time as they are both equal priority. No one is governing the other. So they both send
the data. And what happens? Collision
the data. And what happens? Collision
happens. Now what is the solution? If
collision happens and they send the re retransmitted packet again at the same time collision will happen again. So we
need that sender from the both side should wait for a random amount of time so that the time do not matches for both of them and
collision do not happen again.
Now what should be timeout time? We
calculated it as 2 PD. This is the timeout time.
But you know we should wait for the random amount of time before retransmission. So we calculated it as
retransmission. So we calculated it as back of time K into slot time. Okay slot
time will be given in the question. Now
what is K? K is a random number from 0 to 2^ N minus 1 while N is the collision number. Okay. The maximum number of
number. Okay. The maximum number of attempt for the station could be 15.
Which means the value of N for the maximum can be this is your homework.
What is the maximum value of n? If the
number of attempts are 15 then how many collision can happen.
Okay.
Now A and B we are considering this case one. A and B both send the data
one. A and B both send the data collision happened and then they are waiting for a random amount of time. Now how will they decide the
time. Now how will they decide the random amount of time with K. Now this
is first collision. So k will belongs to 0 to2 power n minus one while n is one while n is one. So this is what
this one is here 2^ n minus one. So this
is what 2^ 1 - 1 this is 1. So 0 and 1 could be the possible values of k. Now a
and b we will randomly decide that they will choose zero or one. Zero means that they do not wait here. If k is zero then back of time is what? zero which means
they do not wait and if it is one then it will wait for one slot time. Okay.
Now see this possibility 0 and zero they would do not they both do not wait which means coalision will happen
here.
Here also they both wait for one slot time. Again it is the same time. So what
time. Again it is the same time. So what
will happen? Collision will happen.
In the first case they do not wait. So
both will send the packet again collision will happen and in the last case they both wait for the same duration. So in that case also collision
duration. So in that case also collision will happen. In these two cases
will happen. In these two cases in these two cases collision will not happen. Here A send immediately and B will wait. So we will
call it as A1. And here A will wait and B send immediately. So we call it as the win for B. Okay. Now let's calculate the
probability. Probability of A winning 1
probability. Probability of A winning 1 out of four. 1 out of four. Okay.
Probability of B winning again 1 out of four. And probability of collision is 2
four. And probability of collision is 2 out of four which is 50%. Here the
probability is A and B winning is 25 25%. Is this clear?
25%. Is this clear?
Now let's assume let's assume that somehow the collision happened again as the collision probability is 50%, let's say collision happened. What will
happen? This time the value of K will become two. The value of K will become not the
two. The value of K will become not the value of K but value of N. Well N
represent number of collisions. So value
of N will become two.
Okay.
Now if value of N is two, K can range from 0 to 4. 02 to not 4 0 to 3 0 to 2^
n minus 1. So 0 1 2 and 3 this could be the value of n or no not n k value of n was 2 and the range of k
will be 0 to 3.
Now we will make the table again. A do
not wait while b wait for zero time which means b also do not wait. B
wait for some duration, some duration and then some duration. Now what will happen? A waits
happen? A waits A waits 0 1 2 3. Why we have not why we have not used
uh K as 0 1 2 3. This was the case for B only. Why B? We are assuming that A has
only. Why B? We are assuming that A has one.
A has A has what is the third form of when? Win when
won one. Okay. So whatever A has win and B has lost. So the number of collision for B will increase not for the A. So
here also let's say this is packet two. The first
packet was destroyed in the collision.
This is A. This is B. This is packet two. This is packet two. This is packet
two. This is packet two. This is packet two. And now again what happened?
two. And now again what happened?
Collision happened.
Okay. So n will be remain one for a and it will become two for b. Why? Because
we assume that we assume that a has one.
Okay. So in this scenario what will happen?
The value of k for a will be 0 and 1 while the value of k for b will be 0 1 2 3. Now what happens? The probability of
3. Now what happens? The probability of A winning is 62.5%. How? 5 by 8. Let's
check where A is winning. A is winning in all these cases.
A is winning in all these cases. We we
won't call this as a win. This will be collision. This will be a collision.
collision. This will be a collision.
So A will win here and A will win here.
Okay.
And where A will lose, A is losing here.
In this case, A is losing.
Here A is winning. And these two scenarios are for the collision.
This is the collision scenario.
Okay. Now if I again write the probability then probability of A winning is 5 by 8. Three from here and two from here. And probability of B
winning is 1 by 8 only. Just this
where where B A is losing. And
probability of collision what is probability of collision?
1 and 2. So 2 by 8 probability has of collision has reduced to 25%. While probability of A winning
to 25%. While probability of A winning is 62.5% and probability of B winning is 12.5%.
Now what will happen in the case three?
In the case three, we are again assuming that A has one. So what will happen?
This is A. This is B. This time this is packet three. The first two were
packet three. The first two were unfortunately corrupted during collision. Now collision happens again.
collision. Now collision happens again.
So what will happen? The value of N will remain one and the value of N is three this time. Is it clear? So K will remain
this time. Is it clear? So K will remain 0 and 1. And for this the value of K will be 0 to 1 2 till 7.
Now what will happen when you will calculate you'll find that probability of A winning is this time 81.25%.
13 by 16 probability of B winning will be 6.25% only and probability of collision will again be halfed 12.5%.
Why there are 16 cases eight cases and then multiplied by two cases. So zero
and then eight cases and then value of a this is value of b 0 1 till 7 and then again eight cases here eight cases here 0 to
7.
Okay let me let me write here properly. So
initially the probability of collision was 100%. After first collision the
was 100%. After first collision the probability reduced to 50%. After second
collision probability reduced to 25%.
And after third collision the probability is again halfed 12.5%. So
probability of collision is decreasing exponentially. So backoff algorithm is
exponentially. So backoff algorithm is also known as exponential backoff.
Is it clear?
You know but you can also see a clear-cut disadvantage that this backoff algorithm suffers from capture effect.
What is capture effect?
Can you guess?
Can you guess what is capture effect?
Exactly. Exactly. You can look at the probability of a. Initially the
probability of a was winning was 25%.
Look here the probability of a winning was 25%. In the second case, the
was 25%. In the second case, the probability of A winning is 62.5%.
In the third case, the probability of A winning is 81.25%.
So, initially both algorithms A and B, I should say both the uh stations A and B have similar winning probability. Both
have the winning probability of 25%. But
if any of the station win in the first collision then it will have the more probability of winning in the next collision. This is what capture effect
collision. This is what capture effect is. Probability of A initially was 25%.
is. Probability of A initially was 25%.
In the next it became 62.5% in the next 81.25%.
And the probability of B will keep on decreasing.
Is this clear? We also describe vulnerable time. Vulnerable time for
vulnerable time. Vulnerable time for collision.
For collision.
Okay. So what is vulnerable time? It's a
range of time where collision take place. It is the range of time where
place. It is the range of time where collision take place. So
So vulnerable time for pure Aloha will be 2 into transmission delay of the frame.
Is this clear? Now throughput for the pure Aloha.
Throughput for the plural law. The
formula is S= to Z G into E^ minus 2G.
While G is the number of frames generated in one transmission delay.
Number of frames generated in one transmission delay. This is what
transmission delay. This is what this G is and this is throughput. Okay.
Now what is our uh mission in any of the case where throughput is involved? We
want to maximize the throughput. So what
we will do? We will put ds by dg equals to zero. So we are trying to find the
to zero. So we are trying to find the value of g where the throughput is maximized. We want to generate as many
maximized. We want to generate as many number of frames in one transmission delay where throughput is maximized.
Are you getting the point? That's why we are trying to do this. So we did like this. And when you will solve you'll
this. And when you will solve you'll find that the value of g is 1x2.
So when you substitute g= to 1x2 this is the equation that we get what was the equation g s= to g into e raised
power - 2 g so half into e^ minus this so this is what so this is 1x 2 e this is 0.184
so the maximum throughput if you write it in percentage is 184% 184% So if you are if you are trying to
write this in a simpler format you can write that if 1,000 frames are sent if 1,000 frames are generated I should
write frames are generated in a network in one transmission delay then out of these 1,000 frames 184 frames will be
delivered successfully.
This is what throughput means.
Let me repeat again. So the throughput of the pure aloha is g into e^ minus 2g.
Now what will happen if we find it by doing ds by dg equals to0. We solve the equation we find that g equals to for g equals to half the throughput is
maximized that this is the maximum throughput one can achieve. Okay. So
this 18.4% 4% represent that if 1,000 frames are generated in a network in one transmission delay then 184 frames will be sent or will be delivered
successfully. What is G? Number of frame
successfully. What is G? Number of frame generated in one transmission delay. Is
this clear? So 1 S max S max occur when g equals to 1x2. So one half of the frame should be generated in one frame transmission time to achieve maximum
throughput or I should I can write one frame should be generated in two frame transmission time okay to achieve the maximum throughput
that's why we have written the vulnerable time was 2 into transmission delay okay so if one frame is generated by the network in two frame transmission ation
time then in this situation we will achieve the case of maximum throughput.
So what does your vulnerable time represent? So it is basically
represent? So it is basically representing that if one frame is generated by the network in two frame transmission time or two transmission
delay then there will be no collision and if there is no collision then we will achieve maximum throughput.
Is this clear? The case of pure Aloha is clear. Now what about slotted Aloha? In
clear. Now what about slotted Aloha? In
slotted Aloha, we divide the time of the shared channel into discrete intervals.
We call it as time slot.
Slotted Aloha. We divide what? We create
time slots.
As you know this is not purely random.
That's why it is not in the category of pure. We are imposing one constraint
pure. We are imposing one constraint here that any station can transmit the data in any time slot given to this at the beginning. The condition is what is
the beginning. The condition is what is the condition that the station must start it transmission must start its transmission from the
beginning of the time slot. You know
this is now the condition.
If the beginning is of the let me repeat if the beginning of the slot is make missed. If the beginning is missed then
missed. If the beginning is missed then station has to wait until the beginning of the next time slot. Are you getting the point?
Now when will collision here happen? How
will collision happen? A collision may occur if two or more station try to transmit the data at the beginning of same time slot.
Is this clear? So what is the only condition here that we will divide the whole time frame into slots and the only condition is a station must start
sending the data from the beginning of the time slot. If the time slot is missed then you have to wait until the next time slot.
Is this clear? In this case, vulnerable time is just single transmission delay. What
was in the case of vulnerable time? In
the case of pure Aloha, it was two transmission delay. Vulnerable time in
transmission delay. Vulnerable time in the case of slotted Aloha will be just transmission delay because we are making time slots here.
Okay. In this case, what is the throughput of slotted?
throughput s= to g into e^ minus g as you know in the previous case the
throughput was uh minus 2g in this case as you know vulnerable time is just td so the throughput aloha throughput of the slotted aloha will be g into e^
minus g so in this case when you will do ds by dg equals to0 to find the maximum value you will find that maximum value is at g equals to 1 which means when And
you will put the value g= to 1 1 into e^ minus 1. So this is just this
minus 1. So this is just this in the pure aloha case it was 1x 2 e. So
now 36.8%.
So the maximum throughput is 36.8%.
Which means if 1,000 frames are generated in the network in one frame transmission time then maximum 368 frames will be delivered successfully.
Why so? Because we have imposed a condition here that a frame can only be uh that a frame can only be transmitted at the beginning
of a time slot. We have divided the time frame into the slots and we have imposed a condition that transfer can happen only at the beginning. If the beginning is missed, wait for the next time slot.
This lecture we discussed about pure Aloha and slotted Aloha. Okay, let's
revise it in just few minutes. Pure
Aloha and slotted Aloha.
What happens in the pure Aloha? Any
station can transmit the data in any time. Randomness is there. Can transmit
time. Randomness is there. Can transmit
at any time.
Can transmit at any time and here in the beginning of the time slot only.
Beginning of time slot only. Here the
vulnerable time was 2 into transmission delay frame. Here the vulnerable time is
delay frame. Here the vulnerable time is just the transmission delay frame and timeout timer both will be timeout timer
will be 2 into propagation delay. Okay.
What about the throughput? Throughput is
s= to g into e ra^ minus 2 g. Here g
into e^ minus g. The maximum throughput here was 18.4%. Here the maximum throughput is 36.8%.
The main advantage of pure Aloha was simplicity in implementation and main advantage of slotted Aloa is
reduction in number of collision then pure ALOA number of collision.
Okay. So it brings down collision to the half and doubles the throughput then pure ALOA.
Okay. So this in random access pure AO slotted AOA and then three subcategories of CSMA. So we have done
these two and now in this lecture we'll begin with CSMA career science multiple access. Okay. So
access. Okay. So
to minimize the chances of the collision CSMA was developed. How chances of collision can be reduced?
It could be reduced if the station sense the medium sense the medium or the carrier before trying to use it. What
I'm saying we sense it before carrier carrier sense multiple axis which means the station sense the medium or sense
the carrier sense the carrier before trying to use it to use it. So CSMA require that each
station first sense the carrier before transmitting the data.
Okay. And how it will happen? Each
station can sense the carrier only at the point of contact.
Only at this point of contact.
Okay. So it will any station can see whether the data is already flowing or not by the contact where it is connected with the broadcast link. Okay. So each
station can sense the carrier only at its point of contact with the carrier.
So it is not possible for any station to sense the entire carrier.
So entire carrier cannot be sensed. Thus
there is a huge probability or possibility that a station might sense the carrier free while it is actually not. Let's say the data is coming from
not. Let's say the data is coming from this direction. The data has not reached
this direction. The data has not reached this point of contact. But what will A assume that as there's no data at this point, so A will assume that the carrier
is free. So A will send the data here
is free. So A will send the data here and this data coming from here will lead into collision.
Okay. So the possibility of collision is still exist because of because of propagation delay.
Okay. So when a station send a frame it is still takes small amount of time for first bit to reach every station. So the
station may sense the medium and find it idle. Okay. Here in this case what is
idle. Okay. Here in this case what is the vulnerable time? It is propagation delay this time.
Okay. So when a station send a frame and other station trying to send a frame during the same time then collision will be the result. But if the first frame of the frame if the first bit of the frame
let's say A is trying to send A is trying to send if the first bit of the frame has reached the point where C is
this is the only duration when the carrier is vulnerable when the first bit sent by A has reached C and what is propagation delay the maximum distance.
So the first bit sent by A has reached C in that means that no matter how many stations are there all have sensed that someone is already using we do not have
to use this at this moment otherwise collision will happen. So for how much time the carrier was vulnerable the propagation delay only.
Okay. After that the stations will understand that medium is busy. Okay.
Now every station should check before sending. So we have persistent methods
sending. So we have persistent methods in CSMA.
Persistent methods in CSMA. So first one is persistent. The second one is
persistent. The second one is non-persistent and the third one is persistent.
Persistent.
What does persistent means or one persistent means? In case of one
persistent means? In case of one persistent CSMA, station will keep on continuously sensing the channel. Once
the channel is idle, it will send the frame immediately with the probability one. You're getting the point. Let's say
one. You're getting the point. Let's say
this was the time A was sensing that it is it was busy.
It was busy. This was the time A was sensing. Now it will and when A was
sensing. Now it will and when A was sensing that it was busy, it was continuously sensing at every moment.
As soon as A will find that at this moment the channel is idle, it will send the data.
Are you getting the point? So the
probability of collision is high for this example. You know because if A is
this example. You know because if A is sensing continuously others are also sensing continuously which means B is also sensing and as soon as B will find this idle and A will also find this
idle. They will both send at the same
idle. They will both send at the same time collision will happen. So
probability of collision is high. In
this example if two station become ready in the middle of a third transmission.
Both will wait politely until the transmission ends and as soon as the transmission ends they will begin transmitting simultaneously and then collision will
occur.
Okay. So who uses this one persistent methods? Ethernet LAN. Ethernet lens
methods? Ethernet LAN. Ethernet lens
uses this. What about non-persistent method? In non-persistent CSMA one
method? In non-persistent CSMA one station is ready with the data. It will
sense the channel. For example, A wants to send the data. So a will sense the channel and if the channel is busy it will wait for random amount of time random amount of time and will again
sense the channel. So here let me write in one persistent continuous sensing was there you know if one channel is doing continuous sensing then which means
others are also doing that so others will continuously sense and as soon as the channel is idle others will also send the data at the same time collision
will occur. What about non-persistent?
will occur. What about non-persistent?
In in non-persistent method, the checking will happen at random amount of time. Let's say if A is ready to send
time. Let's say if A is ready to send the data, A will A will sense the channel. If it is busy, it will wait for
channel. If it is busy, it will wait for random amount of time. Well, this is better than one persistent because others will also wait for random amount of time. And when randomness is there,
of time. And when randomness is there, the chance of both of them sending the data at the same time will be very low.
Is this clear? So the collision are less compared to the one persistent. But this
this method you know will reduce the efficiency of the network because the medium remains idle when there may be stations with the frame to send. Let's
say all were sensing that all were sensing that at this moment A sensed at this moment B sensed at this
moment C sensed at this moment all of them sense that the channel is idle let's say B will wait for 10 minutes A waited for
13 minutes and C waited for let's say 8 minutes so during the first 8 minutes.
During the first 8 minutes, channel was idle and there were stations with the frames to send but still none of them
sent due to the fear of collision.
That's why efficiency was reduced. Here
in this case, efficiency was high but the chances of collision were also more.
In this case, efficiency are low along with the chances of collision. That's
why we came with a middle method which is P persistent.
So P persistent method is used if the channel has a time slot with a slot duration equal to or greater than the maximum propagation time.
What is the main corrects? Let me
explain the main corrects. It uses the advantage of both this one persistent and non-persistent. How? So it will
and non-persistent. How? So it will assign a probability in this method.
after the station finds that the channel is idle it will follow this step these steps with probability P it the station sends
the frame and with probability 1 minus P the station wait for the beginning of the next time slot and check the line again so we are doing both persistent and non-persistent you know it's it's
similar to what we have studied in physics classes that what is the probability that electron is present there or Okay.
Do you remember?
Yes. Yes. Yes. Okay. So in P persistent P is the with P probability it will send the data and with one minus P probability it will
it will check for the next time slot.
Okay. So this was the CSM part. Now
let's move to the CSMA CD.
You know the most important thing which uh gave birth to this CSM day is let's say collision has happened A and B
were sending the data and collision happened they both sensed they both sensed the carrier before sending it and somehow the collision happened as you know they sent the data in vulnerable time
let's assume this and somehow collision happened. Now what will happen?
happened. Now what will happen?
The frame is big. The first bite or the first bit is coll is colliding with the first bit of this frame of B.
But you know as CSMA has not specified what a station should do after the collision. So in CSMA if two station
collision. So in CSMA if two station sends the channel to be idle and begin transmitting simultaneously then both station data will collide and still station will keep on sending the data.
station will keep on sending the data as it is not specified. What they have to do when collision has occurred. So what
is the better way? The better way to save the time and bandwidth is to detect the collision and immediately stop the transmission. This is the strategy which
transmission. This is the strategy which is used in this CSM CD collision detection. Career science
collision detection. Career science multiple axis collision detection. CSM
has not specified what you have to do after collision has occurred. So in CSMA when the first bite is being corrupted
the remaining packets are destined to be corrupted. A and B cannot do anything to
corrupted. A and B cannot do anything to save them because it is not mentioned in the protocol what you have to do when collision has occurred. What if you
detect that collision has occurred and you stop sending the frame entirely?
You are saving your time and bandwidth.
This is what what CSMA CD is. So in CSMA CD JSON do not send the entire frame and then look for collision.
In the initial cases what we were doing we sent the entire frame the frame has not the acknowledgement of the frame has not been received. Even after the timeout timer we assume that collision
has occurred and we will retransmit it.
But here in CSM CD what we do the station do not send the entire frame and then look for collision. In CSMD
transmitting the frame and detecting the collision are done simultaneously or it is a continuous process.
Sender need two different port. One for
sending the data. So there will be two ports.
First will be for sending the data and the second port needed will be for the detection of collision. detection of
collision. So if collision is detected that sender immediately stop transmitting the data and you know there is a special port dedicated to detect the collision. So there is no need for
the collision. So there is no need for acknowledgement. No need for
acknowledgement. No need for acknowledgement.
Okay. So if collision is not detected then it is 100% guarantee that the frame is received by the receiver. Okay. And
no copy concept is also there which means if one frame is transmitted sender do not maintain a copy of that frame because a station is simultaneously sending the frame and detecting the
collision also. If collision is not
collision also. If collision is not detected that means receiver has successfully received the frame. There
is no need to keep the copy.
Is this clear?
Is this clear? There's another concept of jam signal. Let's say there are multiple stations.
Okay, there are multiple stations.
If collision has occurred somewhere in between, then the other station has right to know that collision has occurred. How will we tell them the
occurred. How will we tell them the collision has occurred? With the help of jam signal. So jam signal will be sent
jam signal. So jam signal will be sent to all the stations that collision has
occurred. It is uh a signal that is used
occurred. It is uh a signal that is used to tell the station that collision has occurred.
Okay. Now you know there is a concept for minimum frame to detect the collision. Why is this concept? Because
collision. Why is this concept? Because
of the time. Because of the time. Let me
explain properly.
The transmission delay the transmission delay of frame should be greater than should be greater than propagation delay of frame propagation delay of frame plus
transmission delay of jam signal plus propagation delay of jam signal. An
important formula you have to remember this transmission delay of frame transmission delay of frame should be greater than propagation delay of frame plus propagation delay of jam signal
plus transmission delay of jam signal.
Is this clear? So you can also simplify the formula that the jam signal is similar to acknowledgement.
It has a very less size than frame. So
what will what we can write? We can
ignore the transmission delay of jam signal and we can write just like this.
So the transmission delay should be greater than two into propagation delay.
Okay. You can also with the with the help of this transmission delay you can expand it like this two into propagation delay plus
transmission delay of jam signal. So the
minimum frame should be greater than bandwidth into 2 into propagation delay plus transmission delay of jam signal.
Okay. If you ignore this then the minimum frame will be 2 into bandwidth into propagation delay. You remember
this formula. It is important case.
Okay, it is an important case. This is
an approximate formula. What about the exact formula?
L should be greater than bandwidth into 2 into propagation delay plus transmission delay of jam signal. What
is this?
L should be greater than this number. L
should be greater than this. So what is what will be the minimum? The minimum
frame size will be B into this.
Okay, minimum frame size for what?
Minimum frame size to detect collision.
To detect collision in CSMA CD, this is a very important formula. You have to remember this. And then there is a
remember this. And then there is a concept of purging. What do what do you mean by purging?
Purging means that uh in the back of algorithm in the back of algorithm even if even if the waiting time is zero you do not send it immediately you have to
wait for some amount of time so that the remaining corrupted bit should be cleared from the broadcast link. So this
is a very small concept I should I think I should tell you.
Okay. So now the next lecture or what I think I should do is the next lecture will be for CSMCA. It is a very important lecture for the Ethernet.
Okay. But in this lecture I'll begin with controlled access protocols. We'll
learn about polling, reservation and what was the last part?
The token passing. Polling, reservation
and token passing we will complete in this lecture as they are very simple and very small topics. So we will complete it in this lecture itself and the last part also TDMA, CDMMA, FDMA they will
also be completed in this lecture. We
will do it in the next 10 10 minutes.
The next lecture is very important CSM CA for Ethernet. Okay,
for now let's begin with what is pooling.
Okay, in polling we have a central node. So in
random access what we had in random access we had no authority over the stations.
In this controlled access protocol we have a concept of primary and secondary station. Primary station will control
station. Primary station will control all secondary station. So we call this as primary station and the remaining are secondary station. S_ub_2, S3 and S4. If
secondary station. S_ub_2, S3 and S4. If
the concept of primary or secondary station is missing, then any station who want to send the data, it can send only in the case if all other station give permission.
If there is no uh leader, then all of them will give permission to a specific sender and then only the sender can send. What was in the case of random
send. What was in the case of random access? Anyone can send. There was no
access? Anyone can send. There was no concept of primary or secondary or leader or the follower. Here in this case we have primary and secondary rules
and you know as it works on the democracy as it works on the leader based rule there is no collision
concept in this controlled access protocols they are collision free you'll understand when I'll explain you what polling is so in polling
let's say P want to let's say S1 wants to send the data to S3 So what what do what do we do? S3
is uh S1 is not going to send data directly to S3. P will do its work. What
is the work of P? P will poll. Do you
want to send the data? S1 will say yes, I want to send the data. Then S1 will send the data to this P. And then P will send the data to S3. Okay. And then P
will ask S2, do you want to send the data? it will send back NAC N AK that I
data? it will send back NAC N AK that I don't want to send the data okay and whenever P want to send the data it can directly send okay P is
assured that anyone can who can send the data will ask me before sending it and P as the leader will send directly is it clear let me repeat what happens
in polling in polling if S1 want to send data to S3 P will ask S1 do you have any data to S1 will send the data. P will send the
acknowledgement back. Now P will send
acknowledgement back. Now P will send the data to S3.
Okay, it doesn't happen like this. Let
let me explain in a very formal way manner.
So here is P. Let's say here is S_2. So
P will send the poll to S2. S2 will
reply, no, I don't want to send the data. P will send the poll to S1. Now
data. P will send the poll to S1. Now
S1 will send the data itself and then P will send the acknowledgement. Now what
about S3? Will P going to directly send the data to S3? No, it doesn't happen.
What we do? We do like this. P will send that you are selected. Get ready to receive the data. S3 will send the acknowledgement. Yes, I'm ready. P will
acknowledgement. Yes, I'm ready. P will
send the data and S3 will send the acknowledgement. Yes, I have received
acknowledgement. Yes, I have received the data. Okay. So in this manner
the data. Okay. So in this manner polling works. Every station will send
polling works. Every station will send the data through primary station. Two
secondary station cannot communicate directly. Common topology used in
directly. Common topology used in polling is what?
Star topology. Okay. We have discussed in the first class.
Common topology used in polling mechanism is star topology. Now here in this case you can yourself tell that bandwidth utilization is very low because lot of time is wasting in
sending the poll message receiving the acknowledgement sending the data but you know what you are getting for this trade-off no collision drawback of the
polling is if primary station fails the system goes down.
Is this clear?
Now what about reservation? In
reservation method station need to make a reservation before sending the data.
Time is divided into intervals. Time is
divided into intervals. In each interval reservation frame reservation frame precedes the data frame sent in that interval. Okay. If there are n stations
interval. Okay. If there are n stations in the system, let's say n stations are there in the system. Then there are exactly n reservation mini slots in the
reservation frame. Means that every
reservation frame. Means that every station have its own mini slot. If there
are three station then reservation will station will have three mini slots.
Okay. The station that have made the reservation can send their data frames after the reservation time. Let me
repeat here again also in random access anyone can send any time while in controlled controlled manner there's a concept of polling. We have set up authority. Authority will manage. Here
authority. Authority will manage. Here
we are talking about the reservation.
You have to reserve first that I am going to send and then you are going to send. Is it clear? What about token
send. Is it clear? What about token passing?
What about token passing?
Here all stations are logically connected to each other in form of a ring. So here we will be using the ring
ring. So here we will be using the ring topology. Okay. It uses a special frame
topology. Okay. It uses a special frame called as token. Okay. So a station is allowed to transfer the data packet if
and only if it has the token. So in this scenario only station one can send the token. Uh not token not token we are
token. Uh not token not token we are talking about the data. The one who has token can send the data. So here in this case S1 has the token S1 will send the data. Now after the data is sent the
data. Now after the data is sent the token will be passed. Whenever station
has no more data to send it will release the token it will go in a ring fashion.
Now S2 has token. If it has no data to send, it will forward the token. So in
this manner, it will keep on.
Okay. And this you know this is a best technique for broadcasting.
No no concept of acknowledgement because there is no concept of collision here.
And if there is no collision then it is sure that the packet will reach.
Okay. Now about channelized we can study TDMA. In TDMA the time of the link is
TDMA. In TDMA the time of the link is divided into fixed size interval called time slots. Time slots t1 t2 t3. And
time slots. Time slots t1 t2 t3. And
these times slots are allocated to stations in roundroin manner.
T1 these time slots are allocated to stations in roundroin manner. You
understand roundroin s1 s2 s3 again s1 s2 s3 in this manner. Okay. So each
station must transmit its data during the time slot allocated to it. So in
case station do not have any data to send its time slot goes to waste.
Okay. So what is the disadvantage? If
any station do not have data to send during its time slot then the time slot is wasted and this is reduction in efficiency. Reduction in efficiency.
efficiency. Reduction in efficiency.
This time slot which was allocated to such a station which do not have any data to send could be allocated to some other station willing to send the data.
Is this clear?
Okay. So the next lecture is very important of CSM CA. We will study Ethernet in detail.
In the last lecture we have discussed CSMAC.
We discussed all about Ethernet and in the end we ended the lecture with disadvantages of Ethernet that it is not suitable for interactive application where data size is less. It is not suitable for real-time application as
they support deadline and collision is high in Ethernet and it is also not suitable for client server architecture.
Why so? because server is of higher priority than client and there is no process or there is no uh method to set priorities in CSME.
Okay, we also derived the formula for the number of times we need to find the we need to uh transmit before getting the first succession or first success.
So average number of collision before the first successful transmission was E.
We derived it. Okay, in this lecture, in this lecture, we'll begin with our new module which is of routing. You already
know what routing is. We have discussed in the first module of IPv4 addressing that routing is static routing. And in
this module, we will begin by understanding about the dynamic routing.
Now, what is the opposite of routing?
The opposite of routing is flooding.
That you flood the packet onto the network.
What is flooding? Flooding is simple. Uh
suppose A sent the packet to B. Now B is going to send the packet or forward the packet to every outgoing link it has.
Okay. So we are about to flood the packet. What are the advantages? No
packet. What are the advantages? No
routing is required. Shortest path is always guaranteed as the packet whichever packet arrive the destination first.
Let me explain again. For example,
A forwarded the packet to each and every outgoing link it has. And this is the destination. Suppose this packet P1 P1
destination. Suppose this packet P1 P1 P2 P3 P4. This packet P1 will reach to the destination first. So what
destination will do? Destination we'll
look at from which as as there is option of record route in the options of
record route in the options of header the destination will look that from which router this packet has come from.
So that will become the shortest shortest path. Are you getting the
shortest path. Are you getting the point? Shortest path in flooding is
point? Shortest path in flooding is always guaranteed because the packet which arrives as destination first have must have taken shortest path. The third
thing is it is highly reliable. If one
path is down the packet will reach the destination by choosing some other path.
What is the disadvantage is? The
disadvantage is there is a enormous amount of traffic and multiple duplicate packets will be received by the receiver.
Okay.
And then we have routing. What is the advantage of routing? The traffic is less. Duplicate packets won't be
less. Duplicate packets won't be received by the receiver. And what is the disadvantage? We need some complex
the disadvantage? We need some complex routing table or some routing algorithm.
And the chosen path may not be uh and the chosen path may be down. So it is not highly reliable.
Well, shortest path also depends on the algorithm and some algorithm fail to find the shortest path. Okay. So I'll
begin with the concept of dynamic routing. The first algorithm will be
routing. The first algorithm will be distance vector routing and the second will be link state routing.
What happens in the distance vector routing? We prepare the routing table at
routing? We prepare the routing table at every router based on local knowledge.
Distance vector routing. We prepare
routing table based on local knowledge.
For example, A B C D or let me properly router A, router B, router C and router
D. A B C D. Okay. Now we will also give
D. A B C D. Okay. Now we will also give cost to the link 1 7 3 2 11 any random
number. Now
number. Now router A will or router A will form a routing table. It have a column of
routing table. It have a column of destination. It have a column of
destination. It have a column of distance or the cost. It will also make a column for the next hop. So let's say
this is the distance. So for destination to D, for destination to D, what is the distance? What is the distance? What is the next? D. for
distance? What is the next? D. for
destination to C. Well, there is no direct link. So, I'll write distance is
direct link. So, I'll write distance is infinity. The destination is C and the
infinity. The destination is C and the next hop is not applicable. What about
B? B is the distance is two and the next hop is B only. What about A? The
distance is zero and next is also A. So,
this is what routing table is in the distance vector routing and this will be prepared at each and every router. So
each and every router is going to prepare the routing table based on local knowledge. Now what will happen?
knowledge. Now what will happen?
This distance vector will be shared.
This distance distance vector will be shared among the neighbors.
shared among neighbors. So A will receive
among neighbors. So A will receive distance vector from B and D.
At C it will receive from B and D. D
will receive from ABC. Okay. Now what
will happen the distance vector received from we will we are talking about let's say at A the distance vector received from B will be and from D will be we can
calculate from here uh it will be 2 0 from we are talking about B 3 and 7 from B what about D it
will be 1 and then 7 and then 11 and then for D it will be zero okay now what we are doing This is what we
have re this is what we have received from from B and from D. Now what we now what we will do we will calculate the distance to reach B and we will
calculate the distance to reach D. What
is the distance to reach B? The distance
is two. And what about D? The distance
is one. So I'll write two and one here.
Now now let's see here. So from B A to B the minimum from A to B the minimum
distance is two from A to B the minimum distance is two and from here the minimum distance is two only now what about okay okay what
what are we planning to do we will make a new routing table for A we'll have destination we'll have
distance and next hook okay again a B C from for A the distance zero. The next
stop will also be for B the distance will be two and it's also C. Here what are we doing? How are we
C. Here what are we doing? How are we writing this? We have two methods. The
writing this? We have two methods. The
first is let's say the first is directly from A. From A to reach B we require two
from A. From A to reach B we require two unit of distance and with the help of B we require two unit of distance. you can
directly go to B or with the help of this routing table you can go to B and then again go to B. This is a way of saying okay so here also it to be 2 2 +
0 2 and 2 + 0 what is the minimum they are both same that's why I have written two what about c what about cere
was infinity so out of infinity and using method B and D so first of all you have to go to B the
distance is two and then you can go to C the distance is three and with the help of D if you want to go that distance is 1 and then the distance is 11. So out of
these three what is minimum the distance from B. So I will write to reach C five
from B. So I will write to reach C five and what is the next hog? B is this clear? So what are we doing here? When
clear? So what are we doing here? When
the routing the distance vector will be shared among the neighbors A will get to know that there are two path to reach to C. The first path is this path and the
C. The first path is this path and the second path is this path and the third path was directly from this but the cost was infinity. So what A will do based on
was infinity. So what A will do based on the distance vector received A will check for the minimum. That's what we are doing.
So A will find that B is the path. So from B
so from B this is what the minimum cost path is. I hope the point is clear.
Okay. So this is how we check. So this
is just the formality what you will do.
You will make the routing uh routing table calculate the distance vector share it among themsel. They will share it among themsel and you can directly look from the graph itself. No need to
do like this. No need to calculate from this. you can directly look from the
this. you can directly look from the graph and we'll check where is the minimum uh path. Okay. So this was the concept of distance vector routing.
In distance vector what happens? We
share the distance vector among the neighbors. So based on the distance
neighbors. So based on the distance vector received from the neighbors a new routing table will be created. A new
routing table will be created at A. And
same thing will happen for D, C and B itself.
Okay. So when routing table will be created at C the new routing table it will register that the shortest path to reach from C
to A was not infinity.
It is from B 3 + 2. Is it clear?
Okay. So this was the concept of DVR.
Let me repeat again.
Based on the knowledge you have from the distance vector you receive from the neighbors, you will modify your routing table.
You will modify your routing table and then you will share that routing table again. But you know routing table is not
again. But you know routing table is not shared. The distance vector is shared.
shared. The distance vector is shared.
So from the new routing table the distance vector the new distance vector will be shared and this will keep on going on until convergence is reached.
What do I mean by convergence?
Convergence means that now there is no more updation in the routing table.
Is this clear?
Okay. Now we will move for link state routing. Link state routing. In link
routing. Link state routing. In link
state routing the fundamental difference is we are using flooding instead of sharing just to the neighbors. Sharing just to neighbors.
neighbors. Sharing just to neighbors.
Instead of sharing just to the neighbors we are using flooding. So what we will do again the same diagram A B C D we will not going to share just
the distance vector. We are going to share the whole link state packet. What do what do we have in the link state packet? We have
sequence number and the link state and the and the local knowledge. What what is the local
knowledge. What what is the local knowledge for A that you can reach B and D in the cost let's say two and one. So
you can this is what the link state packet of A. Similarly you can make the link state packet for C. Let's say
you'll write some sequence number and then you can reach B and D. Let's say
this is three. So three and then you can reach D with 11. So this is 11. Okay.
This is what link state packet is and this link state packet will be shared or will be flooded. So the A will send this link state to B and let's say there are
more connections from B. So B will send the link state packet of A to each and every outgoing link it has. So it will
flood it and after that after that we will apply the Dextra algorithm to find the shortest path. Here if you have realized if you have realized what
we are doing we are relaxing the edges we are relaxing it initially we have infinity and then after just one update we found that the shortest path is not
of infinity but of five and then we will keep on doing it for the other nodes also. So we are which algorithm we are
also. So we are which algorithm we are using here we are using bellman food. So
in DVR we are using bellman for and in link state we are using dextra algorithm. The whole difference in one
algorithm. The whole difference in one go link state routing. It came in 1980s and it came in 1990s. Here bandwidth
requires less because we only send distance vector. Here the whole link
distance vector. Here the whole link state packet is shared. It is based on local knowledge and you know flooding is involved. So this will be based on
involved. So this will be based on global knowledge because everyone will have the link state of everyone. So it
is based on local not local but global knowledge. This is this uses bellman for
knowledge. This is this uses bellman for algorithm to relax the uh edges and this will use dax algorithm to find the shortest path. Here traffic is very less
shortest path. Here traffic is very less and here traffic is very high.
Here convergence will be slow and uh very low. Here convergence is faster.
very low. Here convergence is faster.
Faster convergence slower convergence.
Okay, this uses routing information protocol and this implements OPF open shortest
path first.
Is it clear? Okay. Now let's move to our next small topic of switching.
Okay. So switching is done at network layer but uh you know there's a special concept of circuit switching and packet switching. This is done at network
switching. This is done at network layer. But circuit switching is not done
layer. But circuit switching is not done at network layer. It was designed for telephonic network. So when circuit
telephonic network. So when circuit switching was in invented, there was no concept of OSI layer or TCP IP layer. Okay. So what is circuit switching? So communication is
circuit switching? So communication is circuit switch network take place in I should write three phases. The setup
phase and then the data transfer phase and then the tear down phase.
Tear down phase. So what do we do?
What do we do in circuit switching?
In circuit switching network before the actual data transfer can take place, a dedicated dedicated circuit or I should write here
proper physical path is set up between the sender and the receiver. Okay, here
in circuit switching a proper dedicated path is reserved for data sharing. So
the dedicated path established between sender and receiver is maintained for the entire duration of the conversation.
Okay. So reservation of resources must be there must be uh present the facility for reserving the resources for the concept of circuit switching. And these
resources can be anything. They can be switches buffers uh switch processing time, switch input, output port. And these resources the
output port. And these resources the important thing is they are they remain dedicated during the entire duration of the data transfer.
Okay. So if I have to write the total time taken from the message from source to destination will be setup time and then transmission time and then
propagation time and then tier down time. Tear down time.
time. Tear down time.
Setup time will be let's say s. The
transmission time will be message by bandwidth. Propagation time
will be distance by uh velocity. And
then the t down time let's say be t.
Okay. And if x packets are transferred then x dot dv.
Okay.
Is it clear?
So this uh in in setup time in setup phase what we do we established uh we establish a proper physical link we dedicate the resources we reserve the
resources and they cannot be used by someone else. Okay. And in data transfer
someone else. Okay. And in data transfer phase what we do in data transfer phase the entire data travels over the dedicated path from sender to receiver that we have set up in setup phase. And
you know data flows are continuous between sender and receiver.
As there is a dedicated proper path there is no addressing involved in the data transfer. That's why no header
data transfer. That's why no header nothing because it's header is used to identify that what is the source address what is the destination address which routing
path I should follow and if I am giving you a proper physical dedicated path there's no need for header no need for overhead okay what about tear down phase
in tear down phase we deallocate the resources circuit disconnection or tear down will happen so after the data transfer phase is completed
The circuit is disconnected when so in tear down phase a signal is sent to each switch to release the resources that my work of data transfer is now done. You
can release the resources. So
now where is this circuit switching implemented? It's implemented as
implemented? It's implemented as physical layer because a physical link is being established.
Okay. So if I ask you what is the advantages of circuit switching I'll say a well definfined dedicated path to travel. This is the foremost advantage.
travel. This is the foremost advantage.
You already have resources. There is no waiting time. No waiting time
waiting time. No waiting time at any switch once the circuit is established and data is transferred
without any delay. No delay. No overhead
of headers as there is already a dedicated path.
Okay. Receiver always receive data in order.
No reordering is required. So this is what the advantages of circuit switching. But you
know it's not always the good side. What
is the disadvantage?
What is the disadvantage? You can think of as the connection is dedicated, it cannot be used to transmit any other system data. Even if the channel is
system data. Even if the channel is free, you have fixed it. Resources are
already reserved. Now, if
the person who have res reserved the resources is not using the resources, they're getting wasted and some other person who wanted to use the resources will not get the chance.
Okay. So as the connection is dedicated, it cannot be used to transmit any other system data even if the channel is free.
Okay. So it is I can write it as it is inefficient in terms of utilization of system resources. Okay. And you know
system resources. Okay. And you know bandwidth requirement is very high here.
Bandwidth requirement will be high. The
time required to establish a physical link or I should write a set of phase time is very high.
is too long.
The third thing is as you know there is a physical path. This is not logical uh loose source routing something like that that okay you can go from these these
routers wireless. No here the physical
routers wireless. No here the physical path is actually set up. So it's like the hardware. So routing decision cannot
the hardware. So routing decision cannot be changed when the once the circuit is established. If circuit is established
established. If circuit is established the routing decisions cannot be changed.
Did you get it? Now the second part or the second uh method of switching is packet switching.
So in packet switching is a method of transferring the message to a network in a form of packets. Okay. So the message is broken into the whole message is broken into smaller pieces. It could be
the fixed or variable size. We call it as packet.
And at the destination all these packet has to be reassembled. Okay. So they
it's like fragmentation. All the packets need to be reassembly is required.
Reassemble link should be there at the receiver at the destination. Okay. No
preset or reservation of resources is needed. No reservation is needed or no
needed. No reservation is needed or no presetup phase. It is just based on
presetup phase. It is just based on store and forward technique. Store and
forward technique.
And you know for between source and destination unlike circuit switching we where we had a proper physical path here there can be multiple path that a packet
can follow. Okay. So more than one path
can follow. Okay. So more than one path is possible. Each packet contains source
is possible. Each packet contains source and destination address using which they can independently travel through the network. As you know there's no strict
network. As you know there's no strict path. So header is required and based on
path. So header is required and based on that header each packet can independently travel through the network.
Okay. And even the packet belonging to same message or the same packet the fragments of the same packet can follow different path to reach the destination
because let's say if there is some congestion in the path then packets can choose some other path. Is this clear?
Is this clear? While in circuit switching packet cannot choose other path because the there as there will be no congestion because the resources are already reserved there will be no
congestion the path is dedicated. So
there they will follow a strict path and there is no header involved.
Okay. So packet switching was basically designed to overcome the weakness of circuit switched network since they were not effective for small messages. For
example, if you want to uh send a very small message, you you wouldn't want to uh invest time in setup phase that a physical link should be established and
then you send a small message. No.
So for that packet switching is like a boon.
What are the advantages of packet switching? Then
switching? Then what is the advantage? You can think of it is more fall tolerant because let's say if the physical link gets broken the whole system is down
while here you can follow some other link so it is more fall tolerant in case the link is down there is no setup or tear down phase no setup yet tear down
phase involved efficiency is better than circuit switching it is more reliable as destination can detect the missing packet
It is cost effective and cheaper to implement than circuit switching. Now again not only good side
switching. Now again not only good side what are the disadvantages reassembling is important because packet switching doesn't give the packets in
order in order is not there. So
reassembling is required and since the packet are unordered we need to provide sequence number for each. We need to provide header. So there will be
provide header. So there will be overhead transmission delays more.
Okay. There can be delays in this uh packet switching. In circuit switching
packet switching. In circuit switching as you know resources were already reserved. So there was no concept of
reserved. So there was no concept of delay. Here the delay can be there. And
delay. Here the delay can be there. And
packet switching is beneficial only for small messages. For large messages
small messages. For large messages circuit switching is better. Is it
clear? Okay. Before ending the lecture, let's you know the drill. Circuit switching
versus packet switching.
It has three phases. Setup phase, data transfer phase and tear down phase. It
has only one phase of data transfer. No
need to set up and no need to tear down.
Physical path can be between there is a physical path between source and receiver. There is no physical path in
receiver. There is no physical path in packet switching. All packet use the
packet switching. All packet use the same physical path. Here there can be multiple path they can follow different path different path can be followed.
Okay. Here the reservation should be there. Entire bandwidth is reserved.
there. Entire bandwidth is reserved.
Entire bandwidth is reserved in circuit switching is reserved. And here in packet switching no reservation. No
reservation.
And you know if the bandwidth is not properly used let's say you have reserved the entire bandwidth and not are not using it at the full capacity
then there will be wastage of bandwidth and here is no bandwidth wastage.
Okay. Okay. Since since packet switching is based on store and forward transmission. This is not based on that
transmission. This is not based on that store and forward.
Here congestion can happen in which phase?
It can happen during connection establishment phase, setup phase. Okay?
Because there there can be multiple people who wanted to wanting to reserve a single uh physical path. So there can be competition, there can be congestion there in the setup phase. Here the
congestion will happen in the data transfer phase as there is no setup and tear down phase. In this circuit switching is
phase. In this circuit switching is reliable as there is a proper physical path. No delays reservation already
path. No delays reservation already done. So it is reliable.
done. So it is reliable.
Here it is not reliable.
So this is better for sending large messages and this is for sending small messages.
This is fall tolerant. If one link is down, you can follow other path. If phys
if physical link is down then it's all done.
Is it clear? So this was the concept of packet switching, circuit switching and we also learned about distance vector routing and link state routing.
In the last next lecture we'll begin with application layer. We'll learn
about IP support. We learned about OSI.
Okay, the application layer. So this
application layer is responsible for all the services that internet provides provide to users. So we can study these SMTP DNS FTP
HTTP, POP, S, SMTP is used for email purposes.
This is used for domain domain name to IP addresses. This is used for file
IP addresses. This is used for file transfer. This is file transfer
transfer. This is file transfer protocol. This is used for web services.
protocol. This is used for web services.
POP is used for downloading the email.
Similarly like IMAP.
Okay. So for email we are going to study email. We're going to study SMTP
email. We're going to study SMTP and IMAP.
Okay. So let's say this is uh this is our email. This is our sender.
our email. This is our sender.
Sender will push using SMTP on this sender mail server. This is sender
mail server. So sender will push the
mail server. So sender will push the email using SMTP on sender mail server.
And then this will be pushed again. This
will be pushed again over internet to the receiver mail server. Receiver mail
server. And this will be pulled at the receiver end with the help of you can call it as pull or download with the help of POP 3 or IMAP.
Let me create a clear diagram here.
Sender will push on the sender mail server and then this will push again over the internet to the receiver
receiver mail server and then it will be pulled or downloaded onto the receiver computer. Okay. So for pushing we are
computer. Okay. So for pushing we are using SMTP or here also we are using SMTP and for downloading we can use POP
or IMAP. POP 3 or IMAP 4.
or IMAP. POP 3 or IMAP 4.
Is it clear? So SMTP transfer the mail from sender mail server to receiver mail server. While sending the mail, SMTP is
server. While sending the mail, SMTP is used two times. Okay. Between the sender and receiver mail sender and the sender mail server and then sender mail server
to receiver mail server. Here it is used two times. Okay. And SMTP is pure
two times. Okay. And SMTP is pure text based protocol. To send multimedia we use MIME that convert uh that is used
for the multimedia purposes. Now to
receive a download another protocol is needed between the receiver mail server and the receiver.
The most commonly are POP 3 and IMAP 4.
Is it clear?
Is it clear?
Okay. You may hear the name of male transfer agent. So let's say here is
transfer agent. So let's say here is user A. It will send it to user agent
user A. It will send it to user agent and user agent will call mail transfer agent client and then this mail transfer of client with the help of internet will
communicate to mail transfer agent of server and then it will send to user agent and then it will be accessible by user B. Okay, you can also learn about
user B. Okay, you can also learn about this diagram.
Okay, so let me clarify some of the points. The objective of SMTP to
points. The objective of SMTP to transfer the email reliably and efficiently. Reliably and efficiently.
efficiently. Reliably and efficiently.
What is the port number? Port number is 25. There are two components. User agent
25. There are two components. User agent
and mail transfer agent at both side.
Okay. User agent prepare the message.
User agent.
It prepares the message, create the envelope, put the message into the envelope. Okay. Mail transfer agent
envelope. Okay. Mail transfer agent transfer the mail across the internet.
Okay. So actual mail transfer is being done by mail transfer agent.
Mail transfer agent. Okay. And to send the mail system must have a client mail transfer agent. And to receive the mail
transfer agent. And to receive the mail system must have server mail transfer agent. Okay. I have already discussed
agent. Okay. I have already discussed that it is for the text only. Okay.
With the help of SMTP and POP, we can send only text messages 7 bit sky text only. Is it clear? So, SMTP
cannot transfer other type of data like images, videos, cannot transfer binary files or executive executable files.
Cannot transfer text data of some different language than English like French, Japanese, Hindi or Chinese. Uh,
SMTP is not sufficient to send binary files. Okay. To do that to do that we
files. Okay. To do that to do that we call some other protocol MIME multi-purpose internet mail extension and what does it do it's
a supplementary protocol that allows non-eskai data let's say of video or text text well in some different other language or
some audio file video file to convert into sky format okay it's a supplementary protocol that allow non on SKI data to send through SMTP.
Is it clear? So it's is used to convert the non-ext data to text data and then at the receiver side text data to again the non-ext data.
Is this clear? One another important part is that this is stateless protocol.
It does not maintain any information of the user. If an email is asked to be
the user. If an email is asked to be sent twice, then server resend it without saying that email has been sent.
Okay, it's a stateless. It's a
connection oriented connection oriented at transport layer it uses TCP.
Okay. And which TCP? Persistent
TCP connection so that it can send multiple email at once.
Okay. Is it clear?
Now let's learn more about POP PO pop 3.
Okay, what is POP 3? It is a message access protocol. It is a pull protocol.
access protocol. It is a pull protocol.
We have already seen this. It is a pull protocol. It uses port number 110 at TCP
protocol. It uses port number 110 at TCP connection oriented and again it uses the same persistent TCP connection.
Okay. Now there's important difference as I've told you that you can use either POP 3 or IMAP 4. Now what is the difference between them? As they are both pull protocol, IMAP 4 is more
advanced one as POP 3 do not allow the user to organize to partially check the content of the mail before downloading while IMAP
allows it.
Okay. So, POP 3 have two modes.
The keep mode and the delete mode.
In delete mode, the mail is deleted from the mailbox after retrieval. While in
keyboard mode the main mail remains the mailbox after retrieval. Okay. So
whatever mode you choose it will perform accordingly the names itself uh suggest what does that mean? Now IMAP it is
similar to pop but it has more features.
It's more powerful and more complex. It
provides extra functionalities of uh checking the email prior to downloading.
You can search for the content of the email for a specific string prior to downloading.
You can even partially download the email. You can create, delete or rename
email. You can create, delete or rename the mailbox on the mail server. You can
create a hierarchy of mailbox. What I
mean is you can organize things.
Organize here pop 3 do not allow to organize.
Okay. So pop IMAP 4 is a again a pull protocol uses a port number of 143. Here the port number was 110.
It also uses persistent TCP connection.
It is a stateful.
Okay.
Is it clear?
Okay. So next protocol is DNS domain name system.
So you know it is easy to remember domain names like google.com okay but it is not easy to remember the IP addresses. So IP addresses are even
IP addresses. So IP addresses are even not static they change based on the location. DNS is a protocol used to
location. DNS is a protocol used to convert domain name to IP addresses.
It's similar to like your phone book that you can remember the name but not the numbers.
That's why in your phone book in your contacts you can search from the name and that corresponding contact number will be provided to you. The same thing happen here. You can remember the domain
happen here. You can remember the domain name you can remember the website name but not the IP address.
Okay. So you have heard about several domain names like com likeedu.org.gov.
Okay. So these are the domains.
Okay. So how does the hierarchy work?
Let's see. So we have root DNS server.
Okay. Above that we have a root server and there we have a root DNS server.
From here it have com DNS server DNS server. EDOD DNS server. So this is what
server. EDOD DNS server. So this is what root server is. This is what the top level domain servers are. Top level
domain servers are. And based on this and then you can extend the hierarchy for com you can have google.com
forg you can have uh like it e.org for education you have mit.edu edu.
Okay. So these are authoritative server.
Okay. Now for querying we have two type of queries. The iterative queries and
of queries. The iterative queries and the recursive queries.
Iterative queries work like this. The
host will ask the local DNS server.
Local DNS server will search the root server. root server will reply and then
server. root server will reply and then it will move to top level DNS server and then that top level DNS server will reply and then it will ask the authoritative server and then that will
reply okay this is what iterative is it goes here ask here come back goes here come back goes here come back and
then we'll return to the host while in recursive what will happen in recursive the host will ask the local DNS server
Local DNS server will ask the root server. Root server will ask the top
server. Root server will ask the top level server. Top level server will ask
level server. Top level server will ask the domain uh authorative authoritative domain server. And then authorative
domain server. And then authorative domain server is not going to reply the host or the local local DNS server. It's
going to reply the top level. So it
worked in this manner. Are you getting the point here? It was working in this manner. It will ask the local server,
manner. It will ask the local server, local server ask, it will reply back. So
ask, it will reply back. Ask will reply back and then will reply back to the host. Here it work like this. It will
host. Here it work like this. It will
ask the local server. Local server will ask the root DNS server. Root DNS server will ask the top level DNS server and then to the authorative. Then this
authoritative will reply to the top level DNS server. Top level will reply to root server. Root will reply to local DNS server and local DNS server reply to host.
Is it clear?
>> And by default, by default the DNS uses UDP at transport layer. See, it can either use UDP or it can also use TCP.
It depends on the query size. If query
size is high, if query size is high, then it use TCP. What is the threshold?
512 bytes. If the query size is greater than 512 bytes, it uses TCP. And by
default if someone ask then you say UDP when the query size is generally lesser than 512 bytes.
Is it clear? Then we have file transfer protocol.
Okay. So it's a standard internet protocol for transferring files over between the computers over TCP IP connections. It uses the port number 20
connections. It uses the port number 20 and 21. 20 is used for data connection
and 21. 20 is used for data connection and 21 is used for control connection.
Okay. So control connection remain connected during the entire FTP session while data connection is opened and closed for each file transfer activity.
Are you getting the point? So we have two port here one control and data control remain open for the whole session while the data port opens and
closes at each file transfer activity.
Is it clear? So we call FTP as out of band protocol as data connection and control information flow over different connections.
Data and control information flow over different connections. That why we call
different connections. That why we call it as out of band.
Is it clear? FTP is also a stateful.
What are more properties? I can't
remember.
You know, HMT uh HTTP, HTTP, SMTP, they were all inband.
And this whichever uses two ports like FTP 2021 DHCP they are out of band while the one
which have a single port they are inband. Okay. FTP is also stateful.
inband. Okay. FTP is also stateful.
Okay.
So yes this was about FTP. Oh I remember one thing about the transmission mode.
Transmission modes of FTP you can transmit in stream mode, block mode and compressed mode. In stream mode, it's a
compressed mode. In stream mode, it's a default mode. This is default mode. Data
default mode. This is default mode. Data
delivered from FTB to TCP as a continuous continuous flow of a stream or continuous flow of bytes.
Here data is delivered in blocks and each block have a three byte header in the beginning. The first bite is called each block have a three byte
header. Three byt. The first bite is
header. Three byt. The first bite is called as block descriptor.
Okay. And the next two bytes what do what do they do? They define the size of block in bytes. Define the size of block
in compressed mode. If the file is big data can be compressed. Okay. by
removing the spaces by null characters.
These spaces and null characters are usually compressed.
Okay, there could be different file types like sky file type, EBCDIC file type, image file type. Okay,
so file transfer can use these file types across the data connections.
Is this clear?
Okay. Now what about HTTP protocol?
This is mainly used to access data on the worldwide web. Used to access data on worldwide web. Okay. It is also inband.
What is the port number? 80 on TCP. It's
a stateless.
Stateless.
Okay. So there are two types of there are two types of HTTP. non-persistent
and persistent. This is 1.0 and this is 1.1. What do we mean by non-persistent?
1.1. What do we mean by non-persistent?
For each request and response, one TCP connection is made. Is this clear? And
for persistent, the server leaves the connection open for more request after sending the response.
Is this clear? In non-persistent, what do we do?
One TCP connection will be made for each request and response. And in persistent the server leaves the connection open for more request.
Is this clear?
Okay. So the thing is I know I know I know this class is boring but we have so many protocols you can study from uh outside also but I am just
covering the major ones.
If you if you want I can teach more also but let's say if if you are saying that class is getting bored so we will move towards some of the interesting protocol IP
support protocols okay here we will study about the ARP which we have discussed in the class one we'll study about ICMP
we can also stud about okay so ARP is communication protocol used to find the MAC address of a device from
its IP address. Okay, we have discussed it already. What do we do in ARP? In
it already. What do we do in ARP? In
ARP, we broadcast. We broadcast that I know the IP address of yours but your MAC address is not known. So this packet will be sent to each and every router
present. Not the router but the host. So
present. Not the router but the host. So
this packet will be sent to each and every host there. host will match is this my IP then if it is not then it will ignore if it
is its IP then it will send the source IP or the source IP of the packet let's say the source IP is let's say 10 okay I'm keeping some random number so
what it will do it will attach its MAC address and it will keep the destination address as 10 this this packet was broadcasted
So the request is broadcasted and the reply is unicasted to the specific one who asked for the MAC address. Is this
clear? Let me write. Suppose
this guy wants to know the MAC address of this guy. So it will broadcast the packet into the network to all of them.
Okay. So
as you know in ARP IP address is also mentioned so that the one whose MAC address this guy want to know may know that someone is uh someone is desiring
to know my uh MAC address. So this
packet will be sent to all of them. Is
the IP getting matched? No, it will ignore the IP is getting matched. So it
will attach its MAC address and it will send or reply back to the requester.
Is this clear? So the request was broadcasted and the reply will be uniccasted.
This was ARP.
In ARP what do we do in ARP? With the help of IP address we
in ARP? With the help of IP address we find MAC address. RP is just the opposite. with the help of MAC address
opposite. with the help of MAC address we find the IP address is this clear okay so this was uh ARP RAP let's
discuss about an interesting protocol ICMP okay we have discussed about it before that whenever some error occurs or the router has some problem and
router have to report the problem to the sender then router uses ICMP package Okay, we have discussed this ICMP is used for
error reporting of messages. So error
reporting of the messages. So whenever
his datagramgram is discarded by some intermediate router, let's say here's router one, router two, router three. If
it is discarded by some intermediate router let's say for any reason let's say the check sum of is not matched or let's say
uh TTL field the TTL limit has reached then router will send the ICMP packet back to the sender to aware the sender that your packet has been uh discarded.
So this information is sent using ICMP and the direction of ICMP of for the ICMP is the direction of the packet movement for ICMP is from router
to sender or receiver to sender.
Okay. Sender do not send this to router or sender do not send it to receiver.
Either it is sent by the receiver or it is sent by the router. Router may send due to the TTL limit reached. receiver
may send it back due to the mismatch in the checksum calculated.
Okay, it is al also used for query messages.
For example, there are client and server and client want to know whether the server is live or not. Then it send message to the server. It is also used for
it's also used for eco request and reply. It is used for timestamping
reply. It is used for timestamping request and reply. So there are several uses of uh ICMP.
Okay. And one important factor is let's say if ICMP packet is discarded then there is no ICMP error message in response to the datagramgram carrying an
ICMP because if an ICMP is generated for ICMP and that ICMP is also discarded then another ICMP is generated. So in
this manner traffic or congestion is going to increase. So no ICMP error message generated. I can write no ICMP
message generated. I can write no ICMP message for generated for ICMP packet for the for the packet which is not the first
fragment. So I can write where more
fragment. So I can write where more fragment is or not the first fragment not the first fragment.
It is not generated for multiccast address packet. It is not generated for the
packet. It is not generated for the having special addresses like 1270.0 or 0.0.0.1 okay
or zero. So for special addresses for
or zero. So for special addresses for multiccast for the packet which is not the first fragment or for the ICMP packet itself no ICMP is generated.
Okay.
So whenever TTL limit is reached, the router will discard the packet and send an ICMP message to the source.
You know this is used for source quenching. What
is source quench message? Source quench
message is a request to decrease the traffic rate for the messages sending to the host. Or we can say that uh when
the host. Or we can say that uh when receiving host detect the rate of sending packet is too high is too fast then it send the source a source quench
message that the sender that you must stop or you must slow down the pace. I
am getting overwhelmed. Okay. So this is what a source quench message is.
Okay. If the check sum is not matched then we call it as parameter problem.
Then packet message is sent.
If the destination itself is unreachable, if the destination itself is unreachable, then also ICMP packet is sent.
Let's say for redirection that the packet is meant to be sent on some different route and it is present on some different route. Then the router will send the packet to the correct
route and will also notify the sender that your router uh will also notify the sender that your packet was on a different or the wrong route and I have
sent it to the correct route.
Is this clear?
And you know there is a very special use case of ICMP. If you think that suppose sender want to know that what
packet or what route does the packet has followed. So what sender can do? Sender
followed. So what sender can do? Sender
can send the set the TTL value as one.
What will happen as soon as it is it is uh encountered by the network layer of router. Network will network layer will
router. Network will network layer will decrease the TTL value to zero.
R1 is the first router. How center will know? because source IP will be
know? because source IP will be mentioned as R1. Destination IP will be mentioned as the sender itself. Okay.
Now what sender will do the next time it will set set the TTL value as two. What
will happen? Now
at R1 TTL value will be set to one and at R2 TTL value will be set to zero. Now
R2 will send the ICMP message source IP as R2 and the destination IP as sender.
So this time sender will know okay so first it goes to R1 and then to R2 then this time it will set the value to three.
So value become two here one here and zero here. So this time R3 will send
zero here. So this time R3 will send source IP will be of R3. Sender will
know that oh this time it was R3. So
this is how sender can record the route the packet is going to follow.
Is this clear?
Now let's discuss the OSI layer. OSI
layer. So initially we have application layer, presentation layer, session layer and then transport layer, network layer, data link layer and then physical layer.
These three layers application, presentation and session layer these are known as user support layers. This
mainly deal with the interoperate operatability that is the two different system can communicate. This deals with the user support layer deals with the
inter operability.
Okay. Transport layer is used as interface.
Interface links to subgroup. Links to subgroup.
this group and this group.
Network support layer. This is what network support layer is.
Network support layer and user support layer. User support layer. Okay. So this
layer. User support layer. Okay. So this
so this deal with the physical aspect physical aspect of moving data from one device to another.
Is this clear? Okay. So let's discuss what are the functions of physical layer. It is used for uh it is used for
layer. It is used for uh it is used for the topology responsible for the movement of individual bit from one host to the one hop to the next. It defines
topology. It's totally a hardware layer.
It defines encoding. Okay. It defines
the configuration. What about data link layer? It is it is used for flow
layer? It is it is used for flow control, error control, access control, physical addressing, the MAC.
Okay, we have discussed this. What about
network layer? It is used for host to host connectivity, logical addressing, switching routing fragmentation congestion control. Okay, what about
congestion control. Okay, what about transport layer? It is used for end to
transport layer? It is used for end to end connectivity. We have discussed
end connectivity. We have discussed about the ports here. Okay, flow
control, error control, reassembly, segmentation, congestion control. We
have discussed what were the congestion control policies there. Okay. Functions
of session layer. It is used to synchronize the sender and receiver.
Okay. It's like a network dialogue controller.
It also does authentication authorization.
Okay. Dialog control is basically the functionality of session layer. What
about presentation layer? Presentation
layer is like an advanced functionality layer. Okay. Character translation,
layer. Okay. Character translation,
encryption decryption compression.
This is done at presentation layer. And
what about application layer? It is
responsible for providing services to user like mail services, file sharing, file transfer and many more. We have
discussed this. I suggest you to watch a whiteboard drawing animated video of I think 17 minutes on the OSI. It's for
about 5 6 million views. You can watch it on YouTube. It will provide a complete functionality. It's a complete
complete functionality. It's a complete overview of how OSI layer work with synchronization with each other. How
they interact with each other. Okay. So
this you can watch the 17 minute video and from this you can uh assume that your computer networks is over. I have
given you the DPP. You can solve the reading material is already with you.
You can read. Okay. Then we will take three doubt class. We will address all the doubts. will address the PYQ. Okay.
the doubts. will address the PYQ. Okay.
Loading video analysis...