Table of Contents
Introduction
Supernetting is the process of combining several smaller IP networks into one larger network. It does the opposite of subnetting. Where subnetting splits a network into many parts, supernetting merges multiple networks into a single route. This is very important for reducing the size of routing tables and improving the scalability of large networks, especially in the global internet.
In this chapter you focus on what makes supernetting unique, how it works with route summarization, and what mathematical rules must be followed to combine networks correctly.
Subnetting vs Supernetting
Subnetting starts with a larger network, then borrows bits from the host portion of the address to create more network bits. This produces many smaller subnets. For example, taking 192.168.0.0/24 and splitting it into /26 subnets creates 4 smaller networks.
Supernetting starts with several smaller networks that already exist and looks for a way to treat them as a single larger block. Instead of borrowing bits from the host portion, supernetting gives bits back from the network portion to the host portion. As a result, the prefix length becomes shorter. For example, combining four /26 networks may lead to a /24 summary.
Conceptually, subnetting moves the prefix length to the right, supernetting moves it to the left.
Why Supernetting Exists
Supernetting is mainly used to reduce the number of routes that routers must store and process. On the public internet, routers may need to handle hundreds of thousands of routes. If each small network appeared as a separate entry, routing tables would grow too large, and routers would need more memory and more processing time.
With supernetting, an internet service provider can advertise a single summary route that represents many customer networks behind it. Inside the provider network, more specific routes may exist, but to the rest of the internet only one or a few summarized routes are visible.
This idea is closely related to route summarization, which you will study in detail later. For now, supernetting is the technical method that makes summarization possible at the IP address level.
Basic Idea of Supernetting with Prefixes
An IPv4 network is usually written with CIDR notation, for example 10.1.0.0/16. The suffix “/16” is the prefix length, the number of bits that identify the network portion.
In subnetting, you take a network like /24 and create networks like /25, /26, /27 and so on. In supernetting, you start with something like several /26 networks and try to represent them with a shorter prefix, such as /25 or /24.
To supernet, you search for the longest common prefix among a set of network addresses. The supernet prefix length is the number of matching bits, from the left, that are the same in all these network addresses.
Once you have that common prefix length, you can write a single summarized network that covers all those addresses.
Rules for Valid Supernets
Not every random group of networks can be combined into a clean supernet. There are strict binary rules that must be satisfied. Because these rules are easy to forget, it helps to have them clearly separated.
A group of networks can form a valid supernet only if all of the following are true:
- All networks have the same prefix length (for example, all are /24, or all are /26).
- The number of networks is a power of 2
(2, 4, 8, 16, 32, and so on). - The networks are contiguous in address space, with no gaps.
- The first network in the group starts at an address that is aligned with the proposed supernet mask.
If any of these rules are broken, a clean summarized supernet with a single prefix is not possible. You may still cover them with a bigger block, but that block will also cover extra addresses that you did not intend to include.
Relationship Between Number of Networks and Prefix Length
When you combine multiple equal sized networks, you must understand how much you are reducing the prefix length.
Suppose you have $2^n$ contiguous networks, all with prefix length $/p$. The resulting supernet of all of them will have prefix length:
$$
p_{\text{supernet}} = p - n
$$
This means that for every factor of 2 by which the number of networks increases, the prefix length is reduced by 1.
If you combine $2^n$ equal sized networks, the supernet prefix is shorter by $n$ bits:
$$
/p \text{ subnet} \Rightarrow 2^n \text{ such subnets} \Rightarrow / (p - n) \text{ supernet}
$$
For example, combining 4 contiguous /26 networks gives a supernet prefix of /24, because $4 = 2^2$ and $26 - 2 = 24$.
Finding the Supernet: Bitwise View
To understand supernetting it helps to look at bits. Consider two example networks:
192.168.4.0/24
192.168.5.0/24
Write the network addresses in binary, focusing on the last octet.
192.168.4.0
Fourth octet: $4 = 00000100_2$
192.168.5.0
Fourth octet: $5 = 00000101_2$
Compare the bits from the left. In the last octet, the first 6 bits are the same, the 7th bit is different:
00000100
00000101
So, across the full 32 bits, these two networks share 23 bits in common. That means the supernet would be something like 192.168.4.0/23 or 192.168.4.0/23 and 192.168.5.0/23, depending on correct alignment.
However, you must still check the rules. Two /24 networks is $2^1$ networks, so you expect a supernet prefix of $24 - 1 = 23$. That matches your observation from the bit comparison.
The supernet must start at the lowest network that has those 23 bits in common, which is 192.168.4.0/23. This single /23 covers both /24 networks, from 192.168.4.0 to 192.168.5.255.
Step by Step Supernetting Example
Consider this set of networks, all /26:
192.168.1.0/26
192.168.1.64/26
192.168.1.128/26
192.168.1.192/26
Step 1, check that all have the same prefix length. They are all /26, so this condition is met.
Step 2, count how many networks you have. There are 4, which is $2^2$.
Step 3, verify that they are contiguous. For a /26, the block size in the last octet is 64 addresses. The network ranges are:
192.168.1.0 to 192.168.1.63
192.168.1.64 to 192.168.1.127
192.168.1.128 to 192.168.1.191
192.168.1.192 to 192.168.1.255
There are no gaps, they follow one right after the other.
Step 4, calculate the supernet prefix. You are combining 4 networks, and $4 = 2^2$. Using the formula:
$$
p_{\text{supernet}} = 26 - 2 = 24
$$
So the supernet should be a /24.
Step 5, find the starting network address. The first network in the group is 192.168.1.0. Since you are moving to a /24, the network boundary in the third octet is 1, and the last octet resets to 0.
So the supernet is 192.168.1.0/24. This single prefix covers all four original /26 networks.
Alignment and Block Size
To verify that an address is aligned with a certain prefix, you can use the idea of block size. For IPv4, block size in a given octet is:
$$
\text{Block size} = 256 - \text{octet value of the mask}
$$
for the first octet where the mask is neither 255 nor 0. For example, with a /24 mask, the mask is 255.255.255.0. In the last octet, the mask value is 0, and the block size is $256 - 0 = 256$. That means a /24 starts only on .0, .0 is the only aligned value in the last octet.
For a /23, the mask is 255.255.254.0, so in the third octet, the mask value is 254. The block size for that octet is:
$$
256 - 254 = 2
$$
So any /23 network must start at a third octet that is a multiple of 2. Examples are x.x.0.0/23, x.x.2.0/23, x.x.4.0/23, and so on.
If your group of networks does not start at such an aligned boundary, then a clean supernet at that prefix length is not valid.
To be a valid supernet for prefix length /p:
- The starting network address must align with the block size at /p.
- The starting value in the relevant octet is a multiple of the block size.
Example with Alignment Check
Assume you want to summarize these two /24 networks into a /23:
10.0.4.0/24
10.0.5.0/24
From earlier, you know that 2 networks of /24 can form a /23. The mask for a /23 is 255.255.254.0. The block size in the third octet is $256 - 254 = 2$. That means valid /23 networks in the third octet are:
0, 2, 4, 6, 8, and so on.
Your lowest network is 10.0.4.0, and 4 is a multiple of 2, so the starting network is aligned. Therefore 10.0.4.0/23 is a valid supernet that covers 10.0.4.0/24 and 10.0.5.0/24.
Now consider:
10.0.5.0/24
10.0.6.0/24
You again have 2 /24 networks, so a /23 might be possible. Valid /23 networks start at third octet values that are multiples of 2. The lowest is 5, which is not a multiple of 2. That means there is no properly aligned /23 that contains exactly those two /24s. The clean /23 boundaries around them are:
10.0.4.0/23 covers 10.0.4.0 to 10.0.5.255
10.0.6.0/23 covers 10.0.6.0 to 10.0.7.255
So you cannot summarize only 10.0.5.0/24 and 10.0.6.0/24 without also including extra addresses.
Practical Supernetting Examples
It helps to see a few more examples, with the pattern of how the prefix changes.
| Original networks | Count | Original prefix | Power of 2 | Supernet prefix | Supernet result |
|---|---|---|---|---|---|
| 172.16.0.0/24, .1.0/24 | 2 | /24 | $2^1$ | /23 | 172.16.0.0/23 |
| 172.16.0.0/25, .0.128/25 | 2 | /25 | $2^1$ | /24 | 172.16.0.0/24 |
| 192.0.2.0/26, /26 x 4 nets | 4 | /26 | $2^2$ | /24 | 192.0.2.0/24 |
| 10.1.0.0/24 x 8 contiguous | 8 | /24 | $2^3$ | /21 | 10.1.0.0/21 |
For the last line, 8 is $2^3$, so you reduce the prefix length by 3 bits, from /24 to /21.
Supernetting and Route Summarization
In routing, especially in large networks, administrators usually look at which routes can be advertised as a single summary. The process they follow on the addresses is supernetting. At internal borders or between providers, they want as few advertised routes as possible, because each route takes memory and CPU to handle.
For example, imagine a router has these internal networks:
10.10.0.0/24
10.10.1.0/24
10.10.2.0/24
10.10.3.0/24
These can be supernetted into 10.10.0.0/22, which covers 10.10.0.0 to 10.10.3.255. Instead of advertising four separate routes, the router can advertise a single route 10.10.0.0/22 to its neighbors.
If, later, a fifth internal network 10.10.4.0/24 is added, it does not fall inside 10.10.0.0/22. The administrator has to decide whether to advertise a more general, larger summary that includes everything, or to advertise multiple routes. That design choice belongs to routing and summarization decisions, but the mechanism is still supernetting.
Binary Method to Compute a Supernet
When dealing with addresses that do not immediately show their pattern, you can use a bitwise method.
- Write the network addresses of all candidate networks in binary.
- Starting from the leftmost bit, count how many consecutive bits are identical across all addresses.
- The number of matching bits is the prefix length of the possible supernet.
- Convert those matching bits back to dotted decimal for the network address.
- Verify that the resulting block exactly covers all original networks without including unwanted ones, and that the original networks are all equal sized and contiguous.
For a small number of networks, doing this by hand is possible. For large groups, tools and software are normally used.
Limitations and Tradeoffs
Supernetting is very useful, but it has tradeoffs. If a supernet is too large, it might advertise reachability for addresses that do not actually exist in the network behind it. Traffic for those addresses may be dropped, causing inefficient routing or blackholes, depending on how the network is designed.
On the other hand, if you avoid supernetting and advertise each small network separately, your routing tables become large and harder to manage. The correct balance depends on the design of the network, the routing protocols used, and how stable or dynamic the address allocations are.
For public internet routing, there are often policies that prefer or even require aggregation and discourage announcing many small prefixes when a larger summarized prefix is possible.
Summary
Supernetting combines multiple equal sized, contiguous networks into a larger block with a shorter prefix length. It is the opposite process of subnetting. Valid supernets must satisfy strict rules about equal prefix length, contiguity, power of two counts, and alignment with the supernet mask.
In practice, supernetting underlies route summarization. It lets routers advertise a single route for many internal networks, which keeps routing tables small and networks scalable. Understanding how to count networks, adjust prefix lengths, and check alignment prepares you to work with summarization and more advanced routing topics later in the course.