Subnetting and Supernetting
Read these pages for a deeper and more detailed understanding of the need and use of subnetting and supernetting. Make sure that you understand the exact subnet to which an address/mask combination belongs. Once you determine the exact subnet, make sure that you can name the first and last hosts on that subnet, as well as the network name and broadcast address. These are very important principles that need to be mastered.
Classless Interdomain Routing
Supernetting vs Subnetting
- Subnetting is the process where you take a big classful network and divide it into smaller subnetworks by increasing the number of bits representing the network.
- Supernetting, on the other hand, is a process where you might want to increase the number of hosts in a network by increasing the number of bits representing the host, regardless of the class of the network. That’s why it is referred to as Classless Interdomain Routing or CIDR.
CIDR Address Allocation
- CIDR
- As described in RFC 1519
- Allocates the address space into variable sized blocks, regardless of the class.
- Example: The site needs around 2000 addresses,
- 11 contiguous bits designating the host part of the address will generate 211 = 2048 contiguous addresses. That’s the closest to the required 2000 address, but:
- No need to give a full class B address (wasted address space)
- No need to give a class C address (too small for most organizations)
- Similarly, a site needing 8000 addresses will require 13 contiguous bits that will generate 213 = 8192 addresses, etc.
Example 1:
- Customer needs 2000 addresses
- Group of addresses starting at 194.24.0.0 are available.
- You need 11 contiguous bits (211 = 2048). You can accomplish this by giving the customer the group:
- From 11000010 00011000 00000000 00000000 = 194.24.0.0
- To 11000010 00011000 00000111 11111111 = 194.24.7.255
- Mask needed will be:
- 11111111 111111111 11111000 00000000 = 255.255.248.0
- Notice that in the mask, the 11 contiguous bits of the host portion all become 0 so that when the logical AND is done with any host, the result will always be a 0, i.e., it will point to the customer’s address block.
- The rest of the addresses become all ones so that the network part of the address will remain unaltered after the logical AND.
Example 2:
- The customer needs 4000 addresses.
- Can we give this customer the next available block starting at 194.24.8.0?
- No:
- We need 12 contiguous spaces (212 = 4096) to be the closest possible to 4000
- 194.24.8.0 = 11000010 00011000 00001000 00000000, which only provides 11 contiguous bits.
- If we go one bit up, i.e., to 194.24.16.0:
- 194.24.16.0 = 11000010 00011000 00010000 00000000
- 12 contiguous bits are available
- The block of addresses will be:
- From 194.24.16.0 = 11000010 00011000 00010000 00000000
- To 194.24.31.255 = 11000010 00011000 00011111 11111111
- Mask: 255.255.240.0 = 11111111 11111111 1111 0000 00000000
- Why the mask?
- First byte of all 1 “passes” first byte unchanged
- Second byte of all 1 “passes” second byte unchanged
- Next four 1111’s “pass” up to the 4th bit on third byte
- Everything else is masked and become 0 to point to the network
Example 3:
- Third customer wants 1000 addresses.
- We can go back to 192.24.8.0
- Only 10 contiguous bits necessary.
- Assigned block is:
- From 194.24.8.0 = 11000010 00011000 00001000 00000000
- To 194.24.11.255 = 11000010 00011000 00001011 11111111
- And mask:
- 255.255.252.0 = 11111111 11111111 11111100 00000000
Routing Tables for the previous three examples
- Routing tables are now updated with the following three entries:
Base Address |
Mask |
Port |
192.24.0.0 |
255.255.248.0 |
X |
192.24.16.0 |
255.255.240.0 |
Y |
192. 24.8.0 |
255.255.252.0 |
Z |
Default |
W |
Or in binary:
11000010 00011000 00000000 00000000 |
11111111 11111111 11111000 00000000 |
X |
11000010 00011000 00010000 00000000 |
11111111 11111111 11110000 00000000 |
Y |
11000010 00011000 00001000 00000000 |
11111111 11111111 11111100 00000000 |
Z |
How are addresses handled?
- Packet comes with address to 194.24.10.4. Where will it be routed?
- The address will be systematically ANDed with all the masks in the routing table until a match is found.
- For the first entry:
- Address of 11000010 00011000 00001010 00000100 = 194.24.10.4
- ANDed with the mask for the first entry in the table
- The result is 11000010 00011000 00001000 00000000 = 194.24.8.0
- Since this value does not match the base address for that customer (194.24.0.0), it will not be sent to the customer’s router through port A.
- The address (194.24.10.4) is now ANDed with the mask for the second entry in the table.
- Again the process will not yield a match with that customer’s base address.
- It will be next ANDed with the mask for the third entry.
- At this point a match occurs, i.e.,
- ANDing 194.24.10.4 with 255.255.252.0 will result in 194.24.8.0.
- The packet will then be sent to port Z which handles customer’s 3 router.
- Packet will be sent to a “default” route if no match can be found.
- There are some tricks that can be used to avoid searching the table sequentially. This will speed up the process.
Source: Eladio R. Cortes Ramos This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.