Customer support +49 (40) 59380 500
Mon - Fri 9:00 - 17:00

ScaleUp Blog

  • Home
  • Blog
  • What is and how does subnetting work?

What is and how does subnetting work?

Without subnetting, the Internet would collapse under the data load in seconds. But how exactly does subnetting actually work and what advantages does it have? How does an IP address read? These questions are answered in this first article of our blog series on IP addresses.

Definition subnetting

Subnetting is the formation of subnets within a contiguous address space of IP addresses.

A subnet is a physical segment of a network in which IP addresses with the same network address are used. These subnets can be connected to each other via routers and then form a large coherent network.

Reasons for subnetting

Why is subnetting important?

  • There are not enough IP addresses. Subnetting allows networks to be separated from each other and private IP addresses can also be assigned twice.
  • Network Relief: The larger a network, the more devices want to send their data packets at the same time, and the greater the network load. Without subnetting, the WWW would collapse in seconds, simply due to Hello packets. Conversely, the more subnets there are, the less traffic there is within the networks.
  • Improved network performance: If the sender and receiver of the data packets are in the same network, the data packets do not have to pass through different networks and routers. This also increases network performance.
  • Structured address assignment: System administrators can create a logical structure for assigned IP addresses. This improves clarity and makes their work much easier.
  • More security: Subnetting increases security because individual networks are separated from each other. Attacks must first reach other network sections to spread further. (Firewalls in the connecting network routers).

Net IP and Host IP

To understand subnetting, it is first important to understand the structure of IP addresses. An IP address is a unique sequence of numbers assigned to each device on a TCP/IP network. Currently, there are two commonly used variants of IP addresses: IPv4 and IPv6. IPv4 is still most commonly used for private networks and is easier to understand than IPv6. For  this article  we will therefore limit ourselves here to IPv4. You can find more knowledge about advantages of IPv6 in our "IPv6: Explanation, Advantages, Outlook" article.

An IP address essentially consists of two elements:

  • the network address
  • and the host address

The information about the network address is important for the delivery of data packets. Thereby the network address or also Net-IP roughly comparable to a postal code. It determines a subnet in whose area the host address falls. The host address (Host ID) in turn is comparable to a street/house number of a destination address. It is assigned to a special host within the subnet.

All computers in a local network (e.g. in the office network) where the network share is the same are in the same subnet and can communicate with each other. Here, the network address is identical for the source and destination address and the data packet can be delivered within the subnet without further routing. If the network addresses are different, the data packet must be routed via the standard gateway (default gateway) to a different subnet. Requests and data packets are therefore first sent to the Net IP of a specific router, as in a letter sorting system, which then distributes them to the respective host.

IPv4

An IPv4 address consists of 4 bytes (32 bits) represented by 4 octets. Each 8 bits are separated by a dot using a 3-digit numeric sequence (e.g. 192.168.12.0).

Decimal vs. bit notation

We stay with the example IP address: 192.168.12.0 Each octet consists of 8 bits each. In the binary system, each individual bit stands for a number that results from the power (0-7) of 2. Because for each bit position the computer can receive two possible signals: Current on (1) or Current off (0). This results in 2(to the power of)8=256 variants. Each octet can thus take the minimum value 0 and the maximum numerical value of 255. 

The decimal value of the octet results from the sum of the activated bits. At the maximum value 255 all bit positions have the value 1. For the first octet in our example with the value 192 the first two bits are set to 1 and the rest to zero. The value 168 (2nd octet) results from the sum of the bit values 128, 32 and 8. and so on.

IPv4 Binary notation
Example for binary notation of an IPv4

What is the subnet mask?

The subnet mask determines the network portion (subnet) and the remaining host portion of an IP address. The subnet mask thus indicates where this separation of network address and host address should take place and how many bits remain for the host part. There are two common notations for the subnet mask, one with octets and one as a suffix notation:

Example: 192.168.12.15 / 255.255.255.0 OR 

                192.168.12.15 / 24 (Suffix notation determines net prefix) 

The subnet mask is always separated by a "/" after the IP address. The "255" values in the longer form indicate that all bit values here are assigned 1 for the network portion. They are not available for the host assignment. The "zero" range in the rear octets thus determines the remaining host portion for the IP assignment.

In suffix notation, the suffix (the number after the "/") determines the network prefix, i.e. the number of bits allocated to the network address. With a suffix of 24, 8 bits (1 octet) remain for the host portion. The first 24 places are occupied by 1 for the network. For machines, however, the subnet mask is readable in binary notation. Here the subnet mask also consists of a contiguous sequence of 1 and 0. 

The following table contains typical subnet masks. With 32 bits, the subnet mask is just as long as any IP address. The above-mentioned suffix after the IP address specifies how many 1s follow one another within the subnet mask in bit notation. 24 therefore means 255.255.255.0 for the network ID.

Available host addresses in a subnet

Network address & broadcast address

The /30 subnet has the smallest possible network portion, which can only include two host IPs. Why are there only 2 IP host addresses for /30 and not 4 (22=4)? This is because the first and last IP addresses are required for delimiting the address range. The smallest host IP, here".252" stands for the designation of the Network address and ".255" for the Broadcast address (BC address). These addresses are therefore occupied and cannot be assigned to any host. For this reason, the number of available IP addresses within a subnet is reduced by two IPs each for the network and broadcast IP address.

Subnet mask and network address
Subnetting example

In the above example, the network address or net address would be 192.168.12.0 and the broadcast address 192.168.12.255. The broadcast address is used to send data packets to all active hosts at the same time, e.g. so-called "Hello packets" that a host sends when it is activated. Every client contained in the network (every terminal, every router and every switch) receives the request or must send a response. The first free host address in the example would therefore be 192.168.12.1 and the last possible host address would be 192.168.12.254.

Conclusion

Among other things, subnetting improves performance and increases security in networks. Once you get to grips with the basics, it's not as complicated as long IPs and subnet mask tables might suggest. We hope that this article will help users better understand how the Internet and hosting processes work.

ScaleUp is a business hosting company with 20 years of hosting experience. We operate state-of-the-art colocation and server housing space as well as cloud infrastructures based on OpenSource technologies (OpenStack, Kubernetes) at a total of 6 data center locations in Hamburg, Berlin and Düsseldorf. We are glad to be at your disposal for Queries available.

Contact

Are you interested in a consultation or do you have questions about our services?

Where is Open Compute headed? Impressions from OCP Summit 2022

This year, the annual global Open Compute Project Summit took place in San José (CA) from October 18-20. We were there ourselves and want to share some of our impressions here.

Special features of OpenCompute Servers - How OCP hardware differs from classic hardware.

After our introduction to OpenCompute hardware, in this post of our OCP series we want to go into a bit more detail about the design of OpenCompute hardware, specifically the server design and how it differs from classic hardware.

Open Compute Hardware Makes Data Centers Fit for Green IT

Open Compute Hardware (OpenSource Hardware) has enormous potential to sustainably improve resource efficiency in data centers. What is the Open Compute Project (OCP)?

Autoscaling in Kubernetes

One of the great promises of using Kubernetes is the ability to scale infrastructure dynamically, based on user requirements. However, by default, Kubernetes does not automatically add or remove instances. To do this, the Kubernetes...

Stay In Contact

Get the latest information and blog articles on cloud, open compute and sustainable data centers in our bimonthly newsletter.

ScaleUp Technologies