Computer Networking - Subnetting

general overview

When we subnet a network, we basically divide it into smaller networks. For example, when a group of IP addresses is assigned to a company, the company may "split" that network into smaller networks, one for each department. In this way, both the technical department and the management department can have their own small networks. By subnetting, we can divide the network into smaller networks according to our needs. This also helps reduce traffic and hide network complexity.

basic idea

The basic idea of ​​subnetting is very simple: it is 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 IP address to the "host ID" part.
  2. Change some of the bits that used to be part of the "Host ID" to become part of the "Network ID" (often called the "Subnet ID").
  3. Original "Network ID" + "Subnet ID" = new "Network ID". The length of "Subnet ID" determines the number of subnets that can be divided.

The example picture below:insert image description here


special subnet

  1. "All 0 subnet" means that the corresponding subnet's "subnet ID" part is all 0, which is the first subnet.
  2. "All 1 subnet" means that the "subnet ID" part of the corresponding subnet is all 1, which is the last subnet.

Implementation

Subnetting tasks include:

  1. Determine the length of the subnet mask.
  2. Determine the range of available addresses for hosts under the subnet (the first available IP and the last available IP).
  3. Determine the network address (the host bits are all 0) and the broadcast address (the host bits are all 1), which cannot be assigned to the computer host.

Example of Class C Network Subnetting

Note: The following implementations are all calculated using the number of subnets.

1. Equally divided into two subnets

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

Analysis: To divide into 2 subnets, the subnet mask needs to be moved one bit to the right. In this way, the first bit becomes a network bit, which can be divided into 2 subnets. And because the binary numbers 0 and 1 are arranged and combined by one bit, there are only these two kinds, namely: 0 and 1, as shown in the figure below: 0 is A subnet; 1 is B subnet.


insert image description here


1 bit is borrowed from the host, so the subnet mask + 1 bit changes from the original 255.255.255.0 (/24) to 255.255.255.128 (/25).

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


insert image description here


Network address of subnet A: 192.168.0.0/25, available addresses (192.168.0.1~192.168.0.126), broadcast address: 192.168.0.127.

Network address of subnet B: 192.168.0.128/25, available address (192.168.0.129~192.168.0.254), broadcast address: 192.168.0.255.

2. Equally divided into four subnets

Example: Divide the network 192.168.0.0 255.255.255.0 into 4 subnets, and write out the address information of each subnet.

Analysis: To divide into 4 subnets, the subnet mask needs to be moved to the right by two places. In this way, bit 1 and bit 2 become network bits, which can be divided into 4 subnets. Because the binary numbers 0 and 1 are arranged in two bits, there are only these 4 types, which are: 00, 01, 10, 11, as shown in the figure below: 00 is the A subnet, 01 is the B subnet, and 10 is the C subnet , 11 is the D subnet.


insert image description here


Borrow 2 bits from the host, so the subnet mask + 2 bits, from the original 255.255.255.0 (/24) to 255.255.255.192 (/26).

Conclusion: Class C network is equally divided into 4 subnets, and the subnet mask can be divided into 4 equal subnets by moving 2 bits to the right, that is, 2 2 2^{2}22


insert image description here


Network address of subnet A: 192.168.0.0/26, available addresses (192.168.0.1~192.168.0.62), broadcast address: 192.168.0.63/26.

Network address of subnet B: 192.168.0.64/26, available address (192.168.65~192.168.0.126), broadcast address: 192.168.0.127.

Network address of C subnet: 192.168.0.128/26, available address (192.168.129~192.168.0.190), broadcast address: 192.168.0.191.

Network address of subnet D: 192.168.0.192/26, available address (192.168.193/26~192.168.0.254), broadcast address: 192.168.0.255.

Example of Class B Network Subnetting

1. Divide into two equal subnets

Example: Divide 131.107.0.0/16 into 2 subnets equally, and write the first and last available IP addresses of each subnet.

Analysis: To divide into 2 subnets, it is necessary to borrow 1 host bit as the subnet bit. 0 is the A subnet, 1 is the B subnet.

sketches.

1 bit is borrowed from the host, so the subnet mask + 1 bit changes from the original 255.255.0.0 (/16) to 255.255.128.0 (/17).

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

sketches.

Network address of subnet A: 131.107.0.0/17, available addresses (131.107.0.1 ~ 131.107.127.254), broadcast address: 131.107.127.255.

Network address of subnet B: 131.107.128.0/17, available addresses (131.107.128.1 ~ 131.107.255.254), broadcast address: 131.107.255.255.

Example of Class A Network Subnetting

1. Equally divided into four subnets

Example: Divide class A network 42.0.0.0/8 into 4 subnets equally, and write down the first and last available IP addresses of each subnet.

Analysis: To divide into 4 subnets, it is necessary to borrow 2 host bits as subnet bits. 00 is the A subnet, 01 is the B subnet, 10 is the C subnet, and 11 is the D subnet.

sketches.

Borrow 2 bits from the host, so the subnet mask + 2 bits, from the original 255.0.0.0 (/8) to 255.192.0.0 (/10).

Conclusion: Class A network is equally divided into 4 subnets, and the subnet mask can be divided into 4 equal subnets by moving the subnet mask to the right by 2 bits, that is, 2 2 2^{2}22

sketches.

Network address of subnet A: 40.0.0.0/10, available addresses (40.0.0.1 ~ 40.63.255.254), broadcast address: 40.63.255.255.

Network address of subnet B: 40.64.0.0/10, available addresses (40.64.0.1 ~ 40.127.255.254), broadcast address: 40.127.255.255.

Network address of C subnet: 40.128.0.0/10, available addresses (40.128.0.1 ~ 40.191.255.254), broadcast address: 40.191.255.255.

Network address of subnet D: 40.192.0.0/10, available addresses (40.192.0.1 ~ 40.255.255.254), broadcast address: 40.255.255.255.

Method summary

insert image description here

Guess you like

Origin blog.csdn.net/qq_45902301/article/details/125303565