Like any computer network, the internet is a con­nec­tion between many computers that com­mu­ni­cate with one another. By now, dividing the huge Internet network into different subnets has become un­avoid­able. To un­der­stand what sub­net­ting is, why it was in­tro­duced, and how to compute a sub­net­mask, it will be useful to first clarify a few basics on computer networks.

$1 Domain Names – Register yours today!
  • Simple reg­is­tra­tion
  • Premium TLDs at great prices
  • 24/7 personal con­sul­tant included
  • Free privacy pro­tec­tion for eligible domains

How does com­mu­ni­ca­tion inside a network take place?

Since 1981, the internet has been operating on the basis of the ‘internet protocol’: a network protocol that regulates the dispatch routes of users. To send a data packet in a network, the trans­mit­ter must know the IP address of the receiver. The Net ID and Host ID are hidden inside the IP address. Thus, the cor­re­spond­ing network and its host – e.g. a PC or a network printer – can be iden­ti­fied. Based on this in­for­ma­tion, routers are able to forward data packets to the correct re­cip­i­ents.

Computers only un­der­stand zeros and ones, so they operate in binary systems and as a result of this, IP addresses are also con­fig­ured in binary. The current operating IPv4 system consists of 32 bits, i.e. 32 zeros or ones. To make it easier to un­der­stand and to save space, IP addresses are usually rep­re­sent­ed in decimal notation, and by dots – the ‘dotted decimal notation’: 192.168.88.3.

Decimal 192 168 88 3
Binary 11000000 10101000 01011000 00000011

Each position cor­re­sponds to a power of two. Whether or not this is added to the sum is indicated by 1 or 0. This means:

1 * 2^7 + 1 * 2^6 + 0 * 2^5 + 0 * 2^4 + 0 * 2^3 + 0 * 2^2 + 0 * 2^1 + 0 * 2^0 = 128 + 64 = 192

This format provides a finite number of possible addresses – to be exact: 232 (i.e. 4.294.967.296) addresses can be assigned. It sounds like a lot, but these addresses are consumed faster than you would think. Sub­se­quent­ly, sub­net­ting was in­tro­duced in 1985.

What is sub­net­ting?

According to a simple sub­net­ting de­f­i­n­i­tion, this means the division of a network into several sub­net­works. For example, sub­net­ting allows network ad­min­is­tra­tors to split their own company network into subnets, without making them known on the internet. That means that the router which even­tu­al­ly connects the network to the internet is still specified as the actual address, but many hosts can be concealed within it. The number of possible hosts available to the ad­min­is­tra­tor is greatly increased. With the in­tro­duc­tion to IPv6, which comprises 128 bits and will replace the older version in the coming years, missing IP addresses will no longer be the main reason for creating subnets.

Note

Because IPv6 addresses with 128 bits are very long, even in decimal notation, they are rep­re­sent­ed in hexa­dec­i­mal. Ad­di­tion­al­ly, bit blocks con­tain­ing only zeroes remain empty in the notation: 2001:620::211:24FF:FE80:C12C. For more in­for­ma­tion, see our internet protocol 6 article.

However, there are even more reasons for sub­net­ting: subnets work in­de­pen­dent­ly and data transfer is faster. Why? Sub­net­ting makes networks easier to manage. A broadcast, which is when a sub­scriber sends data to the entire network, runs rel­a­tive­ly un­con­trolled through a subnet. Subnets are used to route data packets through the router much more specif­i­cal­ly to the receivers. If the sender and receiver are in the same subnet, the in­for­ma­tion can be delivered directly and need not be redi­rect­ed.

When the internet protocol was in­tro­duced, the En­gi­neer­ing Task Force (IETF) had clas­si­fied four types of IP address: A, B, C, D, and E. They recognize the class by the address range in which they are located.

Class A Class B Class C Class D Class E
0.0.0.0 - 127.255.255.255 128.0.0.0 - 191.255.255.255 192.0.0.0 - 223.255.255.255 224.0.0.0 - 239.255.255.255 240.0.0.0 - 255.255.255.255

The class de­ter­mines how many network addresses are available and how many hosts there are in each network. In class A, only the first block of numbers (sometimes called an octet because there is a block of 8 bits) is reserved for the network address, while the three remaining are available for host IDs. This results in fewer networks, but many hosts. In class B, the first two blocks are re­spon­si­ble for the net IDs – that is, more networks but fewer hosts. In class C, only the last octet for the host addresses remain. The class D and E address ranges are reserved but not assigned.

Note

the classes for the size of the networks have been mean­ing­less since 1993. However, since sub­net­ting was in­tro­duced in 1985 and was conceived as a solution to the problem of re­strict­ed network size, it is useful to now un­der­stand the system. The Internet is now based on the principle of Classless Inter-Domain Routing (CIDR). The IP address is no longer the size of a network.

How does sub­net­ting work?

In sub­net­ting, bits are ‘borrowed’ from the host ID to create a subnet. If you only borrow one bit, you have the pos­si­bil­i­ty to create exactly two subnets, because only 0 or 1 are possible. For further subnets, more bits must be released, leaving fewer places for host addresses. IP addresses with a subnet look exactly the same as those without. Even a computer cannot recognize the dif­fer­ence, so ‘sub­net­masks’ are created. If data packets are sent from the Internet to their own network, the router decides which subnet it uses to dis­trib­ute the data. Just like the IPv4 addresses, subnet masks consist of 32 bits (or bytes) and are placed on the address like a mask or template. A typical sub­net­mask looks like this: 255.255.255.128

Hint

The Windows IP address and subnet mask can be found using the command prompt and the command ipconfig.

Again, this can be shown in binary form: 11111111.11111111.11111111.10000000

Now we can make a logical AND com­par­i­son:

IP-Address 11000000 10101000 01011000 00000011
Sub­net­mask 11111111 11111111 11111111 10000000
AND com­par­i­son 11000000 10101000 01011000 00000000

In the com­par­i­son, it is assumed that only the com­bi­na­tion of two ones in the same place yields a one again. All other com­par­isons (1/0, 0/1 and 0/0) yield 0 are not only done by you, the router also performs these cal­cu­la­tions.)
The AND com­par­i­son yields the network address. The host address takes into account all digits that appear in the right-hand area of the zeroes. In our example:

                IP address         192.168.88.3

                Net-ID:                192.168.88.0

                Host-ID:               0.0.0.3

Note

Within a subnet, the first and last IP addresses are only used to a limited extent. The first IP address (this has only zeros in the host part) is called the network address. This means that there are always two hosts less than addresses available.

How do you calculate a sub­net­mask?

We have now shown which con­clu­sions can be made from IP addresses and sub­net­masks. However, network ad­min­is­tra­tors are regularly con­front­ed with another problem: the network address and the number of hosts that must be ac­com­mo­dat­ed in the given subnet. Admin must calculate a sub­net­mask that allows enough hosts, and to do so uses this formula:

x = 2^n - 2.

Since we are still in the binary system, we calculate in powers of two. N cor­re­sponds to the number of bits which are zero in the subnet mask. The value 2 is sub­tract­ed to make the broadcast and network address disappear from the result. X yields the possible hosts.
Let’s say the network ad­min­is­tra­tor has 150 PCs in his network. First, he looks for the next highest power of two. 27 cannot be con­sid­ered since 128 is too small. Therefore he decides on 28-2, thus 254 hosts. The last 8 bits of the sub­net­mask are then 0:

Binary 11111111 11111111 11111111 00000000
Decimal 255 255 255 0

The sub­net­mask 255.255.255.0 allows enough hosts to be released. It should also be noted that you can only generate subnets by borrowing bits from the host part one by one from left to right. This results in the proper structure of the subnet mask and the fact that only nine different values can be used in an octet:

Binary Decimal
00000000 0
10000000 128
11000000 192
11100000 224
11110000 240
11111000 248
11111100 252
11111110 254
11111111 255
Note

Sub­net­masks are often rep­re­sent­ed by a suffix. Instead of spec­i­fy­ing the IP address and subnet mask, you can specify the set of 1-bits as an addendum to the IP address. In our original example: 192.168.88.3 / 25

Why is sub­net­ting so important?

The series of numbers, binary con­ver­sions, and logical com­par­isons have a deterrent effect. Par­tic­u­lar­ly in the context of the approach to IPv6, some might ask them­selves: Is it worth it at all? The answer is clear: yes! This is why sub­net­ting remains useful in the future:

  • Extending the address range within a network: By sub­net­ting, the network ad­min­is­tra­tor can decide how large his networks will be.
  • ast con­nec­tion between hosts of a subnet: Data packets are directly sent from the sender to the receiver and are not routed through the entire network via the router.
  • Improved, logical or­ga­ni­za­tion of network users: in order to keep a better overview of the hosts, it makes sense to segment by local criteria (different buildings or floors) or by de­part­ments.
  • More security: If an external network is attacked, the entire network is quickly threat­ened. Sub­net­ting makes network ad­min­is­tra­tors easier to partition the subnets.
Fact

the opposite of sub­net­ting is called su­per­net­ting: networks or subnets are grouped together and the network share of an address is reduced to allow more hosts within a network.

For medium to larger networks, it is therefore more than rea­son­able to create subnets. The initial effort is extremely useful to the company: the structure of the company network helps to keep the overview and to localize problems more quickly. As is often the case, good order is paid order.

Go to Main Menu