Skip to content
English
On this page

IP Subnetting

In order to understand how IP addressing works you need to understand binary mathematics (unfortunately). Computers and networking equipment do not understand decimal. We use decimal because it is a numbering system that uses 10 digits. It was invented by a caveman centuries ago when he realized we all have 10 digits on our hands and they could be used for counting buffalo as they walked past his cave.

IP Addressing

So now we understand that an IP address is made up from binary numbers which are grouped into octets. The reason for this is that when IP addressing was first conceived, it was determined that this number would be more than enough for many years to come. Unfortunately, the huge growth of home and mobile devices and business computing was never anticipated. IPv6 has 340 trillion trillion trillion available addresses, so that should last well into the future.

IP (version 4) addresses are broken down into classes. Classes were used when IP addresses were first developed. How large your organization was, dictated which class of IP address you were given. Large organizations were allocated Class A, medium ones Class B, and small ones Class C.

IN THE REAL WORLD: IP addresses are assigned by a group called the IANA (Internet Assigned Numbers Authority). You can also buy one from an ISP that has bought a block from the IANA.

Class A Addresses

Class A addresses are numbered 1 to 126 in the first octet. Network equipment identifies a Class A address because the very first bit in the first octet has to be a 0. A Class A address cannot have a 1 in this bit position

So the first network number is 1.

2561286432168421
000000001

The last possible network number is 127 (check by adding all the values together). Network number 127 cannot actually be used because the value 127.0.0.1 is reserved for troubleshooting. You can ping the loopback address to check if TCP/IP is working on your host

2561286432168421
011111111

Historically, these were given to the largest organizations, which would need a tremendous number of IP addresses since they owned more computers than everyone else. Class A addresses use only the first octet to identify the network number. The remaining three octets are left for identifying the hosts on the network.

Network.Host.Host.Host 10.2.5.4

So the network is 10 and 2.5.4 is a host on that network. In binary it would look like: nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh 00001010.00000010.00000101.00000100

Class B Addresses

Class B addresses were reserved for large organizations that needed a lot of host numbers but not as many as the largest ones. Unfortunately, when a Class B address was assigned to an organization, it resulted in thousands of wasted host addresses. Class B addresses have to have the first two binary values in the first octet reserved with a 1 and a 0 next to it. So the first network number is 128. We have all the available network bits in the first octet turned off.

2561286432168421
100000000

The last available Class B network number is 191 (add the values together). Here we have turned the all network bits on (in the first octet).

2561286432168421
101111111

Class C Addresses

These were originally reserved for any organization that was not large enough to warrant having a Class A or B address. A Class C address has the first 3 bits reserved, so the network device can recognize it as such. The first 3 bits must show as 110.

The first network number is 192. All the other network bits are off (0).

2561286432168421
100000000

The last is 223. This time all the network bits are on (in the first octet).

2561286432168421
110111111
ClassLeading bitsSize of network number bit fieldSize of rest bit fieldNumber of networksAddresses per networkTotal addresses in classStart addressEnd addressDefault subnet mask in dot-decimal notationCIDR notation
Class A0824128 16,777,216 2,147,483,648 0.0.0.0127.255.255.255255.0.0.0/8
Class B10161616,384 65,536 1,073,741,824 128.0.0.0191.255.255.255255.255.0.0/16
Class C1102482,097,152 256 536,870,912 192.0.0.0223.255.255.255255.255.255.0/24
Class D (multicast)1110not definednot definednot definednot defined268,435,456 224.0.0.0239.255.255.255not definednot defined
Class E (reserved)1111not definednot definednot definednot defined268,435,456 240.0.0.0255.255.255.255not definednot defined