What are network prefixes? A range of IP addresses is given as a prefix. A prefix is nothing but an aggregation of network addresses. An IPv4 address has 32 bits. The prefix portion of the IPv4 address is that portion that does not change across the same L2 network. With the example shown on the screen we have the prefix 192.0.2.128 27. We see that the prefix portion is 27 bits and the host's bits is 5. With this example we're going to figure out how many addresses are available and what the highest and lowest IP addresses are. The number of host bits is 5. You derive this by subtracting 27 bits for the prefix length from the possible number of bits available in the IP address. Since you have 5 bits for the host, the number of IP addresses available will be 2 to the power of 5 which is 32 addresses. So how do you calculate the lowest and the highest available IP addresses of this prefix? Remember that the prefix length is a slash 27. This means that the first 27 bits are fixed. As you can see on the screen the first available IP address will be 192.0.2.128 And it's only the five bits for the host that are going to be changing. So the first available IP address is going to have all zeros as the lowest available IP address. Remember that you're converting eight bits. An IPv4 address is indicated with four octets of decimal so the last decimal available will be one zero zero zero zero zero zero zero which is 128 in decimal. So the first available IP address will be 192.0.2.128. Similarly the highest address will be192.0.2.159. How do you arrive at 159? Remember that it's only the five host bits that are changing. In this case all bits will be one one one one one so if you convert one zero zero one one one one one it's going to give you 159. As you can see on the screen it's only the host bits that are changing in red. The prefix bits remain the same. So what are the IPv4 golden rules? All hosts on the same L2 network must share the same prefix. This was mentioned earlier that means the prefix portion of the IPv4 address in the same L2 network does not change. All hosts with the same prefix also have a different host part. In the previous example you saw that the five host bits are the ones that are changing. Host part of all zeros and all ones are reserved. Host part of all zeros is considered a network address and all ones is considered a broadcast address. So the golden rules for the prefix 192.0.2.128 27 The lowest address available is 192.0.2.128. That's the first address and it's also considered a network address. The highest address available is 192 which is the broadcast address. So you see that the usable addresses are going to be to 192.0.2.129.219 So the number of usable addresses is going to be 32 minus 2 which is 30. So we're going to give you an exercise. We're going to give you this network prefix of 10.10.10.0.25 We want to know how many addresses are available in total and how many usable addresses that you have and what are the lowest and the highest usable addresses. We're going to give you a hint: remember a network address that we're given has the prefix portion and the host portion in this address you have seven bits for the host portion as shown on the screen so the first one IP address that's going to be available. You can see it's going to be in all green so you have the seven bits for the host which is zero zero zero zero which is going to be the lowest. And the highest as we said earlier is going to be all ones so with a prefix length of 25 first 25 bits are fixed okay. So we'll go through the exercise with the network prefix 10.10.10.0.25 like we showed you on the previous slide. The number of host bits is 7 which is derived from 32 minus 25 bits for the prefix length. So the number of addresses available will be 2 to the power of 7 which is 128. So how many usable addresses that you have remember that network and broadcast addresses are unusable these are two ip addresses. So the number of usable addresses will be 128 minus 2 which is 126. What are the lowest and the highest usable addresses? Remember the first address which is the network address will be 10.10.10.0 and the last IP address which is the broadcast address will be 10.10.10.127. Both of them are unusable. So the first usable IP address will be 10.10.10.1 and the last usable IP address will be 10.10.10.126. We're going to talk about an edge case. How many usable IP addresses do you have in a slash 30 prefix? What is a slash 30 used for? Remember that modern routers support slash 31 for the spokes to reduce IPv4 address wastage. Okay, if you have a slash 30 prefix the number of host bits remember will be 32 minus 30 which is two. The number of addresses available will be 2 to the power of 2 which is 4. The number of usable addresses remember is 4 minus 2 which is 2. You subtract 2 because the network and broadcast addresses are unusable. So why do we use a slash 30? We use slash 30s for point to point links.

© Produced by Philip Smith and the Network Startup Resource Center, through the University of Oregon.

Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
This is a human-readable summary of (and not a substitute for) the license. Disclaimer. You are free to: Share — copy and redistribute the material in any medium or format Adapt — remix, transform, and build upon the material The licensor cannot revoke these freedoms as long as you follow the license terms. Under the following terms: Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.