Welcome to Jeremy’s IT Lab. This is a free, complete course for the CCNA 200-301. If you like these videos, please subscribe to follow along with the series. Also, please like and leave a comment, and share the video to help spread this free series of videos. Thanks for your help. Also, remember to download and use the Anki flashcards with the link in the description, which will help you very much in remembering what you have learned. Let’s get started. This is the 7th lecture in the series. In the past couple videos we talked about Ethernet LAN switching, for example within this small network of PCs, attached to a switch. In this video, however, we’ll start to expand our horizon, and take a look at how traffic is forwarded not WITHIN a LAN, but between different LANs. Basically, we are going up the OSI model from Layer 2, the data link layer, to Layer 3, the network layer. Let’s do a quick review of Layer 3. This slide is from Day 3’s video on the OSI model. Let’s review some characteristics of Layer 3, the Network layer. The network layer provides connectivity between end hosts on DIFFERENT networks, outside of the local area network. Layer 3 provides logical addressing, specifically IP addresses. Where Layer 2 uses MAC addresses, which are assigned to the device when it is made, IP addresses are logical addresses you assign when you configure the device. Layer 3 provides path selection between source and destination. Over larger, more complex networks, for example the Internet, there can be many different possible paths to a destination. Selecting the best path to the destination is part of Layer 3’s functionality. Routers operate at Layer 3. So far in this course we haven’t talked much about routers. That’s going to change over these next few videos, however, as we talk about Layer 3. In this video, our focus will be specifically on the logical Layer 3 addresses, IP addresses. You may recognize this network from the previous videos on Ethernet LAN switching. These PCs are all connected by switches, so they are part of the same network. These Layer 2 devices, switches, do not separate different networks. They connect and expand networks. I could connect two more switches, each with multiple PCs connected to them, to this network, and it would still be one network, one LAN. Because of this, the PCs all have IP addresses in the same Layer 3 network, 192.168.1.0/24. PC1’s IP address is 192.168.1.1, PC2’s IP address is 192.168.1.2, PC3’s IP address is 192.168.1.3, and PC4’s IP address is 192.168.1.4. If PC1 sends a broadcast frame with a destination MAC address of all Fs, After SW1 receives the frame, it will broadcast it out all of its interfaces except the one it was received on, so that means G0/1 and G0/2. SW2 will then do the same with the frame, broadcasting it out of all of its interfaces, except the one it was received on. so that means G0/0 and G0/1. As you can see, all other PCs in the network have received the frame. Now, what if I put a router between SW1 and SW2? Now I’ve put R1 in between the two switches. Now instead of one network, the PCs have been split into two networks. Let’s say SW1, PC1, and PC2 are still on the 192.168.1.0/24 network, but now SW2, PC3 and PC4 are on the 192.168.2.0/24 network, with PC3 being 192.168.2.1 and PC4 being 192.168.2.2. You may have noticed that, in these network IP addresses, the first three groups of numbers, 192.168.1, and 192.168.2, represent the network itself, and only this last 0 changes to represent the end hosts on the network, the PCs. You may also have wondered what these /24s mean at the end. Actually, they are used to tell what part of the address represents the network, and which part represents the end hosts, the PCs. /24 means that the first 3 groups of numbers represent the network. In this video I’m going to go in depth about how these IP addresses work. But first, there’s one more thing missing in this network diagram. The router needs an IP address. Actually, not just one IP address, it needs an IP address for each network it is connected to. So, let’s give R1’s G0/0 interface an IP address of 192.168.1.254, and it’s G0/1 interface an IP address of 192.168.2.254. This time, if R1 sends a frame to the broadcast MAC address of all Fs, SW1 will receive the frame, and it will forward it out of all of interfaces except the one the frame was received on. So, it sends the frame out of G0/1 and G0/2, and PC2 and R1 receive the frame. However, that’s where it ends. The broadcast is limited to the local network, it doesn’t cross the router and go to SW2, PC3, and PC4. I’ll go more into detail about routing and Layer 3 forwarding, but as I said, this video will focus on IP addresses themselves, so let’s take a look. This is a chart from Wikipedia showing the IP version 4 header. IP, or Internet protocol, is the primary layer 3 protocol in use today, and version 4 is the version in use in most networks. As you can see, there are a lot of different fields in the IPv4 header, more than in the Ethernet header. We’ll talk more about the IPv4 header in another video, so today let’s look at these two fields, the source IP address and destination IP address. These fields are both 32-bits in length, as you can see they stretch from 0 to 31 in this chart. So, IP addresses are 32-bits, or 4 bytes, in length. Let’s take a look at this IPv4 address, 192.168.1.254. An IPv4 address is 32 bits long, so each of these four groups of numbers represents 8 bits. 192 represents 8 bits, 168 represents 8 bits, 1 represents 8 bits, and 254 also represents 8 bits. If we write these 8 bits out as 1s and 0s, 192 is 11 00 00 00, 168 is 10 10 10 00, 1 is 00 00 00 01, and 254 is 11 11 11 10. This way of writing numbers using just 0s and 1s is called binary. However, binary is difficult to read and understand for us humans, so IP addresses are written using what’s called dotted decimal, because there are four decimal numbers, 192, 168, 1, and 254, separated by dots, or periods. Let’s spend some time learning about binary, which is important to understand IPv4 addresses. Before looking at binary, let’s review decimal and hexadecimal. In decimal, also known as base 10, each digit increases by a factor of 10. For example, this number 3294 consists of 1 unit of 4, 9 units of 10, 2 units of 100, and 3 units of 1000. Notice that they increase by a factor of 10. 1 x 10 is 10. 10 x 10 is 100. 100 x 10 is 1000, and next would be 1000 x 10, which is ten thousand. Now, let’s look at this number in hexadecimal. Decimal 3294 is written in hexadecimal as C D E. How does that work? Well, the first digit represents 1s, so this is E times 1, and E = 14, so that equals 14. The next digit increases by a factor of 16, and 1 * 16 is 16 of course, so this is D times 16, and D in hexadecimal is equal to 13, making this equal to decimal 208. Finally, the next digit increases by a factor of 16 once again, and 16 times 16 is equal to 256, so this is C times 256. In hexadecimal, C is equal to 12, so this is equal to decimal 3072. If you add those numbers up, you get 3294. So, that’s a quick review of decimal and hexadecimal. Now let’s look at binary. So, looking back at this IP address 192.168.1.254, let’s look at how each of these numbers is written in binary, starting with 192, which is 11 00 00 00. Binary is base 2, meaning each digit increases by a factor of 2, it doubles. So, that means that this 11 00 00 00 really is 0 1s, then 1 x 2 is 2, so 0 2s, then 2 x 2 is 4, so 0 4s, then 4 x 2 is 8, so 0 8s, then 8 x 2 is 16, so 0 16s, 16 x 2 is 32, so 0 32s, 32 x 2 is 64, so 1 64, and 64 x 2 is 128, so 1 128 If you add 128 and 64 together, you get 192. Next let’s look at how 168 is converted to binary, which is 10 10 10 00. So, 10 10 10 00 in binary means 1 unit of 128, 1 unit of 32, and 1 unit of 8. 128 plus 32 plus 8 is equal to 168. Next up is 1, which is the decimal representation of binary 00 00 00 01. This is pretty simple. 1 is equal to 1 unit of 1. Let’s go to the last 8 bits of the IP address. 254 is equal to 11 11 11 10 in binary. Let’s take a look. Binary 11 11 11 10 represents 1 unit of 128, 1 unit of 64, 1 unit of 32, 1 unit of 16, 1 unit of 8, 1 unit of 4, and 1 unit of 2. Add those all together, and you get 254. So, hopefully you have an idea of how binary works now. Before we do some practice converting between decimal and binary, I want to teach you one more term. You’ll often hear each of these 8 bit groups referred to as ‘octets’. Now, let’s get some practice converting binary octets to decimal. Here’s an example. We have a binary octet of 10 00 11 11. How can we go about converting this to decimal? First, I recommend writing the value of each binary digit over the binary numbers. You can start with 1 on the right, and then multiply by 2 for each digit as you move to the left. Or if you prefer, start by writing 128 over the digit on the left, and divide by 2 as you move to the right. Once you have written these values, simply add up the value of each 1, and you get the answer. 128 + 8 + 4 + 2 + 1 equals 143. So, binary 10 00 11 11 is equal to decimal 143. Let’s do another example. Now we have binary 01 11 01 10. Once again, write the value of each binary digit over the octet. So, we have 1 unit of 64, 1 unit of 32, 1 unit of 16, 1 unit of 4, and 1 unit of 2. Add each of those numbers together, and you get the answer, which is 118. So, binary 01 11 01 10 is equal to decimal 118. What is binary 11 10 11 00 in decimal? This time I won’t display the value of each binary digit above. Write down the number yourself, or try to do the calculation in your head. Pause the video to figure out the answer. Got it? 128 + 64 + 32 + 8 + 4 equals 236. Okay, we’ll do some more binary to decimal conversion practice in the quiz for today’s video, let’s move on. Now let’s try converting in the opposite direction, from decimal to binary. We have the decimal number 221, how can we go about converting it to binary? I recommend writing out the values of each bit in a binary octet, like this. Then, starting from 128, try to subtract each number from the decimal number you’re trying to convert. As you can see, we can subtract 128 from 221, so write a 1 under 128. Now, we’ve got 93 left, can we subtract 64 from 93? Yes we can, and we’re left with 28. So, write a 1 under 64. Next, can we subtract 32 from 28? Well, we can, but we’d end up with a negative number, so for our purposes, no we can’t. So, write a 0 under 32. Next, 16 is smaller than 28, so let’s subtract 16 from 28. We’re left with 12, and write a 1 under 16. Next is 8, and it’s smaller than 12, so let’s subtract 8 from 12 and write a 1 under 8. Next, subtract 4 from 4, and write a 1 under 4. We’re left with 0, so we can’t subtract any further. That means we can just write 0 and 2 and 1. So, there’s our answer. Decimal 221 is equivalent to binary 11 01 11 00 (**WRONG: CHECK ERRATA**). Let’s do another example. Let’s convert decimal 127 to binary. Try to figure it out yourself first. Pause the video to find the answer. Okay, hopefully you found the answer, let’s check. We can’t subtract 128 from 127, so write a 0 under 128. We can subtract 64 from 127, which leaves 63, and I’ll write a 1 under 64. Then subtract 32 from 63, and write a 1 under 32, and we’re left with 31. Next subtract 16 from 31, 15 remains, and write a 1 under 16. Subtract 8 from 15, and write a 1 under 8. You’re left with 7, so subtract 4 from 7 , you get 3, and write a 1 under 4. Subtract 2 from 3, and write a 1 under 2. Finally, subtract 1 from 1 and you’re left with 0. There’s our answer. Decimal 127 in binary is 01 11 11 11. Let’s do one more example of decimal to binary conversion. Again, try to find the answer yourself. Write down the numbers and convert decimal 207 to binary. Pause the video to think about your answer. Okay, hopefully you found the answer, let’s check. First, write out the values for each bit of the binary octet. Subtract 128 from 207, and write a 1 under 128. Subtract 64 from 79, and write a 1 under 64. We can’t subtract 32 from 15, so write a 0 under 32. You can’t subtract 16 from 15 either, so write a 0 under 16. Subtract 8 from 15, and write a 1 under 8. Subtract 4 from 7, and write a 1 under 4. Subtract 2 from 3, and write a 1 under 2. And finally, subtract 1 from 1 and you get 0. There’s the answer. Decimal 207 is equivalent to 11 00 11 11 in binary. Before moving on, you probably figured this out by yourself already, but the range of possible numbers that can be represented with 8 binary bits ranges from 0, if all bits are 0, to 255, if all bits are 1, because 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 equals 255. So, an IPv4 address is really a series of 32 bits. It is split up into 4 octets, and then written in dotted decimal format to make it simpler for us humans to read and understand. However, you may remember there was this /24 that I said was used to identify which part of the IP address represents the network and which represents the end host. Since an IP address is 32 bits, can you guess what this /24 means? It means that the first 24 bits of this IP address represent the network portion of the address, and the remaining 8 represent the end host. So, the first 24 bits is equal to the first 3 octets, because 8 + 8 + 8 equals 24. So 192.168.1 is the network portion of the address, and 254 is the host portion. Here’s a quick look back at our small network. The IP address of PC1, PC2, and R1’s G0/0 interface are 192.168.1.1/24, 192.168.1.2/24, and 192.168.1.254/24. Notice that the network portion of each IP address is the same, because they are all part of the same local network, only the host portion is different. Likewise, the IP addresses of PC3, PC4, and R1’s G0/1 interface are 192.168.2.1/24, 192.168.2.2/24, and 192.168.2.254/24, only the host portion of the address is different because they are on the same local area network. Let’s follow the same process as before with another IP address. If you want some extra practice, try to convert these 32 binary bits into an IPv4 address. Pause the video if you want to try to find the answer on your own. Okay, so the 32 bits can be split into 4 octets like this. Then the four octets can be converted into dotted decimal like this. This time, /16 is used instead of /24. Which portion is the network portion and which is the host portion? Well, /16 means the first 16 bits, or the first half, are the network portion. So, the first two octets are the network portion, and the last two octets are the host portion. Therefore, 154.78 is the network portion, and 111.32 is the host portion. Let’s do one more example. Here’s another IPv4 address. Try to convert these 32 bits into dotted decimal. Pause the video now if you want to try. Okay, so you can divide the 32 bits into 4 octets like this, and then convert the octets into dotted decimal like this. This time, it’s /8. So, which part of the address is the network portion, and which is the host portion? Since the first 8 bits are the network portion, that means that the first octet is the network portion, and the last three octets are the host portion. So 12 is the network portion, and 128.251.23 is the host portion. Now, IPv4 addresses are split up into 5 different ‘classes’. The class of an IPv4 address is determined by the first octet of the address. The first is class A, which has a first octet beginning with 0. If the first octet begins with 0, that means that the numeric range of the first octet is from 0 to 127, because 64 + 32 + 16 + 8 + 4 + 2 + 1 gives a maximum of 127. The second class is class B, which has a first octet beginning with 1 0, and therefore a numeric range of 128 to 191. The third class is class C, which has a first octet beginning with 1 1 0, and therefore the numeric range for the first octet is 192 to 223. Class D has a first octet beginning with 1 1 1 0, and the numeric range of the first octet is 224 to 239. Finally, class E has a first octet beginning with 1111, and therefore the numeric range for the first octet is 240 to 255. However, the classes of address we’ll be focusing on are A, B, and C. Addresses in class D are reserved for ‘multicast’ addresses. Multicast is another type of address, separate from the unicast and broadcast addresses we talked about in previous videos. We will talk about them, but that will be later in the course. Class E addresses are reserved for experimental uses, and we won’t talk about them in this course. Now, one more thing about the Class A range. The end of the class A range is usually considered to be 126, NOT 127. Why is that? Let’s take a look. The 127 range is reserved for ‘loopback addresses’. The range is anything with a first octet of 127, so 127.0.0.0 to 127.255.255.255. These addresses are used to test the ‘network stack’ of the local device. If a device sends any network traffic to an address in this range, it is simply processed back up the TCP/IP stack as if it were traffic received from another device. In this image, I pinged 127.0.0.1 on my windows PC, and you can see the responses. My PC is responding to its own pings. In this image, I sent a ping to a random IP address in the 127 range, 127.23.68.241, and again my PC responds back to its own ping. Notice the round trip times, all 0 milliseconds. That’s because the traffic isn’t going anywhere, my PC is just sending and receiving these pings to and from itself. So here’s the chart again with just classes A, B, and C. I’ve also added one more column, the prefix length, which is the /8, /16, and /24 which is used to identify the length of the network portion of the address. Class A addresses use a /8 prefix, Class B addresses use a /16 prefix, and Class C addresses use a /24 prefix. Actually, if you look back at these three addresses we used in our examples, you can see they are , Class A, class B, and Class C addresses, and their prefix lengths match the table. /8 for class A, /16 for class B, and /24 for class C. In class A, there are fewer possible network addresses, however because the network (*host) portion is very long, there can be many hosts on each network. Class C is the opposite, there are many more possible networks, but because the host portion is smaller there are fewer hosts on each network. Let’s take a look at the numbers. So, this is another chart I’ve taken off of wikipedia. The leading bits column refers to the first bits of the first octet, which I displayed in my previous table. The ‘size of network number bit field’ displays the number of bits in the network portion of the IP address, which as I mentioned is 8 for class A, 16 for class B, and 24 for class C. ‘size of rest bit field’ indicates the remaining number of bits in the address, which is the host portion of the address. 24 bits for class A, 16 for class B, and 8 for class C. Now, this part here displays the number of possible networks in each class. As I said, class A has fewer potential networks, but more hosts in each network, class C is the opposite, and class B is in between. Class A has 128 possible networks, Class B has about 16,000 networks, and Class C has about 2 million networks. Class A allows about 16.7 million hosts in each network, Class B allows about 65,000 hosts in each network, and class C allows 256 hosts in each network. However, because the first address in each network is the network address, it cant be assigned to hosts. Also the last address of the network is the broadcast address, the Layer 3 address used when you want to send traffic to all hosts, and it also can’t be assigned to hosts, so really the host count is two less, for example 254 in class C. Now I want to briefly talk about another way of writing these prefix lengths. Using a slash, followed by the length of the prefix, is a newer and easier way of writing the prefix length. On Juniper network devices, for example, you write prefix lengths using this slash notation. However, Cisco devices still use an older, slightly more complicated way of writing the prefix length. That is using a dotted decimal netmask. A netmask is written in dotted decimal like an IP address, where the network portion is all 1s and the host portion is all 0s. For example, the network mask of a class A address is 255.0.0.0. That’s the dotted decimal version of 11 11 11 11, followed by 24 zeroes. So, what do you think the netmask of a Class B address is?... It’s 255.255.0.0, which is two octets of 1s, followed by two octets of zeroes, written in dotted decimal. Finally, what do you think the netmask of a Class C address is? It’s 255.255.255.0, which is three octets of 1s, followed by 1 octet of zeroes, again written in dotted decimal notation. So, these prefix lengths and these netmasks are the same things, just written in different ways. Before moving on to the quiz for today’s video, I want to explain two more types of IP addresses which I briefly mentioned before, the network and broadcast addresses. If the host portion of an IP address is all 0’s, it means it is the Network address, the identifier of the network itself. In our diagram here, you can see 192.168.1.0/24. We know that /24 means the first three octets are the network portion, and the last octet is the host portion. Since, the host portion is 0, it means the last octet, the host portion, is all 0s. Therefore, this address, 192.168.1.0/24, is the network address. Keep in mind, the network address cannot be assigned to a host. The network address is the first address of the network, but the first USABLE address is one above the network address, in this case it’s 192.168.1.1, which is assigned to PC1. So, the network address is the first address, with a host portion of all 0s. However, the LAST address in a network, with a host portion of all 1s, is the broadcast address for the network. Like the network address, the broadcast address CANNOT be assigned to a host. So although it’s the last address in the network the last USABLE address is actually 1 under the broadcast address, in this case, that’s 192.168.1.254, the address assigned to R1’s G0/0 interface. So, the broadcast address is the layer 3 address used to send a packet to all hosts on the local network. If a packet is sent with this destination IP address, what do you think will be the destination MAC address of the frame it is encapsulated in? Think about the Ethernet LAN switching videos... it will be all F’s, the broadcast MAC Address. If PC1, for example, sent a ping to 192.168.1.255, it would be received by PC2 and R1’s G0/0 interface. Once again, I think we’ve covered a lot of ground in this video. Let’s list what we covered before moving on to today’s quiz. First, I talked about dotted decimal and binary. Binary is how computers think, but 32 bit IPv4 addresses are difficult to remember for us humans, so we convert IPv4 addresses to dotted decimal form to make them easier to read and remember. You learned that IPv4 addresses consist of a network portion and a host portion. Hosts on the same network will have the same network portion, but a unique host portion of their IP addresses. You learned about the IPv4 address classes. We looked at the different ways of indicating the length of the network prefix, by writing the prefix length with a slash or by using a netmask. and finally, you learned about the network address, which has a host portion of all 0s, and is used to identify the network itself, not any particular host on the network. Also, the broadcast address, which has a host portion of all 1s, which is used to send network traffic to all hosts on the network. So, before moving on to the quiz I want to remind you to download and use the flashcards for this lesson to help you remember what you’ve studied in this lesson. Now, for today’s quiz, I’m going to focus exclusively on converting IPv4 addresses between binary and dotted decimal. There will be 10 questions, instead of the usual 5, and hopefully afterward you’ll feel confident converting IPv4 addresses between binary and dotted decimal. Let’s get started. Question 1. Convert the following IPv4 address to dotted decimal notation. Pause the video to solve the question, then unpause to check your answer. The answer is 63.56.231.19. Let’s go the question 2. Convert the following IPv4 address to dotted decimal notation. Pause the video to solve the question, then unpause to check your answer. The answer is 243.127.98.1. Let’s go question 3. Convert the following IPv4 address to dotted decimal notation. Pause the video to solve the question, and unpause to check your answer. The answer is 111.6.89.199. Let’s go question 4. Convert the following IPv4 address to dotted decimal notation. Pause the video to solve the question, and unpause to check your answer. The answer is 207.198.47.76. Let’s go question 5. Convert the following IPv4 address to dotted decimal notation. Pause the video to solve the question, and unpause to check your answer. The answer is 100.201.33.253. Let’s go question 6. Convert the following IPv4 address to binary notation. 88.46.90.91. Pause the video to solve the question, and unpause to check your answer. And here’s the answer. Let's go to question 7. Convert the following IPv4 address to binary notation. 221.234.246.163. Pause the video to solve the question, and unpause to check your answer. And here’s the answer. Let's go to question 8. Convert the following IPv4 address to binary notation. 3.41.143.222. Pause the video to solve the question, and unpause to check your answer. And here’s the answer. Let's go to question 9. Convert the following IPv4 address to binary notation. 10.200.231.91. Pause the video to solve the question, and unpause to check your answer. And here’s the answer. Let's go to question 10. Convert the following IPv4 address to binary notation. 248.87.255.152. Pause the video to solve the question, and unpause to check your answer. And here’s the answer. Okay, that’s all for the quiz, I hope you feel confident converting IPv4 addresses between binary and dotted decimal notation. As usual, there will be supplementary materials to help you review what you’ve learned. There will be review flashcards using Anki, which I highly recommend you download and use to review. There will also be a packet tracer practice lab, however it will be after Part 2’s video, so there won’t be a lab for today’s video specifically. Good luck with your studies. Thank you for watching. Please subscribe to the channel, like the video, leave a comment, and share the video with anyone else studying for the CCNA. If you want to leave a tip, check the links in the description. I'm also a Brave verified publisher, and accept BAT, or Basic Attention Token, tips via the Brave browser. That's all for now.