Friday, May 28, 2010

Example of subnetting with extended-network-prefix

An organization has been assigned the network number 193.1.1.0/24 and it needs to define six subnets. The largest subnet is required to support 25 hosts.

Defining the Subnet Mask / Extended-Prefix Length

The first step is to determine the number of bits required to define the six subnets. Since a network address can only be subnetted along binary boundaries, subnets must be created in blocks of powers of two [ 2 (2^1), 4 (2^2), 8 (2^3), 16 (2^4), etc. ]. Thus, it is impossible to define an IP address block such that it contains exactly six subnets. For this example, the network administrator must define a block of 8 (2^3) and have two unused subnets that can be reserved for future growth.

Since 8 = 2^3, three bits are required to enumerate the eight subnets in the block. In this example, the organization is subnetting a /24 so it will need three more bits, or a /27, as the extended-network-prefix. A 27-bit extended-network-prefix can be expressed in dotted-decimal notation as 255.255.255.224. This is illustrated in Figure blow.


A 27-bit extended-network-prefix leaves 5 bits to define host addresses on each subnet.
This means that each subnetwork with a 27-bit prefix represents a contiguous block of 2^5(32) individual IP addresses. However, since the all-0s and all-1s host addresses cannot be allocated, there are 30 (2^5 -2) assignable host addresses on each subnet.

Defining Each of the Subnet Numbers

The eight subnets will be numbered 0 through 7. The 3-bit binary representation of the decimal values 0 through 7 are: 0 (0002), 1 (0012), 2 (0102), 3(0112), 4 (1002), 5 (1012), 6 (1102), and 7 (1112).

In general, to define Subnet #n, the network administrator places the binary representation of n into the bits of the subnet-number field. For example, to define Subnet #6, the network administrator simply places the binary representation of 6 (1102) into the 3-bits of the subnet-number field.

The eight subnet numbers for this example are given below. The underlined portion of each address identifies the extended-network-prefix, while the bold digits identify the 3-bits representing the subnet-number field:
Base Net: 11000001.00000001.00000001.00000000 = 193.1.1.0/24
Subnet #0: 11000001.00000001.00000001.00000000 = 193.1.1.0/27
Subnet #1: 11000001.00000001.00000001.00100000 = 193.1.1.32/27
Subnet #2: 11000001.00000001.00000001.01000000 = 193.1.1.64/27
Subnet #3: 11000001.00000001.00000001.01100000 = 193.1.1.96/27
Subnet #4: 11000001.00000001.00000001.10000000 = 193.1.1.128/27
Subnet #5: 11000001.00000001.00000001.10100000 = 193.1.1.160/27
Subnet #6: 11000001.00000001.00000001.11000000 = 193.1.1.192/27
Subnet #7: 11000001.00000001.00000001.11100000 = 193.1.1.224/27
An easy way to check if the subnets are correct is to ensure that they are all multiples of the Subnet #1 address. In this case, all subnets are multiples of 32: 0, 32, 64, 96, ...

Defining Host Addresses for Each Subnet

According to Internet practices, the host-number field of an IP address cannot contain all 0-bits or all 1-bits. The all-0s host-number identifies the base network (or subnetwork) number, while the all-1s host-number represents the broadcast address for the network (or subnetwork).

In our current example, there are 5 bits in the host-number field of each subnet address.
This means that each subnet represents a block of 30 host addresses (2^5-2 = 30, note that the 2 is subtracted because the all-0s and the all-1s host addresses cannot be used).The hosts on each subnet are numbered 1 through 30.

In general, to define the address assigned to Host #n of a particular subnet, the network administrator places the binary representation of n into the subnet's host-number field. For example, to define the address assigned to Host #15 on Subnet #2, the network administrator simply places the binary representation of 15 (011112) into the 5-bits of Subnet #2's host-number field.

The valid host addresses for Subnet #2 in our example are given below. The underlined portion of each address identifies the extended-network-prefix, while the bold digits identify the 5-bit host-number field:

Subnet #2: 11000001.00000001.00000001.01000000 = 193.1.1.64/27
Host #1: 11000001.00000001.00000001.01000001 = 193.1.1.65/27
Host #2: 11000001.00000001.00000001.01000010 = 193.1.1.66/27
Host #3: 11000001.00000001.00000001.01000011 = 193.1.1.67/27
Host #4: 11000001.00000001.00000001.01000100 = 193.1.1.68/27
Host #5: 11000001.00000001.00000001.01000101 = 193.1.1.69/27
.
.
Host #15: 11000001.00000001.00000001.01001111 = 193.1.1.79/27
Host #16: 11000001.00000001.00000001.01010000 = 193.1.1.80/27
.
.
Host #27: 11000001.00000001.00000001.01011011 = 193.1.1.91/27
Host #28: 11000001.00000001.00000001.01011100 = 193.1.1.92/27
Host #29: 11000001.00000001.00000001.01011101 = 193.1.1.93/27
Host #30: 11000001.00000001.00000001.01011110 = 193.1.1.94/27

The valid host addresses for Subnet #6 are given below. The underlined portion of each address identifies the extended-network-prefix, while the bold digits identify the 5-bit host-number field:

Subnet #6: 11000001.00000001.00000001.11000000 = 193.1.1.192/27
Host #1: 11000001.00000001.00000001.11000001 = 193.1.1.193/27
Host #2: 11000001.00000001.00000001.11000010 = 193.1.1.194/27
Host #3: 11000001.00000001.00000001.11000011 = 193.1.1.195/27
Host #4: 11000001.00000001.00000001.11000100 = 193.1.1.196/27
Host #5: 11000001.00000001.00000001.11000101 = 193.1.1.197/27
.
.
Host #15: 11000001.00000001.00000001.11001111 = 193.1.1.207/27
Host #16: 11000001.00000001.00000001.11010000 = 193.1.1.208/27
.
.
Host #27: 11000001.00000001.00000001.11011011 = 193.1.1.219/27
Host #28: 11000001.00000001.00000001.11011100 = 193.1.1.220/27
Host #29: 11000001.00000001.00000001.11011101 = 193.1.1.221/27
Host #30: 11000001.00000001.00000001.11011110 = 193.1.1.222/27

Defining the Broadcast Address for Each Subnet

The broadcast address for Subnet #2 is the all 1's host address or:
11000001.00000001.00000001.010 11111 = 193.1.1.95

Note that the broadcast address for Subnet #2 is exactly one less than the base address for Subnet #3 (193.1.1.96). This is always the case - the broadcast address for Subnet #n is one less than the base address for Subnet #(n+1).The broadcast address for Subnet #6 is simply the all 1's host address or:
11000001.00000001.00000001.11011111 = 193.1.1.223

Again, the broadcast address for Subnet #6 is exactly one less than the base address for Subnet #7 (193.1.1.224). Again, the broadcast address for Subnet #6 is exactly one less than the base address for Subnet #7 (193.1.1.224).

[This example is collected from the document Understanding IP Addressing.]

3 comments:

  1. Amazing! I was absent when my teacher explained this topic, but this page covered everything I needed!
    Thanks a lot

    ReplyDelete
  2. This is a good tutorial. Thanks!

    ReplyDelete