Featured image

Table of Contents Link to heading

Subnet or Subnetwork Link to heading

Info
A logical subdivision of an IP network.

Subnetting Link to heading

Info
The method of dividing full network address classes into smaller pieces.
  • Complete IP address exhaustion has been prevented.
  • Network traffic can travel a shorter distance without passing through unnecessary routers to reach its destination.

Subnet Mask Link to heading

Info
The number of bits of the network part of the IP address.
  • 255.255.255.0 in bits is equal to 11111111.11111111.11111111.00000000
  • The zeros are host bits, the ones are network bits.

CIDR Prefix or Prefix Length Link to heading

Info
Equivalent to the number of ones in the subnet mask in binary, represented as a slash followed by a number that represents the number of bits in the prefix.
Subnet MaskCIDR Prefix
0.0.0.0/0
128.0.0.0/1
192.0.0.0/2
224.0.0.0/3
240.0.0.0/4
248.0.0.0/5
252.0.0.0/6
254.0.0.0/7
255.0.0.0/8
255.128.0.0/9
255.192.0.0/10
255.224.0.0/11
255.240.0.0/12
255.248.0.0/13
255.252.0.0/14
255.254.0.0/15
255.255.0.0/16
255.255.128.0/17
255.255.192.0/18
255.255.224.0/19
255.255.240.0/20
255.255.248.0/21
255.255.252.0/22
255.255.254.0/23
255.255.255.0/24
255.255.255.128/25
255.255.255.192/26
255.255.255.224/27
255.255.255.240/28
255.255.255.248/29
255.255.255.252/30
255.255.255.254/31
255.255.255.255/32

Borrowing Host Bits Link to heading

Info
For every borrowed host bit, the network size is split in half, thereby doubling the number of subnets and halving the maximum number of addresses per subnet.
CIDR Prefix# IP Addresses = 2n# Usable IP Addresses = 2n-2
/3211
/3122*
/3042
/2986
/281614
/273230
/266462
/25128126
/24256254
/23512510
/2210241022
/2120482046
/2040964094
/1981928190
/1816,38416,382
/1732,76832,766
/1665,53665,534
/15131,072131,070
/14262,144262,142
/13524,288524,286
/121,048,5761,048,574
/112,097,1522,097,150
/104,194,3044,194,302
/98,388,6088,388,606
/816,777,21616,777,214
/733,554,43233,554,430
/667,108,86467,108,862
/5134,217,728134,217,726
/4268,435,456268,435,454
/3536,870,912536,870,910
/21,073,741,8241,073,741,822
/12,147,483,6482,147,483,646

/31 Networks Link to heading

Info
The use of /31 networks is a special case defined by RFC 3021 where the two IP addresses in the subnet are usable for point-to-point links to conserve IPv4 address space.

On systems that do not support RFC 3021, the subnet is unusable because the only two addresses provided by the subnet mask are reserved: one for the network address and the other for the broadcast address; therefore, there is no usable host addresses.

Subnetting Tips Link to heading

  • A network address will always end with an even number.
  • A broadcast address will always end with an odd number.
  • Since .255 is the last address in an octet, the point after which is the next octet.
    • For example, if the current network’s broadcast address is 192.168.0.255, the network address for the next network (if there is one) will be 192.168.1.0.

Classful Subnetting Link to heading

Consider a class C network (/24):

  • Since it leaves 8 bits for hosts, it allows for 28 = 256 IP addresses in a single network.
  • Two of these are reserved for the network address (first address) and the broadcast address (last address).
  • Thus, the number of usable hosts per network is 28 โ€“ 2 = 254 IP addresses.

Given an address 192.168.1.0/24, its network will be:

  1. Network Address: 192.168.1.0
  2. First Host Address: 192.168.1.1
  3. Last Host Address: 192.168.1.254
  4. Broadcast Address: 192.168.1.255

Classless Subnetting Link to heading

Abbreviation note: n=network, h=host

Subnetting a Class C (/24) Network Link to heading

CIDR PrefixSubnet MaskSubnet Mask in Binary# Subnets# Hosts
/25255.255.255.128nnnnnnnn.nnnnnnnn.nnnnnnnn.nhhhhhhh
11111111.11111111.11111111.10000000
2128
/26255.255.255.192nnnnnnnn.nnnnnnnn.nnnnnnnn.nnhhhhhh
11111111.11111111.11111111.11000000
464
/27255.255.255.224nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnhhhhh
11111111.11111111.11111111.11100000
832
/28255.255.255.240nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnnhhhh
11111111.11111111.11111111.11110000
1616
/29255.255.255.248nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnnnhhh
11111111.11111111.11111111.11111000
328
/30255.255.255.252nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnnnnhh
11111111.11111111.11111111.11111100
644
/31255.255.255.254nnnnnnnn.nnnnnnnn.nnnnnnnn.nnnnnnhh
11111111.11111111.11111111.11111100
1282

Subnetting a Class B (/16) Network Link to heading

CIDR PrefixSubnet MaskSubnet Mask in Binary# Subnets# Hosts
/17255.255.128.0nnnnnnnn.nnnnnnnn.nhhhhhhh.hhhhhhhh
11111111.11111111.10000000.00000000
232,768
/18255.255.192.0nnnnnnnn.nnnnnnnn.nnhhhhhh.hhhhhhhh
11111111.11111111.11000000.00000000
416,384
/19255.255.224.0nnnnnnnn.nnnnnnnn.nnnhhhhh.hhhhhhhh
11111111.11111111.11100000.00000000
88,192
/20255.255.240.0nnnnnnnn.nnnnnnnn.nnnnhhhh.hhhhhhhh
11111111.11111111.11110000.00000000
164,096
/21255.255.248.0nnnnnnnn.nnnnnnnn.nnnnnhhh.hhhhhhhh
11111111.11111111.11111000.00000000
322,048
/22255.255.252.0nnnnnnnn.nnnnnnnn.nnnnnnhh.hhhhhhhh
11111111.11111111.11111100.00000000
641,024
/23255.255.254.0nnnnnnnn.nnnnnnnn.nnnnnnhh.hhhhhhhh
11111111.11111111.11111100.00000000
128512

Subnetting a Class A (/8) Network Link to heading

CIDR PrefixSubnet MaskSubnet Mask in Binary# Subnets# Hosts
/9255.128.0.0nnnnnnnn.nhhhhhhh.nnnnnnnn.hhhhhhhh
11111111.10000000.11111111.00000000
28,388,608
/10255.192.0.0nnnnnnnn.nnhhhhhh.nnnnnnnn.hhhhhhhh
11111111.11000000.11111111.00000000
44,194,304
/11255.224.0.0nnnnnnnn.nnnhhhhh.nnnnnnnn.hhhhhhhh
11111111.11100000.11111111.00000000
82,097,152
/12255.240.0.0nnnnnnnn.nnnnhhhh.nnnnnnnn.hhhhhhhh
11111111.11110000.11111111.00000000
161,048,574
/13255.248.0.0nnnnnnnn.nnnnnhhh.nnnnnnnn.hhhhhhhh
11111111.11111000.11111111.00000000
32524,288
/14255.252.0.0nnnnnnnn.nnnnnnhh.nnnnnnnn.hhhhhhhh
11111111.11111100.11111111.00000000
64262,144
/15255.254.0.0nnnnnnnn.nnnnnnhh.nnnnnnnn.hhhhhhhh
11111111.11111100.11111111.00000000
128131,072

Example Link to heading

To divide the 192.168.1.0/24 network into two equal subnetworks (e.g., network A and network B), borrow one host bit to obtain the /25 network.

  • Since it leaves 7 bits for hosts, it allows for 27 = 128 IP addresses in a single network.
  • Two of these are reserved for the network address (first address) and the broadcast address (last address).
  • Thus, the number of usable hosts per network is 27 โ€“ 2 = 126 IP addresses.

Network A (128 hosts):

  1. Network Address: 192.168.1.0
  2. First Available Host Address: 192.168.1.1
  3. Last Available Host Address: 192.168.1.126
  4. Broadcast Address: 192.168.1.127

Network B (128 hosts):

  1. Network Address: 192.168.1.128
  2. First Available Host Address: 192.168.1.129
  3. Last Available Host Address: 192.168.1.254
  4. Broadcast Address: 192.168.1.255

By knowing one network address and the magic number, we can explore all other addresses in the network:

  1. Network address of the next network is exactly 128, called the magic number, after the previous network address.
  2. The previous network’s first available host address is one host after its network address.
  3. The previous network’s broadcast address is one host before the next network address.
  4. The previous network’s last available host address is one host before its broadcast address.

Variable-Length Subnet Masks (VLSMs) Link to heading

Info
A division of a large network into subnets of various sizes to ensure that each subnet is allocated an adequate number of hosts, preventing wasting IP addresses.
  • Consider a Class C network that uses /28, there will be 16 subnets of equal size, each with 14 usable IP addresses. If one of the subnet is a point-to-point network, which needs only two IP addresses, 12 IP addresses are wasted.
  • This problem scales further with Class B and Class A address spaces.
  • With VLSMs, small LANs can use /28 subnets with 14 hosts, and larger LANs can use /23 and /22 masks with 510 and 1022 hosts, respectively. Point-to-point networks can use a /30 mask which provides two hosts.

Best practice is to divide large networks into smaller subnets that can be assigned to sites. Further divide each site subnet into smaller subnets for data, VoIP, wireless LAN, and other subnets to be used in site VLANs. Furthermore, router/switch loopback addresses, WAN, and point-to-point links are also allocated separate IP subnets.

Simple Demonstration Link to heading

The goal is to divide the network 192.168.1.0/24 into three unequal subnets:

  • 1 the size of 125 hosts
  • 1 the size of 8 hosts
  • 1 the size of 220 hosts

Although the default subnet mask is /24 (class C network), in order to house this number of hosts (220+125+8=353 hosts), the /23 network is required as the network size is doubled (510 usable hosts in total).

  • Available address space: 192.168.1.0 - 192.168.2.255
Tip
The VLSM process commences with the network requiring the largest number of hosts to the network requiring the smallest number of hosts and considers only the number of usable hosts in a subnet mask.

Network A (220 hosts): 192.168.1.0/24 โžก provides 254 usable hosts

  1. Network Address: 192.168.1.0
  2. First Available Host Address: 192.168.1.1
  3. Last Available Host Address: 192.168.1.254
  4. Broadcast Address: 192.168.1.255

Network B (125 hosts): 192.168.2.0/25 โžก provides 126 usable hosts

  1. Network Address: 192.168.2.0
  2. First Available Host Address: 192.168.2.1
  3. Last Available Host Address: 192.168.2.126
  4. Broadcast Address: 192.168.2.127

Network C (8 hosts): 192.168.2.128/29 โžก provides 8 usable hosts

  1. Network Address: 192.168.2.128
  2. First Available Host Address: 192.168.2.129
  3. Last Available Host Address: 192.168.2.134
  4. Broadcast Address: 192.168.2.135

As a result, the [super]network 192.168.1.0/24 summarises three [sub]networks: 192.168.1.0/24, 192.168.2.0/24, and 192.168.2.128/29.

VLSM in Action Link to heading

The figure below illustrates how a planned and thoughtful allocation of VLSM can reduce the size of an organisation’s routing tables and conserve IP address space.

  • Notice how Routers F and G are able to summarise the six subnets behind them into a single advertisement (10.1.1.0/24 and 10.1.2.0/24, respectively) and how Router B (10.254.0.0/26) is able to aggregate all the subnets behind it into a single advertisement. Likewise, Router C is able to summarise the six subnets behind it into a single advertisement (10.1.0.0/16).
  • Finally, the subnet structure is not visible outside of the organisation, because through the use of VLSM and aggregation, Router A injects a single route into the global Internet’s routing table (10.0.0.0/8).

VLSM Planning

VLSM Logical Diagram

Supernet or Supernetwork Link to heading

Info
An IP network formed by the aggregating a series of network numbers in a single summary address.
  • Multiple IP addresses must share the same high-order bit to be properly summarised.
  • Summarising a block of addresses is useful when designing IP Addressing Schemes for contiguous networks with multiple physical locations.
  • For example, two network addresses 192.168.0.0/24 and 192.168.1.0/24 can be summarised as one singular network as 192.168.0.0/23.

Supernetting Link to heading

  1. Write out the networks needs summarising in binary format.
    • 172.20.0.0 โ€“ 10101100.00010100.0.0
    • 172.21.0.0 โ€“ 10101100.00010101.0.0
    • 172.22.0.0 โ€“ 10101100.00010110.0.0
    • 172.23.0.0 โ€“ 10101100.00010111.0.0
  2. Count the number of far-left consecutively matching bits to determine the new subnet mask.
    • 14 matching bits, /14 or 255.252.0.0
  3. Copy the matching bits and add all zero bits to the end to determine the new network address.
    • 10101100.00010100.00000000.00000000
    • 172.20.0.0/14

Subnetting versus Supernetting Link to heading

TermDescription
Subnettingincrease the prefix size to the right to enable very specific routes.
Supernettingreduce the prefix size to the left to enable very general or summarised routes.

IP Addressing Design Considerations Link to heading

  1. Number of locations
  2. Number of devices per location
  3. IP addressing requirements for each individual location or building:
    1. Number of devices to be supported in each communication closet
    2. Site requirements: data networks, wireless LANs, IP Telephony (IPT) networks, CCTV networks (security cameras), video conference systems, access control systems, network management, server farms, point-to-point links, and router/switch loopback addresses.
  4. Subnet size
TitleReference
Guidelines for Management of IP Address SpaceRFC 1466
Internet Registry IP Allocation GuidelinesRFC 2050