Classes of IPv4 Addresses: brief explanation with example

Classes of IPv4 Addresses
Андрей Волков

Андрей Волков

Системное, сетевое администрирование +DBA. И немного программист!))  Профиль автора.

IPv4 addresses were originally divided into five different classes according to size. These classes are no longer officially used because concepts such as classless interdomain routing (CIDR) and the mere fact that no more addresses are left to hand out have made address classes a moot point. But the terminology still remains out there and many IT professionals learned using this system, so it is a good starting point for understanding networks and, ultimately, subnetting of networks.


Table of contents[Show]


Address classes were broken down based on a concept called the leading bit pattern of the first octet of an IPv4 address. Remember that a machine reads IPv4 addressing as a single 32-bit number, so the patterns that were developed were all based in binary. This makes for some not-so-obvious decimal groupings of addresses.

Classes were named A through E and had the characteristics described in Table 1.

Table 1 IPv4 Address Classes

Class

Leading Bit Pattern (First Octet) (in Binary)

First Octet (in Decimal)

Notes

A

0xxxxxxx

(x refers to the remaining bits in the octet and can be either 0 or 1)

0–127

0 is invalid

10.0.0.0/8 is reserved for private, internal routing only (RFC 1918)

127 is reserved for loopback testing

B

10xxxxxx

128–191

172.16.0.0/12 is reserved for private, internal routing only (RFC 1918)

C

110xxxxx

192–223

192.168.0.0/16 is reserved for private, internal routing only (RFC 1918)

D

1110xxxx

224–239

Reserved for multicasting; cannot be assigned to unicast hosts

E

1111xxxx

240–255

Reserved for future use/testing

Classes A, B, and C are the only classes that can be used for unicast communication. Class D is used for multicast communication, which means that one device can communicate with a specific group of hosts within a network (unlike broadcast communication, which is one device communicating with all hosts within a network). Class E is reserved for future use and/or testing. Class E addresses will never be released for unicast communication.

Network vs. Node (Host) Bits

Within Classes A to C, the four octets of an IPv4 address were broken down to either network octets or node (or host) octets. The following chart shows how the classes were broken down into network bits, called N bits, or node (host) bits, called H bits. The default subnet mask is also shown as well:

Address Class

Octet 1

Octet 2

Octet 3

Octet 4

Default Network Mask

A

NNNNNNNN

HHHHHHHH

HHHHHHHH

HHHHHHHH

/8 or 255.0.0.0

B

NNNNNNNN

NNNNNNNN

HHHHHHHH

HHHHHHHH

/16 or 255.255.0.0

C

NNNNNNNN

NNNNNNNN

NNNNNNNN

HHHHHHHH

/24 or 255.255.255.0

This chart tells us more about the sizing of the different classes of addresses:

  • A Class A network has 24 bits that are used for assigning to hosts. 224 = 16,777,216 addresses. Removing two hosts for network identification (all 0s in the host portion) and broadcast communication (all 1s in the host portion), that means that every class A network can host 16,777,214 unique devices in a single network.
  • A Class B network has 16 bits available for host assignment. 216 = 65,536 hosts. Subtract the two addresses reserved for network and broadcast and you have 65,534 valid hosts per Class B network.
  • A Class C network has 8 bits available for hosts. 28 = 256 hosts. Subtracting the two addresses reserved for network and broadcast leaves you with 254 valid hosts per Class C network.

Combining this knowledge with the information from the IPv4 address class chart, we can make the following conclusions as well:

  • There are 126 valid Class A networks of 16,777,214 valid hosts each.
  • There are 16,384 valid Class B networks of 65,534 valid hosts each.
    • We get 16,384 from the fact that the first 16 bits of the address are network bits, but the first two of them are fixed in the pattern of 10. This means that we have 14 bits left of valid network bits ranging from 1000000000 (which is 128.0) to 10111111.11111111 (which is 191.255). That is 16,384 different networks.
  • There are 2,097,152 Class C networks of 254 valid hosts each.
    • Again, we take the chart that says there are 24 N bits (network bits) and three of those bits are fixed to the pattern of 110. That means we have 21 bits left to assign to networks in the range of 11000000000.00000000 (192.0.0) to 11011111.11111111.11111111 (223.255.255). That is 2,097,152 individual networks.

Looking back at our original example in this chapter of 192.168.1.1/24, we now know more information:

  • The network is a Class C network.
  • The network is in an RFC 1918 network, which means that it is private, and can only be routed internally within the network.

RFC (Private) 1918 Addresses

RFC 1918 addresses were created to help slow down the depletion of IPv4 addresses. Addresses that are part of RFC 1918 are to be used on private, internal networks only. They can be routed within the network, but they are not allowed out onto the public Internet. Most companies and homes today use private, internal RFC 1918 addresses in their networks. In order for a device that is using an RFC 1918 address to get out onto the public Internet, that address has to go through a device that uses Network Address Translation (NAT) and have its private address translated into an acceptable public address.

Note

When originally designed, the use of 32-bit numbers was chosen because it was felt that 232 number of unique addresses was so large that it would never be reached. This is why an entire Class A network (127) was reserved for loopback testing. You only need one address to test your loopback, but over 16 million addresses were reserved for this test—24 host bits means 224 addresses were reserved when only one was needed. 16,777,216 addresses may seem like a lot, but remember that two of those addresses are reserved for the network and broadcast addresses, so you only have 16,777,214 addresses reserved for loopback testing. Feel better?

 

Note

The original design of address classes had a network of all binary 0s or all binary 1s as invalid. Early devices used a string of 0s or 1s as internal communication codes so they could not be used. Therefore, network 0.0.0.0 and network 255.x.x.x are invalid. The 255 network is part of the reserved Class E network space, so we never had a chance to use it, but the 0 network is part of the assignable Class A address space. Another 16,777,214 addresses lost.

 

Note

We originally thought that 232 bit addressing space would be impossible to reach, but the advent of the public Internet and then mobile devices led to the need for a new addressing scheme. IPv6 is a 128-bit-wide addressing space. Reaching the limit of 2128 addresses might seem impossible, but with the Internet of Things (IoT) becoming a reality, is it impossible?

Local vs. Remote Addresses

When two addresses are in the same network, they are said to be local to each other. When two addresses are in different networks, they are said to be remote to each other. Why is this distinction important? Local devices can communicate directly with each other. Remote devices will need a Layer 3 device (such as a router or a Layer 3 switch) to facilitate communication between the two endpoints. A common mistake that occurs in networks once they are subnetted down to smaller networks is that devices that were once local to each other are now remote, and without that Layer 3 device to assist, communication no longer occurs. Being able to tell if two devices are local or remote is a valuable tool to assist in troubleshooting communication problems.

 

Classless Addressing (examples)

Although classful addressing was originally used in the early days of IPv4 usage, it was quickly discovered that there were inefficiencies in this rigid scheme—who really needs 16 million hosts in a single network? Concepts such as CIDR and variable-length subnet masking (VLSM) were created to allow for a more efficient distribution of IPv4 addresses and networks.

In classless addressing, the rules all stay the same except for one: the size of the default network mask. With classless addressing, the network mask can be changed from the default sizes of /8, /16, or /24 in order to accommodate whatever size of network is required. For example, a common practice is to take a Class A network, such as the RFC 1918 10.0.0.0 network, and break that one large network into smaller, more manageable networks. So instead of a single network of 16.7 million hosts, we can use a /16 mask and create 256 networks of 65,534 hosts each:

10.0.0.0/8 (8 N bits 24 H bits)

=

One network of 16,777, 214 hosts (224 bits for hosts)

10.0.0.1–10.255.255.254

10.0.0.0/16 (16 N bits and 16 H bits)

=

One network of 65,534 hosts (216 bits for hosts)

10.0.0.1–10.0.255.254

10.1.0.0/16

=

One network of 65,534 hosts

10.1.0.1–10.1.255.254

10.2.0.0/16

=

One network of 65,534 hosts

10.2.0.1–10.2.255.254

     

10.254.0.0/16

=

One network of 65,534 hosts

10.254.0.1–10.254.255.254

10.255.0.0/16

=

One network of 65,534 hosts

10.255.0.1–10.255.255.255

We can prove this using binary to show that no other rules of IP addressing have changed:

   

N/H Bits

N Bits

H Bits

10.0.0.0/8

=

8 N and 24 H bits

00001010

00000000 00000000 00000000

10.0.0.0/16

=

16 N and 16 H bits

00001010 00000000

00000000 00000000

10.1.0.0/16

=

16 N and 16 H bits

00001010 00000001

00000000 00000000

10.2.0.0/16

=

16 N and 16 H bits

00001010 00000010

00000000 00000000

       

10.254.0.0/16

=

16 N and 16 H bits

00001010 11111110

00000000 00000000

10.255.0.0/16

=

16 N and 16 H bits

00001010 11111111

00000000 00000000

The rules for network, valid host, and broadcast addresses have also not changed. If we take the column of H bits above and break it down further we get the following:

 

Host Bit Portion of Address

Address

Network Address (All 0s in H bits)

Range of Valid Hosts

Broadcast Address (All 1s in H bits)

10.0.0.0/16

00000000 00000000

(10.0.0.0)

00000000 00000001–11111111 11111110

(10.0.0.1–10.0.255.254)

11111111 11111111

(10.0.255.255)

10.1.0.0/16

00000000 00000000

(10.1.0.0)

00000000 00000001–11111111 11111110

(10.1.0.1–10.1.255.254)

11111111 11111111

(10.1.255.255)

Another common occurrence is to take a Class A network and use the Class C default mask to create 65,536 networks of 254 hosts per network:

10.0.0.0/8 (8 N bits and 24 H bits)

=

One network of 16,777, 214 hosts (224 bits for hosts)

10.0.0.1–10.255.255.254

10.0.0.0/24 (16 N and 16 H bits)

=

One network of 254 hosts (216 bits for hosts)

10.0.0.1–10.0.0.254

10.0.1.0/24

=

One network of 254 hosts

10.0.1.1–10.0.1.254

10.0.2.0/24

=

One network of 254 hosts

10.0.2.1–10.0.2.254

     

10.255.254.0/24

=

One network of 254 hosts

10.255.254.1–10.255.255.254

10.255.255.0/24

=

One network of 254 hosts

10.255.255.1–10.255.255.254

A third common occurrence is to take a Class B network and use the Class C default Mask to create 256 networks of 254 hosts per network:

172.16.0.0/16 (16 N bits and 16 H bits)

=

One network of 65,534 hosts (216 bits for hosts)

10.0.0.1–10.255.255.254

172.16.0.0/24 (16 N and 16 H bits)

=

One network of 254 hosts (28 bits for hosts)

172.16.0.1–172.16.0.254

172.16.1.0/24

=

One network of 254 hosts

172.16.1.1–172.16.1.254

172.16.2.0/24

=

One network of 254 hosts

172.16.2.1–172.16.2.254

     

172.16.254.0/24

=

One network of 254 hosts

172.16.254.1–172.16.255.254

172.16.255.0/24

=

One network of 254 hosts

172.16.255.1–172.16.255.254

What we have done in all of these examples is to break down one large network into many smaller, more manageable networks. This is known as subnetting. The next section will show you how to do this for any size of subnet that you may require.

 

 

Вас заинтересует / Intresting for you:

IPv4 Addressing - How It Works...
IPv4 Addressing - How It Works... 1323 views Валерий Павлюков Fri, 04 Feb 2022, 19:02:59
What are IPv4 addresses used f...
What are IPv4 addresses used f... 1229 views Андрей Волков Sat, 13 Feb 2021, 18:42:13
Network, Node and Broadcast Ad...
Network, Node and Broadcast Ad... 1542 views Андрей Волков Sun, 14 Feb 2021, 06:14:12
How to Subnet IPv4 Addresses? ...
How to Subnet IPv4 Addresses? ... 1290 views Валерий Павлюков Sat, 05 Feb 2022, 05:44:19
Comments (0)
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Suggested Locations