IP Address and Subnet Division Study Notes "Detailed Explanation of Subnet Division"

1. Overview of subnetting

1. Why do you need to divide subnets?

If IPv4 addresses are only classified by class (A, B, C), it will cause a lot of waste or insufficient use. Divide, divide a part into the network number, you can divide the network of various types and sizes.

2. IPv4 subnetting and aggregation

In order to solve the shortcomings of IPv4 and improve the flexibility of network division, two very important technologies were born, that is, VLSM (variable-length subnet mask) and CIDR (classless inter-domain routing). The network evolves into a more efficient and practical classless network. For the introduction of VLSM and CIDR, please refer to the detailed explanation of subnet mask in the previous article .

VLSM is used for IPv4 subnet division, that is, a large network is divided into multiple small subnets; while CIDR is used for IPv4 subnet aggregation, of course, mainly refers to routing aggregation, that is, routing summary. Through CIDR, multiple small subnet routing entries can be aggregated into one large network routing entry, so as to reduce the number of routing entries in the router and improve routing efficiency.

2. Subnet division method

The subnetting we are talking about is actually based on the VLSM variable-length subnet mask, which is divided into equal-length subnetting and variable-length subnetting.

1. The basic idea of ​​VLSM subnet division

The basic idea of ​​implementing subnet division through VLSM is very simple: to use the leftmost bits of the host bits of the existing network segment as subnet bits to divide multiple subnets.

1. Borrow the "Network ID" part of the original classful network IPv4 address from the "Host ID" part

2. Change a part of the bits that originally belonged to the "host ID" part into a part of the "network ID" (usually called "subnet ID").

③, the original "network ID" + "subnet ID" = new "network ID". The length of the "subnet ID" determines the number of subnets that can be divided.

The following example diagram:

IP Address and Subnet Division Study Notes "Detailed Explanation of Subnet Division"

2. All 0 subnet and all 1 subnet

①, "all 0 subnet" means that the "subnet ID" part of the corresponding subnet is all 0, which is the first subnet.

②, "all 1 subnet" means that the "subnet ID" part of the corresponding subnet is all 1, which is the last subnet.

3. According to the RFC950 reference regulations, after the subnet is divided, there are only n-2 available subnets (n represents the total number of subnets).

④. Later, RFC1878 refers to the regulation that after subnetting, there can be n available subnets (n represents the total number of subnets).

The RFC950 reference stipulates that the first subnet (that is, the "all 0 subnet") and the last subnet (that is, the "all 1 subnet") are not available, in order to avoid the network address of the all 0 subnet and the all 0 subnet. 1 The broadcast address of the subnet conflicts with the network address and broadcast address before the subnet is not divided. However, in the later RFC1878 regulation, this regulation has been abolished, and now the equipment basically generally supports RFC1878.

3. Division of equal-length subnets and variable-length subnets

1. Equal-length subnet division

The task of subnetting consists of two parts:

①. Determine the length of the subnet mask.

②. Determine the available address range of the host under the subnet (the first available IP and the last available IP).

Equal-length subnetting is to divide a classful network into multiple networks equally, that is, to divide into multiple subnets equally.

1), Class A network subnetting example

Divide the class A network 42.0.0.0/8 into 4 subnets, and write out the first and last available IP addresses of each subnet?

Analysis: To be divided into 4 subnets, it is necessary to borrow 2 bits of the host as the subnet bits. Why only 2 bits?

Because the binary numbers 0 and 1 are arranged and combined by two digits, there are only these 4 kinds, namely: 00, 01, 10, 11, as shown in the following figure.

00 represents the first subnet (subnet A)

01 represents the second subnet (B subnet)

10 for the third subnet (C subnet)

11 represents the fourth subnet (D subnet)

Borrow the host 2 bits, so the subnet mask +2 bits, so it becomes 10 bits.

Conclusion: A class A network is equally divided into 4 subnets, and the subnet mask can be divided into 4 subnets by moving the subnet mask to the right by 2 bits, that is, 2^2.

Final Results:

Network address of subnet A: 40.0.0.0/10, available addresses (40.0.0.1—40.63.255.254)

Network address of subnet B: 40.64.0.0/10, available addresses (40.64.0.1—40.127.255.254)

Network address of subnet C: 40.128.0.0/10, available addresses (40.128.0.1—40.191.255.254)

Network address of D subnet: 40.192.0.0/10, available addresses (40.192.0.1—40.255.255.254)

IP Address and Subnet Division Study Notes "Detailed Explanation of Subnet Division"

IP Address and Subnet Division Study Notes "Detailed Explanation of Subnet Division"

2), Class B network subnetting example

Divide 131.107.0.0/16 into 2 subnets and write out the first and last available IP addresses for each subnet?

Analysis: To be divided into 2 subnets, it is necessary to borrow 1 bit of the host bit as the subnet bit.

Because the binary numbers 0 and 1 are arranged and combined by one bit, there are only these two types, namely: 0 and 1, as shown in the following figure.

0 represents the first subnet (subnet A)

1 for the second subnet (B subnet)

Borrow 1 bit from the host, so the subnet mask +1 bit, so it becomes 17 bits.

Conclusion: Class B network is equally divided into 2 subnets, and the subnet mask can be divided into 2 subnets by moving the subnet mask 1 bit to the right, that is, 2^1.

Final Results:

Network address of subnet A: 131.107.0.0/17, available addresses (131.107.0.1—131.107.127.254)

Network address of subnet B: 131.107.128.0/17, available addresses (131.107.128.1—131.107.255.254)

IP Address and Subnet Division Study Notes "Detailed Explanation of Subnet Division"

IP Address and Subnet Division Study Notes "Detailed Explanation of Subnet Division"

3), Class C network subnetting example

(1) equally divided into two subnets

Divide the network 192.168.0.0 255.255.255.0 into 2 subnets, and write out the address information of each subnet?

analyze:

The subnet mask of this network is /24, to be divided into 2 subnets, and 1 bit of the host bit should be borrowed as the subnet bit.

Because the binary numbers 0 and 1 are arranged and combined by one bit, there are only these two types, namely: 0 and 1, as shown in the following figure.

0 represents the first subnet (subnet A)

1 for the second subnet (B subnet)

Borrow 1 bit from the host, so the subnet mask +1 bit, so it becomes 25 bits, which is 128

Conclusion: Class C network is equally divided into 2 subnets, and the subnet mask can be divided into 2 subnets by moving the subnet mask 1 bit to the right, that is, 2^1.

IP Address and Subnet Division Study Notes "Detailed Explanation of Subnet Division"

IP Address and Subnet Division Study Notes "Detailed Explanation of Subnet Division"

Final Results:

The address range available for subnet A is 192.168.0.1/25 to 192.168.0.126/25.

Subnet A network address: 192.168.0.0/25, all host bits are 0.

A subnet broadcast address: 192.168.0.127/25, the host bits are all 1.

The address range available for subnet B is 192.168.0.129/25 to 192.168.0.254/25.

B subnet network address: 192.168.0.128/25, the host bits are all 0.

B subnet broadcast address: 192.168.0.255/25, the host bits are all 1.

(2), divided into three subnets

(3), divided into four subnets

(4), divided into eight subnets

2. Variable length subnet division

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325347281&siteId=291194637