Subnetting #
Subnetting is the process of designating some high-order bits from the host part as part of the network prefix and adjusting the subnet mask appropriately. This divides a network into smaller subnets. The following diagram modifies the subnet mask example by moving 2 bits from the host part to the network prefix to form four smaller subnets each one quarter of the previous size.
Binary form | Dot-decimal | |
---|---|---|
IP address | 11000000.00000000.00000010.10000010 |
192.0.2.130 |
Subnet mask | 11111111.11111111.11111111.11000000 |
255.255.255.192 |
Network prefix | 11000000.00000000.00000010.10000000 |
192.0.2.128 |
Host part | 00000000.00000000.00000000.00000010 |
0.0.0.2 |
- Enables a much more efficient use of IP addresses compared to class blocks .
- Don’t think about in terms of network IDs and subnet masks but as binary numbers
Short hand #
- Seven second subnetting - Professor Messer
Calculating hosts #
2^x - 2 = number of hosts possible on a given subnet
Where x is the number of binary digits you have remaining after the subnet
mask. In the following example we extend from /24
to /26
creating 4 subnets.
That leaves 6 bits remaining for each subnet. That gives us 2^6 = 64 and
64 - 2 = 62.
Making a Subnet #
- Start with a single network ID. In this example we’ll convert
192.168.4.0/24
into 4 subnets. - Convert network ID from step 1 to binary:
11000000.10101000.00000100.00000000
- How many subnets are you trying to create? In this example we’re trying to
create 4 unique subnets.
- The formula for determining how many subnets you create is 2^y.
- Using this formula 2^2 = 4 and therefore we need to extend the subnet down to
/26
because y=2. Note: you extend the subnet down by ‘y’ binary digits to create the number of subnets 2^y. - Extend the network ID by y digits and write out all possible subnets in
binary.
- 4 new network IDs with
/26
as a subnet mask:
11000000.10101000.00000100.00000000 11000000.10101000.00000100.01000000 11000000.10101000.00000100.10000000 11000000.10101000.00000100.11000000
_Note: the extension of the network IDs to the 26th bit._
- 4 new network IDs with
- Convert network IDs back to dotted decimal
Network ID Host Range Broadcast Address 192.168.4.0/26 192.168.4.1 - 192.168.4.62 192.168.4.63 192.168.4.64/26 192.168.4.65 - 192.168.4.126 192.168.4.127 192.168.4.128/26 192.168.4.129 - 192.168.4.190 192.168.4.191 192.168.4.192/26 192.168.4.193 - 192.168.4.254 192.168.4.255 _Note: The first and last address in the subnet are always reserved for the network ID and broadcast address._