CCNA v1.1: IPv4 Address Classes

This week we’ll review the IPv4 Address Classes including subnet masks, examples of Class C, Class B, and Class A subnet masks, and planning IPv4 addresses.

Class Network (N) and Host(H) Octets 1st Bits in 1st Octet Numerical Range of 1st Octet Number of Networks Number of Hosts per Network
A N.H.H.H 0xxx 1-126* 126 16,777,214
B N.N.H.H 10xx 128-191 16,384 65,534
C N.N.N.H 110x 192-223 2,097,152 254
D** N/A 111x 224-239 N/A N/A
E** N/A 1111 240-255 N/A N/A

* 0 is reserved; 127 is reserved for the loopback address.
** Class D is used for multicast group addressing, and Class E is reserved for research use only.

Private IPv4 Addresses

The private IPv4 addresses are as follows:

  • 10.0.0.0 through 10.255.255.255
  • 172.16.0.0 through 172.31.255.255
  • 192.168.0.0 through 192.168.255.255

Subnet Masks

Subnet bits are “borrowed” from host bits. The subnet mask indicates how to interpret the IP address; every address has a subnet mask as an “interpreter”:

    • A binary “1” in the subnet mask indicates that the corresponding bit in the IP address is a subnet or network bit. The number of network bits is determined by the address class.
    • A binary “0” in the subnet mask indicates that the corresponding bit in the IP address is a host bit.

With “s“ subnet bits, the number of subnets is 2s.
With “h“host bits, the number of hosts per subnet is: 2h– 2.

Default Subnet Masks

Default Class A (N.H.H.H) mask: 255.0.0.0
Default Class B (N.N.H.H) mask: 255.255.0.0
Default Class C (N.N.N.H) mask: 255.255.255.0

Example of Class C Subnet Masks

Decimal Mask Subnet Bits (s) Host Bits (h) Number if Subnets = 2s Number of Hosts = 2h-2
255.255.255.0 0 8 0 254
255.255.255.128 1 7 2 126
255.255.255.192 2 6 4 62
255.255.255.224 3 5 8 30
255.255.255.240 4 4 16 14
255.255.255.248 5 3 32 6
255.255.255.252 6 2 64 2

Example of Class B Subnet Masks

Decimal Mask Subnet Bits (s) Host Bits (h) Number if Subnets = 2s Number of Hosts = 2h-2
255.255.0.0 0 16 0 65,534
255.255.128.0 1 15 2 32,766
255.255.192.0 2 14 4 16,382
255.255.255.0 8 8 256 254
255.255.255.128 9 7 512 126
255.255.255.240 12 4 4,096 14
255.255.255.252 14 2 16,384 2

Example of Class A Subnet Masks

Decimal Mask Subnet Bits (s) Host Bits (h) Number if Subnets = 2s Number of Hosts = 2h-2
255.0.0.0 0 24 0 16,777,214
255.128.0.0 1 23 2 8,388,606
255.192.0.0 2 22 4 4,194,302
255.255.255.0 16 8 65,536 254
255.255.255.192 18 6 262,144 62
255.255.255.240 20 4 1,048,576 14
255.255.255.252 22 2 4,194,304 2

Steps for Planning IPv4 Addresses

      1. Determine the address space to use (either public or private).
      2. Determine the number of subnets and number of host (device) addresses per subnet required.
      3. From #2, determine the number of subnet bits to use (s where 2s = # subnets).
      4. From #3, determine the subnet mask to use.
      5. Apply the subnet mask (from #4) to the IP address space (from #1) to determine the subnet and host (device) addresses.
      6. Assign the host (device) addresses to specific device interfaces.

Given a device IPv4 address and its subnet mask:

      1. Write the address in binary.
      2. Write the mask in binary, below the address.
      3. Draw a vertical line between the 1s and the 0s in the mask; extend this line up into the address bits. This line divides the network/subnet bits from the host bits in the address.
      4. Make four copies of the address bits that are above the 1s in the mask; these are network/subnet bits.
      5. In the first of these copies, fill in all the bits to the right of these bits with 0s. This is the address of the subnet.
      6. In the last of these copies, fill in all the bits to the right of these bits with 1s. This is the address of the directed broadcast on the subnet.
      7. In the second of these copies, fill in all the bits to the right of these bits with 0s, except put a 1 in the last bit. This is the address of the first host on the subnet. In the third of these copies, fill in all the bits to the right of these bits with 1s, except put a 0 in the last bit. This is the address of the last host on the subnet.
      8. To determine the address of the next subnet, increment the subnet bits by 1.

IPv4 VLSM Example

Variable length subnet mask (VLSM) means to use a different (variable length) subnet mask on different subnets of the same major network (a given class A, B, or C network). VLSM allows the address space to be used more efficiently.

For example, you are given the address space 172.17.0.0/16, and you need to address some LANs that may have up to 300 device addresses and some point-to-point WANs. For the LANs you need 9 host bits (29 – 2 = 510 host addresses) and for the WANs you need 2 host bits (22 – 2 = 2 host addresses). Therefore, for the LANs you can use 16 – 9 = 7 subnet bits, which would allow 27 = 128 subnets. The addresses of these subnets are as follows (with the subnet bits in red):
172.17.00000000.00000000 = 172.17.0.0/23
172.17.00000010.00000000 = 172.17.2.0/23
172.17.00000100.00000000 = 172.17.4.0/23
And so on, up to the last subnet:
172.17.11111110.00000000 = 172.17.254.0/23

The first of these can be used for addressing the LANs. Any unused subnet can be further subnetted for the WANs. For example, if the last subnet is not used for a LAN, it can be further subnetted for the WANs. Since only 2 host bits are required for the WANs, 9 – 2 = 7 subnet bits can be used, which would allow 27 = 128 WAN subnets. The addresses of these subnets are as follows (with the WAN subnets in red):
172.17.11111110.00000000 = 172.17.254.0/30
172.17.11111110.00000100 = 172.17.254.4/30
172.17.11111110.00001000 = 172.17.254.8/30
And so on, up to the last subnet:
172.17.11111111.11111100 = 172.17.255.252/30

Next week we’ll start on IPv6.

Excerpted and available for download from Global Knowledge White Paper: CCNA v1.1 Exam Review: Critical Concepts of the 640-802 CCNA Exam

Resources:
CCNA Cert Check
CCNA Exam Prep Mobile App

Related Courses:
ICND1 — Interconnecting Cisco Network Devices 1
ICND2 — Interconnecting Cisco Network Devices 2
CCNAX — CCNA Boot Camp v1.1

In this article

Join the Conversation