JNCIA Video 4: IPv4 and Subnetting

JNCIA Video 4: IPv4 and Subnetting



hello and welcome back in the last video we looked at layer 2 concepts in this video we are going to talk about IP version 4 addresses we'll take a look at the different classes of IP addresses and we also talked about RFC 1918 addresses will also practice decimal to binary conversion which will help us to understand subnet mask in a much more easier manner and then finally we'll practice subnetting let's begin IP version 4 addresses now before we talk about IP version 4 I want to take a moment and talk about the IP protocol itself IP stands for Internet Protocol it's the routing protocol of the internet IP is the protocol that routes your packets across all the routers in the world there's another important thing that you need to remember that things like guaranteed delivery guaranteed delivery of packets and packet sizing these kind of things are not taken care by IP that's the function of TCP protocol that works over IP now let's talk about IP version 4 when I heard about IP version 4 for the first time I was wondering what happened to versions 1 2 & 3 well the answer is versions 1 2 & 3 were not stable enough to be released the first stable release of the IP protocol was IP version 4 and that's why you don't have IP version 1 2 & 3 but only IP version 4 talking about IP version 4 addresses let's look at an example so we have this example IP address 192 160 and 1.1 every IP version 4 address is a 32-bit address if you ask how every group that you see here is called as an octet the reason they call it as an octet is because every group of numbers here can be represented in 8 binary bits that's 1 2 3 4 5 6 7 8 every number here can be represented in 8 binary bits that's why every number is actually called as an octet you have a total of 4 octet 8 bits per octet gives you a 32-bit binary value the maximum possible value for any octet is 255 so the highest possible value for an IP address is 255.255.255.0 5 how do you get to 5 5 when you put all ones in these binary bits you will get the value 2 5 5 each binary bit you see here represents a power of 2 starts from 2 power 0 and goes all the way up to 2 power 7 when you add all these powers of 2 you get the value 2 5 5 we're going to discuss more about decimal to binary in the later topic this is just for us to get started the total number of IP address is possible is to power 32 if you ask how every binary bit here can either be a 0 or a 1 that's the only two values possible for every binary bit which means there are two values 0 and 1 there are 32 bits 2 power 32 is the total number of possible IP addresses however not all of these IP addresses can be assigned to network devices there are certain restrictions which we are going to talk as we move along in this video let's move to the next topic which is classes of IP addresses there are five different classes of IP addresses the classes are a Class A Class B Class C Class D and Class E Class A a starts from 0.0.0.0 to 127 255.255.255.0 dot 0 dot 0 dot 0 cannot be assigned to any network device that's why you say that it's a theoretical value Class V starts from one 2800 at 0 all the way up to 191 255.255.255.192 0 at 0 at 0 all the way up to 223 255.255.255.0 use for assigning to network devices to computers classes D and E are reserved Class D starts from 220 4.0 0.0 to 239 dot 255 dot 255 dot 255 purposes Class D is mainly used by routing protocols for sending routing updates Class E the last one starts from 240 to 0 at 0 all the way up to the highest possible value which is 255.255.255.0 5 5 Class E is reserved for experimental purposes that's about the five different classes of IP addresses it is always a good idea to remember the ranges of these classes of IP addresses not just from an examination standpoint but also because being a network engineer it's really important that you know the basics like classes in RFC 1918 addresses let's dive into RFC 1918 addresses RFC 1918 addresses RFC 1918 talks about private IP addresses now what do we mean by this term private ip's private ip's are those IP addresses which are free to use which means you don't have to pay for or you don't have to register with your service provider to use these addresses what's the benefit of using a private IP well the number one benefit is that it is free and you don't have to register that's number one number two it helps to conserve the public IP address space it helps to conserve public IP s if you ask how let's say you have a land that has ten computers and each of these computers needs to have access to the Internet now if we did not have private IP address we would have to assign public IP addresses to each of these computers to get on the internet but now since we have private IPS we can assign a private IP to each of these computers and then we can map all these private IPs to one single public IP address and then we can go out to the Internet isn't that really fantastic so many computers having just one public IP address instead of having so many public IP addresses we use just one public IP address this mechanism is called as never God rest translation that you don't need to worry about the specifics of that because we're gonna discuss that in a future course but the point I'm trying to convey is that private IPs help to conserve the public IP address space having said that let's look at the ranges of private IP in each of the classes a B and C we have a range of addresses that has been reserved for private IPs the first one is 10.0.0.0 / 8 and the full range of this would be 10000 all the way up to 10 dot 255.255.255.192 – 16 0.0 / so it starts from 172 16 dot 0 dot 0 all the way up to 172 31 255 255 and this is from Class B the third one is 192 168 0 dot 0 / 16 the range would be 192 168 0.02 192 168 255 255 and this is from Class C it's a good idea to remember these ranges of addresses don't worry if you don't understand how these values translate to these ranges because we're going to understand this in the next topic which is subnetting and subnet mask if that's all about RFC 1918 addresses before we move into the next topic I want to talk about another range of addresses that is reserved and that's called as loopback addresses loopback addresses the range of this address is 127 dot 0 dot 0 dot 0 / 8 which means it starts from 127 0 dot 0 dot 1 all the way up to 127 that 255.255.255.0 served for loopback communication what do you mean by loopback communication communication to itself is called as loopback communication a computer would use this IP address when it wants to communicate with itself for example one application on the computer is trying to talk to another application on the same computer it would use the loopback address we can even test this by going to command prompt go to command prompt and you can try to ping the address 127 dot 0 dot 0 dot 1 and you are sure to get a reply because the computer is trying to ping itself in fact you can do the ping on any of the IP addresses in this entire range the last address is the broadcast address we can try the last usable address which would be 1:27 255.255.255.0 back communication don't get confused it does not belong to RFC 1918 addresses that's all about RFC 1918 addresses and loopback addresses let's now dive into decimal to binary conversion decimal to binary conversion there's a few different ways to convert decimal values to binary values I'm going to show you the method that I use and I personally find it to be very simple so let's start I hope you have a pen and a paper handy if you do not have one I strongly encourage you to get a pen and a paper so you and I can practice decimal to binary conversion the first example is convert 16 to binary to convert 16 to binary we first write the number and then draw a couple of lines the first line is vertical the second line is horizontal and then we start dividing the number by 2 how many times 2 is 16 8 times 2 is 16 and the remainder is 0 continue doing the same how many times 2 is 8 2 fours are 8 the remainder is 0 how many times 2 is 4 2 2 s are 4 with a remainder of 0 how many times 2 is 2 2 1 the 2 remainder 0 now don't stop here we have to do this one more time two zeros are 0 with a remainder of 1 you stop when you have a quotient of 0 and a remainder of 1 that's when you stop division and then your answer will be in this direction so the answer is 1 followed by 4 zeros 0 0 0 0 that's 16 in binary if we want to verify this we can align the bits against the powers of 2 so let's align the bits 0 0 excuse me 0 0 0 1 and then you add the powers of 2 corresponding to the ones in this case we we have one one and the power of two corresponding to that is 16 and that you answer so we've converted 16 to binary and we verified that the answer is correct let's look at one more example convert 63 to binary start by writing the number and drawing a couple of lines vertical and horizontal and start dividing by two to thirty ones are 62 the remainder is 1 to 15 are 30 the remainder is 1 to 7.14 remainder is one two threes are six remainder is 1 2 ones are two and the remainder is one don't stop yet two zeros are zero and the remainder is 1 when you have a quotient of 0 and a remainder of 1 that's when you stop and you get the answer in the reverse direction so that's 1 1 1 1 1 1 that's 63 in binary let's verify that quickly let's align these digits against the powers of 2 that's 1 1 1 and then you add the powers of 2 corresponding to the 1 so that would be 32 plus 16 plus 8 plus 4 plus 2 plus 1 which definitely is 63 isn't that really simple and fun converting decimal to binary I hope you enjoyed this now before we move to the next topic which is subnet mask I want you to practice a couple of more examples the first one is try converting 34 into binary the next one is 96 finish practicing this and then we'll move on to the next topic which is subnet mask subnet mask every IP address can be divided into two parts when we talk about any IP address it contains two important pieces of information number one is the network address or the network portion and number two is the host portion talking about this IP address 10.0.0.0 slash eight one part of the IP address is what we call as the network address or the network portion the other part is the host address or the host portion but how do we know which part of the IP address is the network address and which part is actually the host address that's where subnet mask comes into picture subnet mask is the 32 bit value that will help you to deter mind the network portion and the host portion in an IP address imagine this you have your home address your home address has the street name along with the house number in a similar fashion every IP address has a network address which the router will use to forward the packets the router forwards the packet to that network address and then there's the host address portion which tells the router which hosts on that network does the packet belong to so that's the role played by the subnet mask every IP address has to be accompanied with a subnet mask any IP address without a seven mask that is of no use my friend remember this it's a very important concept talking about the same IP address here again let me put that again 10.000 slash eight now slash eight is what is the subnet mask the number eight that you see here is the number of ones inside a subnet mask remember we said a subnet mask is a 32-bit number just like an IP address after 32 bits the first eight bits are occupied by once the remaining 24 bits is the zeros so if we were to write the subnet mask in binary format this is how it would look the first eight bits are zeros I'm sorry are ones and then you have 24 ones and the last – octet so I'm just gonna put them as zeros excuse me so you can see the first eight bits is what we call the slash eight this is the binary representation of the subnet mask if you were to convert this binary representation into a decimal representation this would look like 255.0.0.0 if you asked how you place this ones against the powers of two these are the first eight powers of two starting from two power 0 to 2 power 7 add the powers of 2 corresponding to the ones and you get the value of 255 that's how you get this value here 255.0.0.0 so 10.0.0.0 / 8 is the same as writing it like this is equal to 10000 255 that's you're at 0 0 the ones in a subnet mask is what is called as the network portion the zeros in a subnet mask is what is called as the host portion so the ones will give you the network address the zeros will give you the host address remember this my friend so in this example 10.000 slash a the first eight bits represent the ones which is the network address the first eight bits is the first octet so your network address is this portion and this portion is your host address another important thing to remember is in a subnet mask in a binary representation of a subnet mask the ones and zeros will always be continuous as you can see here there's a continuous series of ones and then you have a continuous series of zeros that's how it will always be there can never be a subnet mask like this one zero one one zero this can never happen the ones have to be continuous followed by a continuous series of zeros apart from this every class of IP address Class A Class B and Class C has a default subnet mask let's take a look at it for a moment Class A has a default subnet mask off slash eight which means by default a Class A address has the first eight bits reserved for network bits or the network address Class B has a default subnet mask off slash 16 an example would be 170 2.16 dot 0 dot 0 slash 16 if you were to convert this into decimal format the segment mask in decimal format would look like 255.255.0.0 because the first 8 bits will give you this 255 the second 8 bitch will give you this 2 5 5 and then 16 zeros will give you 2 octaves of zeros classy IP addresses have a default subnet mask of slash 24 which means the first 24 bits are reserved for network addresses an example of a classy address would be 192 168 1 dot 0 slash 24 the decimal subnet mask for this would look like 255.255.255.0 another important thing to remember is on any network if you want to find the total number of host address as possible the formula for that would be 2 power H to power age we'll give you the number of host addresses possible on any network let's take an example of a Class C Network 192 168 1 0/24 so the first 24 bits of reserved for networks in the last eight bits excuse me the last eight bits is what is for the host address if you want to find out the total number of host addresses possible that would be 2 power 8 which is two five six that's the total number of host addresses possible but there's one more important thing to remember the first address in a network is what is called as the network address network address that's the first address the last address of any network is the broadcast address these two addresses cannot be assigned to any network device the first address network address the last address broadcast address if we were to take the same example here if we were to take this example the first address would be 192 168 at 1.0 that's the network address the last address would be 192 168 that 1.25 5 that's the broadcast address so these two addresses cannot be assigned hence the total number of usable host addresses would be 2 power H minus su which is 256 minus 2 will give you 254 useable host addresses remember the total number of host addresses is 2 power age but two addresses out of them cannot be used so the total number of usable host addresses will be 2 power age minus 2 that's about subnet mask let's dive into subnetting subnetting before we start subnetting or before we start practicing subnetting I would encourage you to get a pen and a paper so you and I can do subnetting at the same time it's going to be really exciting it's going to be a lot of fun we are going to practice a lot of examples so go ahead pause the video get a pen and a paper and we'll begin all right I hope you're back with a pen and a paper let's now talk about subnetting let's talk for a moment and understand why we need subnetting to understand the need for subnetting let's talk about a Class A IP address which is 10.0.0.0 slash eight now let's just assume for a moment that this is a public IP address I know you must be saying hey that's a private IP address yes that's a private IP address but just for the simplicity of this discussion let's say 10.000 slash eight is a public IP address and our organization has been given this public IP address in the last topic we learned that the total number of host addresses possible would be to power age in this case that would be to power 24 because out of the 32 bits the first eight bits are taken up for network so the last 24 bits can be used for host addresses which is 16 triple 7 to 1 6 you remove the network address in the broadcast address and you're still left with 16 triple 7 2 1 4 can you imagine that so many host addresses on a single network if you are a network administrator for such a large network that would be a nightmare for you so many host addresses to manage so much of broadcast traffic it's going to be unmanageable that's reason number one to make networks more manageable we need to divide them into smaller networks let's look at another example let's say we have two routers this is router 1 and this is router 2 and we have a point-to-point link between these two routers we need to assign IP addresses to this point point link which is here and here so we need two IP addresses for this point point link the class of IP addresses with the smallest number of host addresses is Class C because it has a slash 24 subnet mask let's assume we've been given a Class C IP address for this point point link the total number of host addresses or useable addresses would be 2 power 8 minus 2 which is 254 addresses can you imagine that 254 addresses just for this single point to point link we are going to use only two addresses and 252 addresses are going to be wasted that's reason number 2 to prevent the wastage of public IP addresses or to efficiently utilize the public IP address space those are the two main reasons for us to get into subnetting let's look at an example so let's say we have an organization that has been given a Class C IP address 192 168 1 dot 0 slash 24 that's the only network address that we have been given and our organization has five departments we have been told to put these departments on different networks which means we need five different network addresses or five different networks for this department and we have only one address to play with 192 168 1.0 so our task is to divide this address into five networks now subnetting is a very very simple topic my friend there's only four simple steps for subnetting let's look at them one by one the first one says convert your subnet mask into binary format the subnet mask that we've been given is slash 24 converting into binary format will make it look like this that's the first octet that's the second octet that's the third octet and that's the fourth octet the first 24 bits have been taken up by network so we so we wrote down 24 ones followed by eight host bits or eight zeros all right so that's the first step the second step says they remind the number of host bits to be borrowed now why do we need to borrow host bits we only have one network address and we want to convert this one network address into five network addresses out of the 32 bits the first 24 bits are already fixed we can't touch them so we only have these 8 bits to play with so we need to borrow some host bits from here and convert them into Network bits in order to get more networks but how many bits do we borrow is the question and that's where this formula is going to help us to power X is greater than or equal to the required number of subnets X is the value that we need to find out in our case to power X will be greater than or equal to the required number of subnets is five what is the value of X that will give you this answer let's say X is equal to zero in that case we are going to get a value of 2 power 0 which is 1 that's not what we want X is equal to 1 will give you 2 power 1 which is 2 that is certainly not greater than or equal to 5 X is equal to 2 will give you a value of 4 which is again not greater than or equal to 5 X is equal to 3 will give you a value of 8 which is definitely greater than or equal to 5 so the value of x is 3 2 power 3 is 8 so we need to borrow 3 bits from the existing host bits so we have this eight host bits here we are going to borrow three bits out of them so we're going to convert the subnet mask into something like this you have the eight bits out of which three bits have been converted into host bits excuse me the three bits have been converted into Network bits by changing the zeros into ones that's going to be your new subnet mask my friend your slash 24 your slash 24 will now become slash twenty seven twenty four plus three bits slash twenty seven that's your new subnet mask the deal subnet mask and decimal format will look like this let me just clear the board let's align the last octet against the powers of two we have three ones followed by five zeros so we need to add the first three powers of two 128 plus 64 plus 32 that's going to give you 224 so your new subnet mask would be 192 168 not 1.0 255.255.255.0 new subnet mask or you can also write it as slash 27 you see how interesting this whole thing is we completely changed a subnet mask to get more networks isn't that fantastic let's continue we've not finished yet the third step says did remind the increment now what is the increment your first network address is 192 168 1.0 we need to find out the increment value which will be added to the original network address to give you more Network addresses I know that may not make too much of sense right now but let's just complete step number three and it's going to be more clear for you so let's focus on determining the increment how do you find the increment the increment value is the power of two corresponding to the least significant bit now what do you mean by least significant bit it means the right most bit so you need to find the power of two corresponding to the right most Network bit the rightmost Network bit is this one and the power of two corresponding to the rightmost Network bit is 32 that is going to be your increment so now we know the increment which is 32 now the final step is ad increment to get the new subnet let me completely clear the board now we have the increment is equal to 32 we have the original Network address 192 168 dot 1.0 the last step says add the increment to get the new subnet now where are you going to add the increment you need to add the increment in the octet from where you borrowed the bits that is your fourth octet you borrowed bits from the fourth octet so you're going to add increment in the fourth octet add 32 to this IP address you get 192 168 that 1.32 that's your new network address continue doing that you get 192 168 then 1.64 and then you get 192 168 not 1 not 96 and then you'll get 1.1 28 and then you'll get one dot one sixty one dot 192 how many subnets is that that's one two three four five six seven you're going to get one more subnet because the total number of new subnets will always be equal to the power of two here the power of 2 is 2 power 3 is equal to 8 which means you're going to get 8 total new subnets this is 7 you're gonna get one more at 32 192 and you will get 1.2 28 if I'm correct + 32 4 all right that's 2 24 – 24 so those are the new 8 subnets the total number of new subnets will always be a power of 2 we got 8 subnets which definitely covers 5 subnets we only need 5 subnets we only use 5 subnets and we keep this for future purposes that's all about submitting my friend very simple just a four step process just a quick recap we started by converting the subnet mask into binary format and then we decided to borrow some bits from the host portion so that we get some additional networks to find out how many bits to borrow we use the formula to power X is greater than or equal to required number of subnets here the required number of subnets is five the value of x gives us 2 power 3 is equal to 8 which is definitely greater than or equal to 5 so we fix 3 as the number of bits to be borrowed we then found out the increment the increment is the power of 2 corresponding to the least significant bit the least significant bit is the rightmost bit so we align the last octet against the powers of 2 and we got the value 32 as the increment to get the new subnet in the last step we added the increment to the original network address 192 168 1.0 and we got eight new subnets that's all about subnetting my friend isn't that fantastic we just took one network address and we converted them into five network addresses that's efficient utilization of IP addresses and that makes the network so much more manageable this is just one example of subnetting we are going to look at more examples of subnetting and some of the types of subnetting as well in the next video so just to do a quick recap in this video we looked at ipv4 we looked at IP addresses we looked at classes of IP addresses we also talked about RFC 1918 addresses and then we talked about the loopback address we talked about 17 masks and finally we also touched upon subnetting in the next video we are going to continue to focus on subnetting I hope this video was very useful to you I'm really excited to see you in the next video and I'd like to thank you for watching

Leave a Reply

Your email address will not be published. Required fields are marked *