A subnet is a subnet of a network in the Internet Protocol (IP). It combines several consecutive IP addresses by means of a subnet mask (in the case of IPv6 one speaks of the prefix length) at binary boundaries under a common front part, the prefix. A scheme for subdividing networks was introduced in 1985 and standardized for the first time in RFC 950 , followed by the method used today called Classless Inter-Domain Routing in 1993 . In administratively independent areas, so-called autonomous systems , one or more subnets are always managed, which in turn can be divided into smaller subnets.
The subnet area is separated by masking a certain part of the IP address bit by bit using the subnet mask . This gives you the subnet to which the address belongs, assuming this mask, from any address. To designate a specific subnet, enter the first address in this subnet together with the subnet mask or prefix length. Since the mask notation for IPv4 with four decimal numbers is not very compact and cumbersome to use, the number of binary ones is often given as the prefix length instead. For example, subnet mask 255.255.0.0 is in binary 1111 1111.1111 1111.0000 0000.0000 0000 and is therefore given as the prefix / 16. The prefix representation has established itself for IPv6 from the beginning.
Subnets as a representation of IP networks are used in routing tables and filter definitions in routing protocols as well as in packet filters . The Internet is structured by routing between subnetworks.
Network classes and early subnetting
IPv4 addresses were generously designed and a limited number of large, medium and small IP networks were specified. IP addresses consist of two parts, a power supply and a host part. The power supply unit specifies in which IP network a computer is located and the host part identifies a computer within this IP network. Until 1993, IPv4 networks were divided into classes using a fixed mask. Class A networks from 0.0.0.0 to 127.255.255.255 had the mask 255.0.0.0, or / 8. So the first octet of the IP address was the power supply and the remaining three octets could be used to address hosts in the networks. Class A networks were correspondingly large; more than 16 million hosts could be addressed in a class A network.
Other fixed masks were 255.255.0.0, or / 16, for class B networks from 18.104.22.168 to 22.214.171.124. These were medium sized networks where the last two octets could address up to 65,534 hosts in a class B network. Small class C networks from 192.0.0.0 to 126.96.36.199 were identified with the mask 255.255.255.0, or / 24. Here only the last octet was available for host addressing, and there could only be 254 hosts in a class C network. (see network class )
The Internet Assigned Numbers Authority at that time (IANA) awarded only full IP networks, the 128 Class A networks were awarded to large international companies, the network 188.8.131.52 includes, for example Apple and 184.108.40.206 of the Ford Motor Company. However, because different IP networks were required for different company locations, the owners of class A and B networks began to subdivide these into smaller subnets using subnetting. For this purpose, the power supply unit of the IP address is extended by extending the mask: if the mask of the 220.127.116.11 network is extended by one bit to / 9, two subnets are created: one from 18.104.22.168/9 to 22.214.171.124/9 and Subnet two from 126.96.36.199/9 to 188.8.131.52/9. If the mask is extended by two bits, four subnets can be established, with three extra bits eight subnets could be established, and so on. An extended mask was now called a subnet mask and had to be specified with the IP address so that it could be seen in which subnet a computer was located.
IANA soon assigned all class A and B networks and now had to assign several small class C networks, which can only address 254 hosts per network, to companies and Internet providers. In order to prevent the impending shortage of IPv4 addresses, IANA also released so-called private IPv4 addresses in each network class , which were not routed in the Internet. Through Network Address Translation computer in were local network are addressed privately and connect IPv4 address to the Internet through a public. Internet providers, for example, could only give their customers one public IPv4 address.
Classless inter-domain routing
In 1993, with Classless Inter-Domain Routing (CIDR), the fixed masks for IPv4 addresses were abandoned. IPv4 addresses must now be specified with a network mask in order to separate the network part of the address from the host part. Subnetting, i.e. the subdivision of IP networks into smaller subnets by extending the network share, has been standardized. IANA was now able to assign subnets, but also to combine several small class C networks through supernetting . CIDR also standardized the Variable Length Subnet Mask , where a subnet is in turn divided into subnets by extending the network mask again.
The network masks consist of a number of contiguous binary ones, followed by binary zeros for padding to 32 bits in the case of IPv4 and 128 bits in the case of IPv6. Thus there are 33 possible prefix lengths for IPv4 and 129 for IPv6.
Use on network segments
A common use of subnets is to assign an address range to a network segment. Computers on this network segment are assigned addresses from the range of the respective subnet.
For technical reasons, two of the addresses can be used with restrictions. These are:
- The first IP address in the subnet (host share only zeros) - this address is the network address of the subnet. This address was also used as a broadcast address by Windows 9x . If there are no Windows 9x computers (Win 95, Win 98, Win ME) in the network segment, this address can be used freely.
- The last IP address in the subnet is also used as the broadcast address by default. However, many systems now also support the use of a network without a broadcast address. If all systems in the network segment support this, it can be deactivated anywhere and then used normally.
The computers on the network segment use the subnet information to determine whether a specific IP address is on the same segment. The test described at the beginning of this article is performed. Depending on the result, an attempt is then made to reach the address locally (via ARP ) or remotely (via a router).
Freely available auxiliary programs are available for calculating network areas from given addresses and prefix lengths in different notations. ipcalc or SubnetMaster does this for IPv4 , sipcalc works for IPv4 and IPv6 .
- Sascha Kersken IT manual for IT specialists , Rheinwerk Computing, edition 7 with corrections, 2016, pages 227 and 228
- Sascha Kersken IT manual for IT specialists , Rheinwerk Computing, edition 7 with corrections, 2016, pages 227 and 249
- Sascha Kersken IT manual for IT specialists , Rheinwerk Computing, edition 8, 2017, page 225 ff.