[IP address and subnet mask] The concept of IP address classification and subnet mask in Network Talk (19)

Knowledge points involved

What is subnet mask, classification of IP address, concept of subnet mask, in-depth understanding of subnet mask and IP address, class A, class B, class C, class D, class E ip address range.
原创于:CSDN博主-《拄杖盲学轻声码》,更多内容可去其主页关注下哈,不胜感激



foreword

The Internet adopts a common address format, assigning an address to every network and almost every host in the Internet
, which makes us really feel that it is a whole.
更多考试总结可关注CSDN博主-《拄杖盲学轻声码》

1. What is an IP address

Computers connected to the Internet are similar to telephones connected to the telephone network. Each computer or router has a number assigned by an authorized organization, which is called an IP address. If the telephone number of a certain unit is 85225566, the area code is 10, while the telephone area code of our country is 0086. Then, the complete statement of the telephone number of this unit should be: 0086-10-89225566. This number is unique worldwide. This is a very common hierarchical telephone number definition method.
Likewise, IP addresses are hierarchically structured. An IP address consists of two parts: the network number and the host number. Wherein, the network number is used to identify a logical network. The host number is used to identify a host on the network. A host has at least one IP address, and this IP address is unique in the entire network. If a host has two or more IP addresses, the host belongs to two or more logical networks and is generally used as a router.
When expressing an IP address, the 32-bit binary code is divided into 4 bytes, each byte is converted into the corresponding decimal system, and the bytes are separated by ".". This representation of an IP address is called "dotted decimal notation", and it is obviously easier to remember than a binary code full of 1s and 0s. For example, the following IP address:
10001010 00001011 00000011 00011111
can be recorded as 138.11.3.31. Obviously this is much more convenient.

2. Classification of IP addresses

IP addresses are also hierarchical. An IP address is composed of a network number and a host number. The network number (net-id) is used to identify a logical network, and the host number (host-id) is used to identify a host in the network. Hosts with the same network number can directly access each other, while hosts with different network numbers can only access each other through a router. According to the TCP/IP protocol, IP addresses are divided into five categories (A, B, C, D, E) according to the size of the network, as shown in Figure 1-24.
(1) Class A address: the first byte is used as the network number, and the highest bit is 0, so only 7 bits can represent the network number, and there are 2'=128 network numbers that can be represented, because all 0 and all 1 has a special purpose in the address, so remove
all 0 and all 1 addresses with special purpose, so that it can only represent 126 network numbers, the range is: 1~126. The last 3 bytes
are used as the host number, and there are 24 bits that can represent the host number. The number of hosts that can be represented is 2²7-2, about 16 million hosts. Class A
IP addresses are commonly used in large networks.
(2) Class B address: the first 2 bytes are used as the network number, the last 2 bytes are used as the host number, and the highest bit is 10, the maximum network path is 214-2=16382, the range is: 128.1~139.254, The number of hosts that can be accommodated is 216-2, approximately equal to more than 60,000 hosts. Class B IP addresses are typically used in medium-sized networks.
(3) Class C address: the first 3 bytes are used as the network number, the last 1 byte is used as the host number, and the highest bit is 110, the maximum number of networks is 2²1-2, which is approximately equal to more than 2 million, and the range is: 191.0.1.0~223.255.254.0, the number of hosts that can be accommodated is 28-2, admirably 254 hosts. Class C IP addresses are usually used in small networks.
(4) Class D address: the highest bit is 1110, and it is a multicast address, which is mainly reserved for the Internet Architecture Board (IAB, Internet Architecture Board).
(5) Class E address: the highest bit is 11110, reserved for future use.
Currently, there are only 3 types of IP addresses in use in large quantities, namely Class A to Class C. Different classes of I addresses have no grades in use.
It cannot be said that class A IP addresses are higher than class B or C, nor can it be said that class A IP addresses have a higher priority than class B or C when accessing class A IP addresses. It can only be said that class A The network in which the class IP address resides is one large network.

3. subnet mask

The design of the IP address is also unreasonable. For example, among the A to C classes of IP addresses, there are more than 2.11 million network numbers available for allocation, while the total number of available host numbers on these networks exceeds 3.72 billion. At first glance, it seems that IP addresses are enough for the whole world. actually not. First, the designers did not anticipate that microcomputers would be popularized so quickly that the number of hosts on various LANs and networks would increase dramatically. Second, there is a lot of waste in using IP addresses. For example, a unit has applied for a Class B address. But the unit has only 10,000 hosts. Therefore, more than 85,000 host numbers in a class B address are wasted. Because the mainframes of other units cannot use these numbers. To this end, the designers added a "subnet field" to the IP address.
As you know, the IP address applied for by a unit is the network number net-id of this IP address, and the subsequent host number Host-id is allocated by the unit, and all the hosts in the unit use the same network number. When a unit has many hosts and is distributed in a large geographical area, it is often necessary to use some bridges (instead of routers, because the hosts connected by routers have different network numbers) to interconnect these hosts. Bridges have many disadvantages, for example, it is easy to cause broadcast storms, and it is not easy to isolate and manage when the network fails. In order to make the host of this unit easy to manage. The host computer belonging to the unit can be divided into several subnets (Subnet), and the first few bits in the host number field in the IP address are used as the "subnet number field", and the remaining bits are still the host number field. In this way, routers can be used to interconnect the subnets of the unit, which is convenient for management.
Note: The division of subnets belongs to the internal affairs of the unit, and such division cannot be seen outside the unit. From the outside, this unit still
has only one network number. Only after the outside grouping enters the range of the unit, the router of the unit performs routing selection according to the subnet number, and finally finds the destination host. If the unit divides the subnet according to the geographical location of the host, it will be much more convenient in management.

If no subnet is divided, the subnet mask is the default value, and the length of "1" in the subnet mask is the length of the network number. Therefore, for Class A, B, and C IP addresses, the corresponding default subnet masks are 255.0.0.0, 255.255.0.0, and 255.255.255.0, respectively.
Using a subnet mask is equivalent to using three levels of addressing. When each router receives a packet, it first checks the network number in the packet's IP address. If the network number is not the local network, find out the next hop address from the routing table and forward it. If the network number is the local network, then check the subnet number in the IP address. If the subnet is not the subnet, then forward this packet in the same way. If the subnet is the subnet, then according to the host number, it can be found out from which port the packet should be handed over to the host.
So how to judge whether two IP addresses belong to a subnet? The specific method is to
perform a binary "AND" operation on the two IP addresses and the subnet mask respectively. If the results are the same, they belong to the same subnet, and if the results are different, they do not belong to the same subnet.
For example, 129.47.16.254, 129.47.17.01, 129.47.31.454, 129.47.33.01, these four class B IP
addresses belong to the same subnet under the default subnet mask code, but if the subnet mask is 255.255 .240.0, then 29.47.16.254 and 129.47.17.01 belong to the same subnet, while 129.47.31.454 and 129.47.33.01 belong to another subnet

Salary increase support area

I hope that everyone can learn more through this article, and the salary will increase year by year!
If you like bloggers, you can go to the list to find out. Bloggers specially set up a salary increase list for everyone to check. If you like it, you can click here to view it .
insert image description here


#Summarize
更多资料大家可以关注csdn博主-《拄杖盲学轻声码》

The above is what I want to talk about today. This article mainly introduces what is subnet masking and the practical application of subnet masking technology. I also look forward to sharing more with you. Handsome guys and beauties give me a thumbs up. Let’s work together in 2023! ! !

Guess you like

Origin blog.csdn.net/hdp134793/article/details/131481567