Content analysis displayed by ipconfig (2) Subnet mask

Enter it in cmd ipconfigand you will often see it 子网掩码. As follows: The binary number of

the subnet mask is . The binary number of the subnet mask is .225.225.225.0[1111 1111].[1111 1111].[1111 1111].[0000 0000]
225.225.224.0[1111 1111].[1111 1111].[1111 1110].[0000 0000]

What is the function of subnet mask?

Divide the IP address into 网络号and 主机号. The bits of the subnet mask 1represent the network number, and the 0bits of the subnet mask represent the host number. As shown in the figure above, the subnet mask 255.255.255.0indicates that the first 24 digits are the network number and the last 8 digits are the host number. The binary number of the IP address 192.168.10.60is
[1100 0000].[1010 1000].[0000 1010].[0011 1100], so [1100 0000].[1010 1000].[0000 1010]it is the network number and [0011 1100]the host number.

Why should we distinguish between network number and host number?

The difference between network number and host number. It is equivalent to the first six digits on the ID card, the network number is equivalent to the urban area, and the host number is equivalent to the county. For example:

address First 6 digits of ID card
Wuhan, Hubei: 420100
Jiangxia District, Wuhan City, Hubei Province: 420115
Hanyang District, Wuhan City, Hubei Province: 420105
Xiangyang City, Hubei Province: 420600
Huanggang City, Hubei Province: 421100
Foshan City, Guangdong Province 440600
Zhuhai City, Guangdong Province 440400

Among the first 6 digits of the ID card, the first two represent , the middle two represent , and the last two represent 区或县.
So the reason for dividing provinces and cities is that many people were born in the same province, or the same city, or the same district. Just the time of birth is different.
Similarly, if many devices are connected to the same router, they will have the same network number. Only the host number is different.

What is the longest mask matching principle?

The router uses the longest mask match to determine the most specific 路由表entry. It compares with the target IP address and chooses the IP address with the longest mask.
For example, if the destination IP address is 192.168.0.1, and there are two IP addresses in the routing table: 192.168.0.0/24and 192.168.0.0/16, then the router will choose the one with the longest mask 192.168.0.0/24as the match.

How to view the local routing table?

Mentioned above 路由表. In Windows system, open cmd and enter:
route printor route print -4
as shown below:

Guess you like

Origin blog.csdn.net/zhangjin1120/article/details/132219639