[Xiaobai must] The dry goods of IP addressing, you deserve it!

[Warm reminder] Need information or need to enter the group to communicate to the bottom

Dotted Decimal System
Before we learn about addressing, let's first understand the IP address. The IP address used now is version 4, a total of 32 bits, binary composition.

If you use binary to directly represent the IP address, then the 32 0s and 1s are too difficult for humans to recognize, and if they are directly converted to decimal, the value is too large and difficult to recognize.

Therefore, dotted decimal system came into being. It divides a 32-bit IP address into four segments, separated by three dots, each segment has only 8 bits, and converted to decimal, each segment ranges from 0 to 255, which is better Identification, so IP addresses are now expressed in dotted decimal notation.

IP address composition
An IPv4 address is composed of two to three parts, among which there must be a network number and a host number.

The role of the network number is mainly to specify the network to which it belongs and to specify the network that can communicate, and the role of the host number is to distinguish different hosts in a network.

Another constituent unit is the subnet number.

For example, a 10.0.0.1 type A address, the mask should be 8 bits, but we often see addresses like 10.0.0.1/24, where the 16 bits except the 8-bit network number are the subnet numbers, which are from the host The digits are borrowed from the number and used as the function of the network number.

IP address classification
IP addresses are divided into five categories, namely ABCDE. Among them, class ABC addresses are common addresses, class D addresses are multicast addresses, and class E addresses are specially prepared for experiments. Classification basis of address category: The first digit of Class A must be 0, so the address range is 0.0.0.0~127.255.255.255, the first two digits of Class B are fixed at 10, the first three digits of Class C are fixed at 110, and so on, as shown in the figure Shown.
Insert picture description here

At the same time, it can be found from the above figure that the network bits of the A-type address are fixed at 8 bits, the network bits of the B-type address are fixed at 16 bits, and the C-type address is 24 bits. This is because Class A addresses are designed to use addresses for large networks. The number of large networks is small and each large network contains a large number of host addresses. Class B is a medium network and Class C is a small network. However, this design wastes addresses. So there is a subnet mask.

The role of the
mask The mask has a total of 32 bits and is expressed in dotted decimal notation, where 0 and 1 must be consecutive. The main function of the mask is to distinguish between network bits and host bits.

For example, a type A address mask is expressed as 255...0.0.0, which becomes binary:
11111111.00000000.00000000.00000000, where 1 corresponds to the ip address bit as the network bit, and the rest is the host bit.

Special IP addresses
Special IP addresses are divided into three categories:
Insert picture description here

It should be noted that special addresses cannot be used as host device addresses.

Subnetting
If you want to divide a network segment such as 192.168.1.0/24 into four subnets, how do you do it?
You can see that the network number of this network segment is
11000000.10101000.00000001, a total of 24 bits, so the host bit is 8 bits.

If you want to divide four subnets, you need to borrow 2 bits from the host bit (this 2 is obtained by the n power of 2 = or greater than 4), then the subnets that can be divided are 192.168.1.0/26, 192.168.1.64 /26, 192.168.1.128/26, 192.168.1.192/26.

Through such a small experiment, we found that after subnetting, the total number of addresses that can be used by pc is reduced (the number of addresses that can be used is 2 to the 8th power of -2, now it is 2 to the 6th power of -2 and then multiplied by 4), then what is the effect of subnetting?

The subnet division mainly has the following three points:
1. Reduce broadcast domain
2. Effective use and planning of IP
3. Security considerations, convenient management

VLSM
VLSM is a variable-length subnet mask division, which can carry out hierarchical addressing of subnets in order to make the most effective use of the existing address space.

For example, a company has 4 departments ABCD. Department A needs 14 IP addresses, Department B needs 25, Department C needs 52, and Department D needs 9. The large address block used is 192.168.1.0/24.

If we use the previous subnet division method, then we can draw out 2 subnet numbers, the number of host bits that can be used by each department is 6, that is, the number of IP addresses that can be used by each department is 62, such an even distribution Will cause address waste. So you need to use vlsm.

When using vlsm to divide the address, we must first clarify how many actual host bits each department needs. After calculation (the formula is 2 to the power of n-2 is greater than or equal to the required number), we get that ABCD requires 4 5 6 4 Host bits, then the subnet numbers are 4 3 2 4 respectively (subtract the calculated digits from the original host bits). Secondly, you need to number the subnet number:

After numberingInsert picture description here

When numbering, we need to pay attention to ensure that it is inconsistent. For example, when we write 00 for the subnet number with only two digits, the first two digits of the subnet number with three and four digits must not be 00, otherwise it will be repeated.

Similarly, when the three-digit subnet number is 010, please note that the first three digits of the four-digit subnet number cannot be the same as 010 with only three digits, and the first two digits cannot be the same as 00. This is to ensure that the ip address will not be repeated (if you say that two digits are written as 00 and three digits are written as 001, and the first two digits of the three digits are the same as only two digits of 00, then there will be many things like 11000000.10101000.00000001.00100001. Duplicate address).

Of course, the final result is not unique.

In order to better help you learn and understand network engineers, and other related content, I deliberately organize all the materials systematically, and share them here for free. Necessary materials for network workers, including:
Huawei Certification Mind Map (Superfine); Huawei Certification Essential Knowledge Documents (pdf); Collection of Essential Net Worker Knowledge Documents; Essential Toolkit for Net Workers; Essential Net Workers Prepare experiment package;
necessary video interview package for net workers. …… There is a lot of information, I won’t list all of them, so I’ll write here first. If you have any questions, please leave a message and discuss private messages~

Guess you like

Origin blog.csdn.net/ZYJY2020/article/details/113118680