Network Fundamentals: IPv4
- Topic: Configure, verify, and troubleshoot IPv4 addressing and subnetting
- Topic: Compare and contrast IPv4 address types
- Topic: Describe the need for private IPv4 addressing
- Review Questions
- Answers to Review Questions
- Additional Resources
This chapter ensures you are ready for the above topics from the Network Fundamentals section of the overall exam blueprint from Cisco Systems. Remember, this is just a section of the Network Fundamentals area. Chapters One and Three also make up this grouping. Those chapters deal with networking models and IPv6 respectively.
Essential Terms and Components
IPv4 Addressing
IPv4 Address Classes
Subnet Masks
IPv4 Subnetting
IPv4 Address Configuration
Broadcasts
Unicasts
Multicasts
Private IPv4 Addressing
Network Address Translation (NAT)
Topic: Configure, verify, and troubleshoot IPv4 addressing and subnetting
Remember, an IPv4 address is a 32-bit number that we like to represent in dotted decimal notation. Consider using a conversion chart for the 8 bits that exist in an octet to help you with the various subnetting exercises you might encounter in the exam. Figure 2.1 is the simple chart I build on scratch paper before starting the exam:
FIGURE 2.1 A Conversion Chart for IPv4 Addressing and Subnetting Questions
One task that is simple using this chart is converting a number from decimal to binary or vice versa. For example, to convert 186 to binary, we first note that you can successfully subtract 128 from this number, so the first bit is on (1). The remainder is 58 after this subtraction. Note we cannot subtract 64 from this number (without having a negative number), so we move to the next number after setting the 64 value to off (0). We then subtract 32 from 58. This places a 1 in the 32 column and leaves us with 26. We can subtract 16 from 26 so there is a 1 in that column. Continuing with this method, we easily calculate that 186 in binary is:
10111010
Converting from binary to decimal is even easier. Just examine what bit positions are on (1) and add those decimal values together. So for example, 11101111 equals:
239
Early on in the development of TCP/IP, the designers created address classes to attempt to accommodate networks of various sizes. Notice they did this by setting the initial bit values. Table 2.1 shows these classes.
TABLE 2.1 The TCP/IP Version 4 Address Classes
Address Class |
High-Order Bit Setting |
1st Octet Range in Decimal |
A |
0 |
1–127 |
B |
10 |
128–191 |
C |
110 |
192–223 |
D |
1110 |
224–239 |
Another critical memorization point here is the default subnet masks for these address classes. Remember, it is the job of the subnet mask to define what portion of the 32-bit address represents the network portion versus the host portion. Table 2.2 defines the default masks.
TABLE 2.2 Default IPv4 Subnet Masks
Address Class |
Default Mask |
Prefix Notation Mask Bits |
A |
255.0.0.0 |
/8 |
B |
255.255.0.0 |
/16 |
C |
255.255.255.0 |
/24 |
Note that subnet masks must use continuous on bits (1). This results in the only possible values in a subnet mask octet shown in Table 2.3.
TABLE 2.3 The Possible Values in an IPv4 Subnet Mask Octet
On Bits |
Value |
8 |
255 |
7 |
254 |
6 |
252 |
5 |
248 |
4 |
240 |
3 |
224 |
2 |
192 |
1 |
128 |
0 |
0 |
Remember, subnetting is the process of “stealing” or “borrowing” bits from the host portion of the IPv4 address in order to create additional subnets. Think of using the following IP address and subnet mask combination in your network:
10.0.0.0/8 or 10.0.0.0 255.0.0.0
This allows you to only create one giant network. Sure, this network can have many host systems (specifically 224 – 2), but they all must exist in the same network. With broadcast traffic and other potential issues, this would be terrible for efficient communications. Today, we like to divide networks into small sections (subnetworks) of about 100 computers or less.
In the preceding example, we might decide to borrow 4 bits for subnetting. Now the identifications look like this:
10.0.0.0 255.240.0.0 or 10.0.0.0/12
How many bits are left for host identification? The subnet mask now contains 12 bits, leaving 20 bits available for host identification. Note that our calculation (220 – 2) requires a calculator. As a result, you would not see this question in your exam. The answer is an astounding 1,048,574 hosts per subnet.
Also important is to establish the exact subnets we create given a bit-borrowing scenario. The great news is: We once again rely on Figure 2.1 for assistance!
Using the preceding scenario, we have:
10.0.0.0 255.240.0.0 or 10.0.0.0/12
To determine the subnets—we determine our block size. The block size is the least significant bit (rightmost) decimal value that the mask extends in to. So, in our example here, we extend four bits into the second octet. The decimal value here from Figure 2.1 is 16. We start at 0 and then each new subnet increments by 16! So we have subnets numbered 0, 16, 32, 48, 64, 80, and so on. Plugging these values into our IP address, we have:
10.0.0.0/12
10.16.0.0/12
10.32.0.0/12
10.48.0.0/12
10.64.0.0/12
10.80.0.0/12
Etc.
What if we begin with 10.46.0.0/16 and we want to borrow 4 additional bits to create new subnets? No problem. We have:
10.46.0.0/20
10.46.16.0/20
10.46.32.0/20
10.46.48.0/20
10.46.64.0/20
10.46.80.0/20
Etc.
What if we begin with 192.168.1.0/24 and we need to create 6 subnets? Borrowing 3 bits does the job with some to spare (23 = 8). So we have subnets of:
192.168.1.0/27
192.168.1.32/27
192.168.1.64/27
192.168.1.96/27
192.168.1.128/27
192.168.1.160/27
There are two more subnets of course, but we do not care here because we only needed six.
What about usable addresses for hosts on a subnet? Look at 192.168.1.0/27 above. That is a reserved address—it is the subnet ID itself. Add 1 to this and you have the first usable host address on this subnet—so it would be 192.168.1.1/27. The last address before we get to the next subnet is 192.168.1.31/27. This is reserved as well. It is for the subnet broadcast. Remember from our earlier discussion these two reserved addresses are why we have the –2 in the hosts calculation formula. So the last usable address on the subnet is 192.168.1.30/27. The last usable address is always the next subnet ID minus two.
Here is one more example for you. If we have 10.10.0.0/16 and we want at least 15 new subnets, we create the scheme 10.10.0.0/20. Here are the usable host ranges for the first four subnets:
Subnet 10.10.0.0/20—First Usable 10.10.0.1—Last Usable 10.10.15.254
Subnet 10.10.16.0/20—First Usable 10.10.16.1—Last Usable 10.10.31.254
Subnet 10.10.32.0/20—First Usable 10.10.32.1—Last Usable 10.10.47.254
Subnet 10.10.48.0/20—First Usable 10.10.48.1—Last Usable 10.10.63.254
CramQuiz
What is 203 converted to binary?
A. 11001011
B. 11101011
C. 10101100
D. 11001000What is 01101111 in decimal?
A. 112
B. 111
C. 120
D. 110What is the default subnet mask for a class B network?
A. 255.255.255.0
B. 255.0.0.0
C. 255.255.0.0
D. 255.255.255.255If your mask uses three bits in an octet, what is the decimal value?
A. 192
B. 224
C. 240
D. 252If you have a mask of 255.255.255.240—how many hosts can you support?
A. 32
B. 62
C. 14
D. 6Your network needs to support 30 subnets. How many bits should you “borrow” in order to create the least waste in address space?
A. 4
B. 5
C. 6
D. 7What is the last usable host on a subnet where your computer has been given the address of 172.16.7.1 255.255.254.0?
A. 172.16.7.255
B. 172.16.6.1
C. 172.16.7.128
D. 172.16.7.254
CramQuiz Answers
A is correct. Using the chart in Figure 2.1, you arrive at these decimal values 128 + 64 + 8 + 2 + 1 = 203.
B is correct. The bits we add here are 64 + 32 + 8 + 4 + 2 + 1 = 111.
C is correct. 255.255.0.0 or 16 bits is the default mask for a Class B address.
B is correct. Three bits would mean 128 + 64 + 32 = 224.
C is correct. With this mask, there are only 4 bits left for host addressing. Using the chart in Figure 2.1, we learn that 2 raised to the 4th power is 16. We subtract two from this number to arrive at 14 hosts.
B is correct. Borrowing 5 bits permits the creation of 32 subnets. You have the 30 you need, plus 2 additional subnets.
D is correct. The usable host range here is 172.16.6.1 through 172.16.7.254.
