IP Subnetting Part 4: Subnetting a Class C Network

At this point in the PacketU subnetting series, we have worked through the following–

This article takes the concept of subnetting to the next step. Today we are going to look at the concepts required to subnet a Class C network. As we reflect on the Classful IP rules, we recall that a Class C network has the following characteristics–

  • First octet begins with binary 110…..
  • The first Octet will be in the range of 192 to 223
  • The first three (three leftmost) octets represent a Network
  • The last octet (rightmost) Octet represents a Host on a network

We also know that this single IP network can be further subdivided into multiple, but smaller, networks. This process is known as subnetting.

Continuing with the syntax used in previous articles, we might represent a Class C Network as follows–

192.168.100.0

In this example--

Blue  represents a Classful Network
Green represents a Host address

In this case the host address value is 0, so only the network is being represented here. Based on this information, we only have one IP network that can be assigned. That one network could 254 hosts on it.

Question–Addresses 192.168.100.0 through 192.168.100.255 are possible–so can’t we use all 256 host addresses (0-255)?

The answer to this question lies in IP networking fundamentals. Even though there are 256 possible values, two of them are reserved. A host value of 0 is a special address given to the Network. A host value of all ones (binary 1111 1111), or 254, is used to do address all hosts on a subnet. So 192.168.100.0 is the Network address and 192.168.100.255 is the directed broadcast address. That leaves 254 possible values, 192.168.100.1 – 192.168.100.254.

Although we have only been provided a single network, we know that it is possible to sub-allocate this into smaller subnetworks or subnets. One example of this might divide the classful network into 16 subnets. Based on our understanding of binary, we know that would take 4 bits. Since each octet is 8 bits, 4 bits remain on each subnet for host addresses.

192.168.100. nnnn hhhh

In the above example, the last octet has been represented in binary. Each “n” represents a subnet bit and each “h” is a host bit. This allows 16 possible subnets.

192.168.100. 0000 hhhh
192.168.100. 0001 hhhh
192.168.100. 0010 hhhh
192.168.100. 0011 hhhh
192.168.100. 0100 hhhh
192.168.100. 0101 hhhh
192.168.100. 0110 hhhh
192.168.100. 0111 hhhh
192.168.100. 1000 hhhh
192.168.100. 1001 hhhh
192.168.100. 1010 hhhh
192.168.100. 1011 hhhh
192.168.100. 1100 hhhh
192.168.100. 1101 hhhh
192.168.100. 1110 hhhh
192.168.100. 1111 hhhh

Subnets aren’t typically represented this way. We would typically see these represented in decimal. To convert each of these to a decimal number, the host bits must have a value. When representing a network or subnet, the value in the host bits will always be ’0′. After doing this, a simple binary to decimal conversion will allow a more typical representation.

192.168.100. 0000 0000 -> 192.168.100.0
192.168.100. 0001 0000 -> 192.168.100.16
192.168.100. 0010 0000 -> 192.168.100.32
192.168.100. 0011 0000 -> 192.168.100.48
192.168.100. 0100 0000 -> 192.168.100.64
192.168.100. 0101 0000 -> 192.168.100.80
192.168.100. 0110 0000 -> 192.168.100.96
192.168.100. 0111 0000 -> 192.168.100.112
192.168.100. 1000 0000 -> 192.168.100.128
192.168.100. 1001 0000 -> 192.168.100.144
192.168.100. 1010 0000 -> 192.168.100.160
192.168.100. 1011 0000 -> 192.168.100.176
192.168.100. 1100 0000 -> 192.168.100.192
192.168.100. 1101 0000 -> 192.168.100.208
192.168.100. 1110 0000 -> 192.168.100.224
192.168.100. 1111 0000 -> 192.168.100.240

Looking at our converted values raise another question. The rightmost column contains no discernible way to attribute bits in the last octet to the role of subnetting. This is why a subnet mask is necessary when we configure networked devices. The number of binary 1′s in a subnet mask determines the number of bits that are considered the network (or subnet) address. Let’s just use a random example from above to illustrate this.

192.168.100. 1000 0000 -> 192.168.100.128 (subnet)
255.255.255. 1111 0000 -> 255.255.255.240 (subnet mask)

Another way represent this is slash notation. With slash notation, the address is followed by a “/“, then a number that represents the number of binary 1′s in the subnet mask. So the following are equivalent.

192.168.100.128 (subnet)
255.255.255.240 (subnet mask)

-or-

192.168.100.128/28

The “28″ in the second example can be seen by converting the subnet mask.

255.255.255.240 -> 11111111.11111111.11111111.11110000 (28 ones)

This takes us up to the host component in subnetting a Class C address. If we continue with the same example, we can focus on the last four bits of the rightmost octet. From our understanding of binary, we know that there are 16 possible values. However, we also know that there are two special addresses that cannot be assigned to hosts.

0000 -> 0   (all zeros - network/subnetwork)
0001 -> 1
0010 -> 2
0011 -> 3
0100 -> 4
0101 -> 5
0110 -> 6
0111 -> 7
1000 -> 8
1001 -> 9
1010 -> 10
1011 -> 11
1100 -> 12
1101 -> 13
1110 -> 14
1111 -> 15  (all ones - directed broadcast)

So when defining the hosts on the 192.168.100.128/28 subnet, the following is the result.

192.168.100. 1000 0000 -> 192.168.100.128 (subnet)
192.168.100. 1000 0001 -> 192.168.100.129 (first host address)
192.168.100. 1000 0010 -> 192.168.100.130
192.168.100. 1000 0011 -> 192.168.100.131
192.168.100. 1000 0100 -> 192.168.100.132
192.168.100. 1000 0101 -> 192.168.100.133
192.168.100. 1000 0110 -> 192.168.100.134
192.168.100. 1000 0111 -> 192.168.100.135
192.168.100. 1000 1000 -> 192.168.100.136
192.168.100. 1000 1001 -> 192.168.100.137
192.168.100. 1000 1010 -> 192.168.100.138
192.168.100. 1000 1011 -> 192.168.100.139
192.168.100. 1000 1100 -> 192.168.100.140
192.168.100. 1000 1101 -> 192.168.100.141
192.168.100. 1000 1110 -> 192.168.100.142 (last host address)
192.168.100. 1000 1111 -> 192.168.100.143 (directed broadcast)

When assigning the third useable host address to a network device, it would be entered as follows.

192.168.100.131 (address)
255.255.255.240 (subnet mask)

-or-

192.168.100.131/28

Class C Classful networks have 24 bits of network addressing. This example used a /28 mask to create multiple smaller networks or subnets. Using fewer bits for subnetting decreases the number of subnets available. However, it increases the number of hosts per subnet. Increasing the number of bits for subnetting has the opposite effect. So if we increase the subnet to /30 (255.255.255.252), we have the following possible subnets.

192.168.100. 000000 00 -> 192.168.100.0
192.168.100. 000001 00 -> 192.168.100.4
192.168.100. 000010 00 -> 192.168.100.8
192.168.100. 000011 00 -> 192.168.100.12

...
for brevity, omitting - 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84,88, 
92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168,
172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244 
...

192.168.100. 111110 00 -> 192.168.100.248
192.168.100. 111111 00 -> 192.168.100.252

In this example, there would be two useable hosts per subnet. If we assigned host addresses to the second subnet, the following would accurately represent the addresses.

192.168.100. 000001 00 -> 192.168.100.4 (subnet)
192.168.100. 000001 01 -> 192.168.100.5 (first host address)
192.168.100. 000001 10 -> 192.168.100.6 (last host address)
192.168.100. 000001 11 -> 192.168.100.7 (directed broadcast)

As you can see, we are beginning to pull the subnetting concepts together. I suggest those in networking fully grasp all subnetting concepts included in this and the previous articles. When fully understood, it should be fairly easy to answer any question about subnetting a Class C address.

In a future article, we are going to add the complexity of dealing with other IP address classes. This will force our binary calculations across octet boundaries and is the final layer of confusion that needs to be understood. Too many people learn subnetting shortcuts prior to understanding the mechanics and mathematics. IP subnetting is a fundamental building block that should be well understood by network engineers.

Related Articles

 

 

The post IP Subnetting Part 4: Subnetting a Class C Network appeared first on PacketU.

Paul Stewart, CCIE 26009 (Security)