< Home

Subnetting

A network can be divided into multiple subnets to conserve IP address space and support flexible IP addressing.

When many hosts are distributed on an internal network, the internal host IDs can be divided into multiple subnet IDs to facilitate management. Then the entire network contains multiple small networks.

Subnetting is implemented within the internal network. The internal network has only one network ID for the external network. When a packet is transmitted from the external network to the internal network, devices on the internal network select routes for the packet based on the subnet ID and finds the destination host.

Figure 1 shows subnetting of a Class B IP address. The subnet mask consists of a string of continuous 1s and 0s. 1s indicate the network ID and the subnet ID fields, and 0s indicate the host ID field.

Figure 1 Subnetting of IP addresses

The Class B IP address shown in Figure 1 is used as an example. Assume that the network address is 172.16.0.0 and the mask is 255.255.0.0. The two left-most bits of the host ID are used as the subnet ID. The subnet ID ranges from 00 to 11 (in binary format), allowing a maximum of 4 (22) subnets. Each subnet ID has a subnet mask and the subnet mask of the IP address changes with the subnet division. That is, the subnet mask of IP address is changed from 255.255.0.0 to 255.255.192.0. After performing an AND operation on the IP address and the subnet mask, you can obtain the network address. The network addresses of the four subnets are shown in Figure 2.

Figure 2 IP address subnets

Table 1 lists the network addresses (with the all-0 host ID), broadcast addresses (with the all-1 host ID), and host addresses of the preceding four subnets.

Table 1 Network address and host address ranges (in binary format)

Subnet

Network Address

Broadcast Address

Host Address Range

10101100 00010000 00000000 00000000

10101100 00010000 00000000 00000000

10101100 00010000 00111111 11111111

10101100 00010000 00000000 00000001

to

10101100 00010000 00111111 11111110

10101100 00010000 01000000 00000000

10101100 00010000 01000000 00000000

10101100 00010000 01111111 11111111

10101100 00010000 01000000 00000001

to

10101100 00010000 01111111 11111110

10101100 00010000 10000000 00000000

10101100 00010000 10000000 00000000

10101100 00010000 10111111 11111111

10101100 00010000 10000000 00000001

to

10101100 00010000 10111111 11111110

10101100 00010000 11000000 00000000

10101100 00010000 11000000 00000000

10101100 00010000 11111111 11111111

10101100 00010000 11000000 00000001

to

10101100 00010000 11111111 11111110

The above section describes how to subnet a network in the binary mode. Typically, the subnetting result is presented in decimal format. Converting a result in binary format to one in decimal format is complex. The following describes how to subnet a network more easily.

The preceding Class B IP address with the network address being 172.16.0.0 and the mask being 255.255.0.0 is used as an example. After subnetting, the mask is 255.255.192.0. The length of the subnet mask equals 18 (16 + 2). The method is as follows:

Table 2 lists the subnetting result in decimal format.

Table 2 Network address and host address ranges (in decimal format)

Subnet

Network Address

Broadcast Address

Host Address Range

172.16.0.0/18

172.16.0.0

172.16.63.255

172.16.0.1 to 172.16.63.254

172.16.64.0/18

172.16.64.0

172.16.127.255

172.16.64.1 to 172.16.127.254

172.16.128.0/18

172.16.128.0

172.16.191.255

172.16.128.1 to 172.16.191.254

172.16.192.0/18

172.16.192.0

172.16.255.255

172.16.192.1 to 172.16.255.254

Subnetting reduces the available IP addresses. For example, a Class B IP address contains 65534 (216 - 2) host addresses. After 2 bits in the host ID are used as the subnet ID, there are a maximum of 65528 (4 × (214 - 2)) host addresses in the four subnets, 6 less than the maximum number of host addresses before subnetting.

To implement efficient network planning, subnetting and IP addressing should abide by the following rules.

Hierarchy

To divide a network into multiple layers, you need to consider geographic and service factors. Use a top-down subnetting mode to facilitate network management and simplify routing tables. In most cases:

  • A network consisting of a backbone network and a MAN is divided into hierarchical subnets.
  • An administrative network is divided into subnets based on administrative levels.

Consecutiveness

Consecutive addresses facilitate route summarization on a hierarchical network, which greatly reduces the number of routing entries and improves route search efficiency.

  • Allocate consecutive IP addresses to each area.
  • Allocate consecutive IP addresses to devices that have the same services and functions.

Scalability

When allocating addresses, reserve certain addresses on each layer to ensure consecutive address allocation in future network expansion.

A backbone network must have enough consecutive addresses for independent autonomous systems (ASs) and further network expansion.

Efficiency

When planning subnets, fully utilize address resources to ensure that the subnets are sufficient for hosts.

  • Allocate IP addresses by using variable length subnet mask (VLSM) to fully use address resources.
  • Consider the routing mechanisms in IP address planning to improve address utilization efficiency in the allocated address spaces.
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >