Transcript for:
Understanding Classful Addressing for IP

Hello friends, welcome to engineering funda family. In this video, I'll be going to explain you class full addressing of IP addresses. And before we start with this session, let us see how many things that I'm going to cover in this video. So first of all, I'll be explaining you how many basics are there with IP addresses. Then I'll explain you class full addressing of IP addresses, where we are having five classes class A, class B, class C, class D and class E. And after watching this, you will be having exact clarity regarding how all those classes are defined and how we can identify which IP address belongs to which class. After that, I'll explain you some interesting fundamentals in which I'll explain you how many number of hosts that is given in this given class of network. And along with that, I'll explain you how we can have network IP and for that network IP, what will be broadcast IP address. And then I'll explain you how we can have unicasting. and broadcasting and that I'll explain you by practical examples. So let us see first how many basics are there with IP addresses. So in basics of IP addresses, I'll be discussing about IPv4 addresses. Here basically two types of IP addresses are there. One is IPv4 and second is IPv6. I'll be discussing about IPv4 addresses in this video. See in IPv4 representation, it is having size of 32 bits. and it is represented as per 8 bits dot 8 bits dot 8 bits dot 8 bits 8 bits means one byte or you can say one octave so four octaves are there and that representation as per octave dot octave dot octave dot octave that is how it is there right and you should know 8 bit is having how much size 2 to the power 8 means 256 so it is having range from 0 to 255 256 means range is there from 0 to 255. So, IPv4 IP address range that is there as per to 255.255.255.255. And see IP addresses that is organized as per hierarchical structure. In my previous video also I have discussed, right, like why do we need to have logical addressing? The reason is logical addressing is done with the use of IP address and IP addresses that is having hierarchical structure like you see it is defined as per class and after class you need to go for network id from network id you need to go for host id so whenever routing happens at that time it will be having hierarchical structure like when we say we want to send something with respect to country then after country there will be state then city then street then society and then your home number will come right so likewise In IP address, there is a hierarchy, like there will be one class. After class, you will have to see what is network ID. After network ID, you will have to see how host ID is there. Right. So that is how hierarchical structure is there. So that hierarchical structure that I'm going to explain you by complete details along with classes. So let us see classful addressing of IP addresses. So in classful addressing of IP addresses, basically we are having five classes. Class A, Class B, Class C, Class D and Class E. First of all, I'll explain you how we can remember those classes. The reason is you'll have to understand that with respect to how IPs are there, as well as in examination, you will have to remember like how those IPs are organized. So it is quite simple. You see, total bits are 32. And that is there as per one octave dot one octave dot one octave dot one octave. In total, four octaves are there, right? So here with class A. first bit will be 0 with class B first 2 bits that will be 1 0 with class C first 3 bits that will be 1 1 0 with class D first 4 bits that will be 1 1 1 0 and with class E first 4 bits that is 1 1 1 1 see that is how bit pattern is there after that you will have to remember few basic things only like network ID with class A that is there up to first octave with class B network id is there up to second octave with class c network id is there up to third octave and with class d and class e we are not having network id and host id right with class d we are having multicast address and class e that is reserved for future as well as for research now you need to understand this also with class a how many host ids are there so that is there as per three octaves So last three octaves that is there with host ID for class A. with class B last two octaves that is therefore host id and with class C last one octave that is therefore host id see this is how you can remember all the classes now let us discuss about how many basics are there with all the classes like you see here with class a first bit first bit that is zero and then network id is having 7 bits and then host id that will be having 3 octaves means 24 bits right with class B first two bits first two bits that is 1 0 and then up to second octave network id is there so two octave is having 16 bits so 16 minus 2 that will be 14 bits with network id with class B and host id is having two octaves means 16 bits with class C first three bits that is 1 1 0 then up to third octave network id is there so 24 minus 3 that will be 21 bits of network id right and host id that is having one octave only so 8 bits with class d in total 32 bits are there out of that 4 bits that is 1 1 1 0 those are first 4 bits and then multicast address that will be having how many bits 32 minus 4 that is 28 bits right and similarly with class e first 4 bits right and reserved bits for future that is having size of 28 bits see this is how number of bits that you can understand now there are a few basic things that i would like to discuss about each and every class right like when you talk about class a then network id is having how much size you see seven bits right and first bit is always zero so what should be the range of class a zero then all seven zeros After that 0 then all 7 ones. So all 0 means 0. And 0 and then 7 ones means 127. So class A that is having first octave that represents what? Network ID. Right. And it is having minimum value 1. Why? The reason is all 0s are reserved. That is not given to any network. and all ones of network id that is also resolved that is also not given to anyone so instead of range that is there from 0 to 127 it is there from 1 to 126 right 127 that is resolved and by this pink color i am showing you this octave as per network id you see network id is there for first octave so first octave that is there from 1 to 126 with class a In some books, it may be written as per 127, but remember 127 that is resolved, that is not given to any network ID. Now, when you say how many network IDs are there with class A, so this is how you should remember. See, 2 to the power 7 minus 2, so that is 120, 126. 2 to the power 7, that is 128, minus 2, that is 126. So, with class A, total network IDs. Those are 126. Now let us see what is there with class B. See in class B, first two bits, that is one zero. So obviously, with this network ID range will be from 14 zeros to 14 ones, right? I'm not writing it over here. You just understand that, right? And as if one zero and after that all zeros are there, then obviously, what is that value for first octave one and then seven zeros. that will be 128. So first octave that is 128. But remember, with class B second octave that is also belong to network ID. So I am just marking it over here. So initial value that will be having range from right? And final value will be there from first two bits 10 and then all ones are there. What it means? It will be 191. Then So 255 right and then dot 255 dot 255 but you see this 255s that belongs to this 255 that belongs to host id right so here as if question is how many network id is there with class b then you can say it is 2 to the power 14 right it is 2 to the power 14 now with class c if you observe first three bits that is 110 so obviously network id that is there up to third oct So based on that, you can say based on that first three octaves that belongs to network ID and last octave that belongs to host ID. Right. So here what will be the range? See double one zero and then five zeros are there with first octave. So that is 192. Right. And then zero dot zero. See this three octaves that belongs to network ID over here. And last zero that is there with respect to host ID. Right. And it is ranging from one one zero to all ones. Right. Up to all ones it is ranging. So that will be 223.255.255 that belongs to network ID and last 255 that belongs to host ID. So obviously here how many host IDs are possible with given network 2 to the power 8. Now with class D, with class D first 4 bits that is fix 1110. And then multicast address bits will be there. It is having range from. 224 to 239 and here with class e it is having first four bits that is 111 so it will be having range from 240 to 255. now i am not going to write all the network ips over here with respect to bits why the reason is what i want is you just remember this you just remember this ip addresses with respect to class a b c d e see here simply this is how you can remember for class a it ranges from 1 to 127 in some books it is written up to 127 but 127 is resolved so with class a 1 to 127 this first first octave that will tells everything second octave will be 128 to 191 third of then class b is having 192 to 223 with class d 224 to 239 with class e 242 255 that is about first octave and you should know with class a first octave only belongs to network id with class b first and second octave that belongs to network id with class c first second and third octave that belongs to network i ip network id right or you can say network ip so here see this is how we can remember all the classes right And here this is what you will have to remember. The reason is as being a computer science engineer, you will be finding many equations in many ways. So it is not like you will be calculating all those things as per this format. Directly you should know like if it is having first octave that is there in between 1 to 127, then you can say it is there with respect to class A. If it is there in between 128 to 191, you can say it is there with respect to class B. If it is there in between 192 to 223, then it is there with respect to class C. if it is there in between 224 to 239 then it is there with respect to class d if it is there from 240 to 255 then it is there with respect to class e that is how you should remember and see with class a first octave that belongs to network id or network ip with class b first and second octave that belongs to network id or network ip and with class c first second and third octave that belongs to network ip This is how you will have to remember the things. Now very interesting part that I'm going to explain you now. So in that I'll explain you how many number of hosts that is there in given class of network as well as two very interesting things that I'm going to explain you. First is what is network IP and second is what is broadcast IP. So with class A we have seen first bit will be 0 and it is having IP address range from to 127.255.255.255 right but when it comes to network ip when it comes to network ip then there are few basic things that you should know in network ip in network ip first first byte or you can say first octave that belongs to that belongs to network id right so here let me say let me say it is 91 right So first 91 that you will have to write, then dot 0 dot 0 dot 0. See this 0 dot 0 dot 0, right? That you will have to keep for network IP. So every network is having network IP, right? So see network ID that is been defined by first two, first octave, right? With class B, with class B, first two octaves, right? That is there for network ID, right? So, as if I say I want to have one network IP for class B, then first octave that should be there in between 128 to 191 right so let us say it is 155. so 155.4 see this is what network id for class b then dot 0 dot 0 that you'll have to place for network ip like with class c with class c what is the range 192 to 223 so when you talk about network ip let us say one example then you will have to take three octaves for network id so you see this three octaves right that belongs to that belongs to network id so here in network id you see you can have in between 192 to 223 so let us say i'm taking 201 then dot pi then dot four so this is what network id but dot zero that represents network ip right So that is how network IP will be there. So remember here with class A, last three bits, that should be zero for network IP. With class B, last two octaves, that should be zero. And with class C, last one octave, that should be zero, right? So that is how network IP will be there with different class. This is just example. You can have any network IP, right? Now, let me... take one another case which is broadcast ip right which is broadcast ip so with this given network ip what will be broadcast ip so 91 dot 255 dot 255 dot 255 right see this is what broadcast ip for this given network when you say class b with that as if you wanted to have broadcast ip then what is that broadcast ip this one 55.4 that will be as it is then last two that should be 255.255 right that will be broadcast ip of this given network when it comes to class c then what is the broadcast ip broadcast ip for this that will be this will be as it is for network id it will be as it is right 201.5.4 but last should be 255. so see network IP and broadcast IP that cannot be given to host. Remember this. As if with class A, last three octaves are 0, then it is network IP. If last three octaves are 255, then that is broadcast IP. With class B, if last two octaves are 0, that is network IP. With class B, if last two octaves are 255, then that will be broadcast IP. With class C, if last octaves are 0, then that that is zero then that is network IP with class C if last octave that is 255 then that will be broadcast type right now now I'll explain you how many hosts that can be there with given network IP so number of hosts number of hosts with class A that can be based on this many bits right so here we are having three octaves so two to the power three octaves is having how many bits 24 so 2 to the power 24 host but see out of 2 to the power 24 two ips are resolved one is for network ip and second is for broadcast type right so minus 2 that you'll have to do that will be number of post in given network ip right now as if question is how many hosts how many hosts are there in class b then in class b how many hosts are possible so host is having how many octaves two octaves with class b so two octaves means two to the power 16 hosts will be there but out of that two ips that is reserved for network ip and broadcast ip so 2 to the power 16 minus 2 right when it comes to class c how many hosts are there so number of hosts that is based on one octave of host id over here so that will be 2 to the power 8 minus 2 right so that is our number of hosts that we can identify for given class IP, like one network is having how many hosts that can be calculated as per this. So you should be having fair enough idea about for any given network, there will be one network IP, and there will be one broadcast IP. And those two IP addresses cannot be given to host, right? So how many hosts will be there. So with class A, we are having three octaves per host ID. So 2 to the power 24 minus with class B with given network. two octaves are there with the host id so 2 to the power 16 minus 2. with class c we are having one octave for post so 2 to the power 8 minus 2 right so how it is coming based on network ip and broadcast type right so now i think you are having exact clarity regarding how classes are there right so this is how classes are there right these are the basics that you need to understand right and based on that now i'll give you few very practical case studies like how we can have unicasting and broadcasting so in unicasting First of all, you should be having basic understanding like what is unicasting. See, unicast means one to one message forwarding. So using IP of node, unicasting can be done. Let me take one example. Like here we are having one network and this is second network. Let us say this one network that is having one node over here and we are having second node over here. And we wanted to have transmission of data from one to two. Then how this node number one will. forward data to node number two so that will be done with the usage of ip of node one now what could be the ip ip of node one means ip of host so that depends on network id now here i have taken example of class a in which class a is having class a is having first octave that represents network and last three represents last three represents host but zero zero zero means this is network ID or network I right so let us say this host number one let us say this host number one is having IP that is 85 as per network ID then let us say it is 5.4.1 so that can be that can be host ID in this given network right with host one Now, similarly, as this host one is having this ID with host two, it will be having ID based on based on ID and network IP of this network two. So you see this is what class B type of this is what class B type of network. How we can identify that? You see first byte that is 145. So that belongs to 128 to 192 means you can say this is class B type of network. And first two octaves that represents network ID. After that you see 00 is there. Means this is network ID of given network. Now with host 2, what can be IP? So first two bytes that will be as it is. 145.255. But last two octaves that can be anything. Like 1.4. Right. So that is how host 2. IP is there. Now simply when this host1 wants to forward data to this host2, then this host will be placing IP address, host1 will be placing IP address of source and destination and based on that with this router, with this router it will forward data and this router, this router belongs to network1, so it will be having network ID of this. And this router that belongs to class B with this network, right? So that will be having this ID. So first of all, it will take this message over here. And after that, based on host ID, it will forward it in this network, right? So one-to-one unicasting, that is how it is happening. So based on network ID and network, based on network ID means network ID will define network IP, right? As in class A, first byte that defines network ID. And based on that network IP will be there. In network IP, there will be With class B, first two octaves will define network ID. And based on that network IP will be there in which last two octaves will be 0.0. Right. Now, let me explain you broadcast. Broadcast is quite interesting. See, there are two categories of broadcast. Limited and direct. So, in limited broadcast. in limited broadcast what we need to do is in limited broadcast we can broadcast in given network for example as if this node as if i say this node wants to broadcast message right this node wants to broadcast message then this node will have to use this ip if this node is using 255.255.255.255 then you can say this node is broadcasting message in this network. So in this entire network, network one, it will be broadcasting message that is limited broadcast. Right now, now as if we want to do direct broadcast, then see direct broadcast can be done from one network to another. For example, for example, as if I say here we are having one node. Now if this node wants to do broadcast in this network, then this node will do what this node will use IP of this network. So. as if this node wants to broadcast message everywhere over here right then this node will be using which i ip of this network see first will be network id that is 85 then dot 255.255.255 see this is what broadcast ip for this network so this node will be using this ip address and when it forwards this frame via this router to this router this router will broadcast this message in this internet right similarly as if this node wants to broadcast message in this enter network then it will be using see this class b type of network in which 145.25.255.255 that ip that will be used by any of this node to broadcast message in this network simply this is how we are doing broadcast Now I think you are having fair enough idea about how IP addresses are there, how classful addressing is happening. And if still anything that you like to share, please note it down and we are doing so much hard work. So I would like to have your support and for that I request you to do sharing of these videos with your colleagues. Definitely that will help us even. Thank you so much for watching.