## **Subnetting IP**

**Objectives:**

- Calculate and apply an addressing scheme including VLSM IP addressing design to a network
- Determine the appropriate classless addressing scheme using VLSM and summarization to satisfy addressing requirements in a LAN/WAN environment

So far, we have focused on the network classes and key characteristics of each one. As I mentioned, each network class can also be broken down into smaller groups of IP address ranges or subnets, which may also be referred to as variable-length subnet masking (VLSM). *Subnetting *is the process of breaking down those larger IP networks into smaller sub-networks. At first, subnetting IP might seem like a daunting task, but it’s not that bad after you get the hang of it. In this section you need to pull together all the knowledge that you have learned so far about binary, decimal, and subnets.

First, let’s get the easy subnetting out of the way.

For an IP address that has a 255.255.0.0 or 255.255.255.0 subnet mask, you can copy the octets that have a subnet mask value of 255 from the original IP address. For the remaining octets, you will put down a 0. Here’s an example:

IP address = 139.42.6.0

Subnet Mask = 255.255.0.0

The Network ID is 139.42.0.0.

To determine the Broadcast IP of this IP address and subnet mask, just replace the 0 octets from the Network ID with 255.

The Broadcast IP is 139.42.255.255.

**EXAM ALERT**

When a subnet mask has a value of 255.255.0.0 or 255.255.255.0, you can copy the original IP octets that match the 255 value subnet octets and then use 0 for any remaining octets to determine your Network ID. The Broadcast IP is the same original IP octets that match the 255 value subnet octets and the number 255 rather than 0 for the remaining octet(s).

To understand more difficult subnetting, you need to break down an IP address into network bits, host bits, and subnet bits. The network bits are determined by the network class. Class A has 8 network bits, Class B has 16 network bits, and Class C has 24 network bits. The network bits value is a constant. The host bits, on the other hand, must share space with the subnet bits. To determine the subnet bits for a network you need to look at the subnet mask in binary. For example,

IP address = 176.85.195.60/22

Subnet Mask = 255.255.252.0

Subnet Mask in Binary = 11111111 11111111 11111100 00000000

Network bits = 16

Host bits = 10

Subnet bits = 6

The subnet mask in binary has 22 bits with a value of 1, which means the CIDR notation is /22. Based on the first octet of the IP address you know that this is a Class B network. Class B networks have 16 network bits. That leaves 16 bits in the address. The bits that have a value of 0 determine the number of host bits. In this case there are 10 host bits. The rest of the bits

are the subnet bits, so there are 6 subnet bits.

Table 5.12 is a conversion table of decimal to binary values that will help you convert addresses more quickly when taking the exam.

You can use the chart to figure out more IP address values:

IP address = 100.15.209.0/23

Subnet Mask = 255.255.254.0

Subnet Mask in Binary = 11111111 11111111 11111110 00000000

Network bits = 8

Host bits = 9

Subnet bits = 15

IP address = 128.216.55.0/24

Subnet Mask = 255.255.255.0

Subnet Mask in Binary = 11111111 11111111 11111111 00000000

Network bits = 16

Host bits = 8

Subnet bits = 8

IP address = 222.110.8.61/28

Subnet Mask = 255.255.255.240

Subnet Mask in Binary = 11111111 11111111 11111111 11110000

Network bits = 24

Host bits = 4

Subnet bits = 4

### Calculating Hosts in a Subnet

To calculate the hosts in a subnet, we can use the formula 2 H – 2. The exponent H represents the number of host bits in a network. If you use the subnetting examples, you can determine the hosts in each subnet:

IP address = 176.85.195.60/22

Subnet Mask = 255.255.252.0

Network bits = 16

Host bits = 10

Subnet bits = 6

2^{10} – 2 = 1022 Hosts

IP address = 100.15.209.0/23

Subnet Mask = 255.255.254.0

Network bits = 8

Host bits = 9

Subnet bits = 15

2^{9} – 2 = 510 Hosts

IP address = 128.216.55.0/24

Subnet Mask = 255.255.255.0

Network bits = 16

Host bits = 8

Subnet bits = 8

2^{8} – 2 = 254 Hosts

IP address = 222.110.8.61/28

Subnet Mask = 255.255.255.240

Network bits = 24

Host bits = 4

Subnet bits = 4

2^{4} – 2 = 14 Hosts

**EXAM ALERT**

The formula to calculate the number of hosts created is 2H – 2. The H represents the host bits in a network.

### Calculating Networks in a Subnet

To calculate the networks in a subnet, you can use the formula 2 N – 2. The exponent N represents the number of subnet bits in a network. You can figure out the number of networks in

each subnet with the formula.

IP address = 176.85.195.60/22

Subnet Mask = 255.255.252.0

Network bits = 16

Host bits = 10

Subnet bits = 6

2^{6} – 2 = 62 Networks

IP address = 100.15.209.0/23

Subnet Mask = 255.255.254.0

Network bits = 8

Host bits = 9

Subnet bits = 15

2^{15} – 2 = 32,766 Networks

IP address = 128.216.55.0/24

Subnet Mask = 255.255.255.0

Network bits = 16

Host bits = 8

Subnet bits = 8

2^{8} – 2 = 254 Networks

IP address = 222.110.8.61/28

Subnet Mask = 255.255.255.240

Network bits = 24

Host bits = 4

Subnet bits = 4

2^{4} – 2 = 14 Networks

**EXAM ALERT**

The formula to calculate the number of networks or subnets created is 2N – 2. The N represents the subnet bits in a network.

**Zero Subnet Rule**

*Zero subnet *may also be referred to as *subnet zero*. The zero subnet is the first subnet in a network and has all binary 0s in the subnet field. For the purpose of taking the CCNA exam, you should not include the first subnet when calculating the number of networks in a larger subnet. This is one of the two reserved subnet numbers on a network and one of the reasons why you subtract from the total number of networks to get the correct answer for the test. The other network is the broadcast subnet, which has all 1s in the subnet field.

### The Increment

We have been working with the IP address subnet 222.110.8.61/28. After you know how many subnets and hosts are in a subnet, you can determine the network ID for that subnet. So far, you know that 222.110.8.61/28 has 14 hosts and 14 subnets. Before subtracting 2 for the valid number of hosts/networks, your calculations were for 16 hosts and 16 networks. This means that a subnet with a 255.255.255.240 mask is part of a larger subnet with a 16-host increment. The variable part of this subnet is the last octet. So you can automatically write down the first three octets as follows:

222.110.8.x (where the x is variable and has a 16-host increment)

Octet values range from 0 to 255. So the first subnet in the larger network is 222.110.8.0. Now you want to add increments of 16 to the last octet, so you get the following networks:

222.110.8.0 (zero subnet—not valid for the CCNA exam)

222.110.8.16

222.110.8.32

**222.110.8.48**

222.110.8.64

222.110.8.80

222.110.8.96

222.110.8.112

222.110.8.128

222.110.8.144

222.110.8.160

222.110.8.176

222.110.8.192

222.110.8.208

222.110.8.224

222.110.8.240 (broadcast subnet—not valid for the CCNA exam)

This is a list of the Network IDs in that Class C network with a subnet of 255.255.255.240. The Network ID is always an even number. There are 16 total subnets. According to the zero subnet and broadcast subnet rule, the first and last subnet cannot be used. The IP address 222.110.8.61 is greater than 48 and less than 64, so the Network ID or subnet number for 222.110.8.61/28 is 222.110.8.48 (which is highlighted in the list of networks). To get the broadcast IP, subtract 1 from the next Network ID in your list. In this example, the broadcast IP is 222.110.8.63. There is another math shortcut that can be used to identify the Network ID, which then helps you determine the Broadcast IP. Take another look at 222.110.8.61/28. IP address = 222.110.8.61 Subnet Mask = 255.255.255.240

Look at the first subnet mask octet from the left that is not a value of 255 and subtract it from 256.

256 – 240 = 16

You want to find the closest multiple of 16 that is less than the last octet in the IP address, which equals 61. You are using the last octet because that is the same octet used from the subnet mask.

16×3 = 48 and 16×4 = 64

Based on the calculations, the Network ID increments are as follows:

222.110.8.48

222.110.8.64

So you use 48 because it is less than 61, and 64 is the Network ID of the next subnet. You come up with the same answer as before.

Network ID = 222.110.8.48

Broadcast IP = 222.110.8.63 (one less than the next Network ID of the next subnet)

Here’s another example:

IP address = 100.15.209.0

Subnet Mask = 255.255.254.0

The first two octets in the subnet mask equal 255, so you need to use the first octet that is not equal to 255, or in this case the third octet from the left. Now you can subtract 254 from 256.

256 – 254 = 2

2×104 = 208

2×105 = 210

You can see that the valid network ID less than 209 is 208. The next network ID equals 210, so you can fill out the third octet with each value to obtain the following network ID increments:

100.15.208.0

100.15.210.0

For IP address 100.15.209.0 with a subnet mask of 255.255.254.0, you now know the Network ID is 100.15.208.0. The next network is 100.15.210.0, so you want to find the last IP address before that network ID to get the Broadcast IP. Because the value of an octet can range from 0 to 255, the last possible IP before 100.15.210.0 is 100.15.209.255.

Network ID = 100.15.208.0

Broadcast IP = 100.15.209.255

### Determining the Range of Valid IPs

The range of valid IP addresses in a subnet is the first IP address after the Network ID and the last IP address before the Broadcast IP address. If you are given the following IP address and subnet mask, you can determine the range of valid IP addresses:

IP Address = 210.189.16.0

Subnet Mask = 255.255.255.0

First, identify the Network ID, which in this case is 210.189.16.0. Then determine the Broadcast address, which is 210.189.16.255. In this case the valid IP range is 210.189.16.1 to

210.189.16.254.

Here are some more examples where the Network ID and Broadcast IP have already been determined:

IP address = 100.15.209.0

Subnet Mask = 255.255.254.0

CIDR = /23

Network ID = 100.15.208.0

Broadcast IP = 100.15.209.255

Valid IP range = 100.15.208.1 to 100.15.209.254

IP address = 222.110.8.61

Subnet Mask = 255.255.255.240

CIDR = /28

Network ID = 222.110.8.48

Broadcast IP = 222.110.8.63

Valid IP range = 222.110.8.49 to 222.110.8.62

**EXAM ALERT**

The valid range of IP addresses always starts with an odd number and ends with an even number.

It is important to understand the general concepts related to IP addressing and subnetting. Figure 5.3 is a chart or quick sheet that will help you check your answers and provide you a guideline for the CCNA exam. I suggested that you memorize the powers of 2. I also suggest that you memorize this chart and write it down on your scrap paper or white board when you start the exam. I found it to be extremely helpful!

**FIGURE 5.3 **Subnetting quick sheet.