[Analysis of soft test sites] Software designer-the division of subnets

1. Concept

Subnet division is a high-frequency test site, it is not difficult to understand subnet division.

1.1 Address representation method

First, the address is four bytes, each byte has 8 binary bits, the lowest is the lowest 00000000.00000000.00000000.00000000, and the largest is the highest 11111111,11111111,11111111,11111111.

This seems difficult to understand, so it is customary for everyone to convert each byte to the corresponding decimal number, so the smallest IP address is 0.0.0.0, and the largest is 255.255.255.255. (255 is 2 to the 8th power minus 1).

1.2 Address classification

The network address is usually divided into network address + host address. The first few bits are the network address, and the following is the host address.

Specific division:

classification website address Explanation
Class A address 0xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxx Start with 0, the red part is the network address
Class B address 10xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxx Start with 10, the red part is the network address
Class C address 110xxxxx.xxxxxxxx.xxxxxxxx.xxxxxxx The beginning is 110, the red part is the network address
Class D address 1110xxxx.xxxxxxxx.xxxxxxxx.xxxxxxx Start with 1110, regardless of network address and host address
Class E address 11110xxx.xxxxxxxx.xxxxxxxx.xxxxxxx Beginning with 11110, regardless of network address and host address

Let's take a class A address as an example to explain. The first byte of a class A address represents a network address, and the 0 at the beginning of the first byte is fixed, so there is 2^7a network address, and each network can have 2^24a host address.

1.3 Subnet mask

When we assign a network to a government or enterprise organization, they also have to divide their internal subnets, such as a subnet for the administrative department and a subnet for the production department. The subnets cannot access each other to protect network security.

So we take out the first few digits of the host address part as the subnet address, so how many digits should be used as the subnet is determined by the subnet mask.

For example, for a class A address 00000001.00000000.00000000.00000000, if we want to divide 4 subnets, we need to use the first two digits of the second byte as the subnet. That is to say, the first 10 digits represent the network, so the subnet mask is 11111111.11000000.00000000.00000000: 255.192.0.0.

So the subnet mask is a sign that represents the network part. If you need to use the first few bits as the network address, just set those bits to 1 and it's OK.

2. Rewriting questions

Question : The subnet mask of a Class B network is 255.255.224.0, then this network is divided into () subnets.
A 2 pcs
B 4 pcs
C 6 pcs
D 8 pcs

Analysis :
First, the class B address, the first 2 bytes are the network address.

Then the subnet mask is 255.255.224.0, that is 11111111.11111111.11100000.00000000, note that the first 2 bytes are the address of the class B address, and the first three digits in the third byte are 1, indicating that the first three digits are the molecular network, so the subnet has 2^3There are eight.

Guess you like

Origin blog.csdn.net/woshisangsang/article/details/108061815