Talking about TCP IP Protocol (2) IP Address

In the previous section, I had a general understanding of what the TCP/IP protocol stack is, but I was still in a foggy state. Many times when learning a new knowledge, I was always impatient at the beginning and had no way to start. I just learned a little, but found that it was not even a little superficial, and the sense of accomplishment was too low. Therefore, the most important thing to learn at any time is to master the knowledge that should be mastered at the right time.

Let's briefly review the TCP/IP protocol stack:

Data Link Layer -> Network Layer -> Transport Layer -> Application Layer

 If you add an ID to each layer, just like everyone has an ID card, then you can mark it like this:

Data Link Layer (MAC Address)

Network layer (IPV4 address, hereinafter referred to as IP address)

Transport layer, application layer (port)

Such a label cannot fully summarize all the characteristics of this layer, but if you master these labels, it is equivalent to a key that allows you to quickly open the "door" of this layer of protocol.

The IP address most closely related to our life: IP66 Check the location of the IP address online: https://www.ip66.net/?utm-source=LJ&utm-keyword=?1146

As the identification of the network layer, the concept of IP address can be said that everyone must have heard of it. An IP address is a 32-bit binary number. What is the concept of 32 bits? It is equivalent to 4 bytes. Students who have learned C language should know that an int type data is 32 bits, so the number of IP addresses should be the maximum value of int 4294967296. It looks like a lot, right? There are 4.3 billion, but in today’s explosive development of the Internet, this IP address is really not enough, so IPV6 was born out of luck.

Imagine a certain IP address is:
11000000101010000000000100000001

Is it a little dizzy? There is no way. We are used to seeing decimal numbers 1, 2, 3, 10, 99, etc. It is really unfriendly to look at these binary numbers. It may take a long time for you to memorize such an IP address, and it is estimated that you will forget it after a long time. Therefore, we adopt a special way of expressing the IP address—dotted decimal notation. The binary IP address above is converted to: 192.168.1.1, is it familiar? The IP address of the interface.

After talking about the representation of IP addresses, let’s talk about the classification of IP addresses. IP addresses are usually divided into 5 categories:

Class A address (1.0.0.0—127.255.255.255)

Class B address (128.0.0.0—191.255.255.255)

Class C address (192.0.0.0—223.255.255.255)

Class D addresses (224.0.0.0 - 239.255.255.255)

Class E addresses (240.0.0.0 - 255.255.255.254)

Behind each type of address is its range. If you just memorize it by rote, that is not very good. Only by knowing how these addresses are classified can you remember them better.

An IP address can be simply regarded as composed of a network number and a host number, but how many bits of the network number and how many bits of the host number, different types of IP addresses have different divisions:

Class A address: 8-bit network number, 24-bit host number

Class B address: 16-bit network number, 16-bit host number

Class C address: 24-bit network number, 8-bit host number

The network number is uniformly assigned by ICANN, while the host number is assigned by the system administrator of the network side. Sometimes, in order to better divide the network, the host number can be refined and assigned in the form of host address + subnet address, that is, subnet division.

When we know the composition of each type of address, the corresponding range is very clear. From the perspective of network number allocation, a class A address must occupy 8 digits, so the first digit of its IP address must be 0, so that all the network numbers between 00000000 - 01111111 (0 - 127) are full. Well, after A is full, it is time for a class B address. Although a class B address is 16 digits, but you can’t grab the network number of a class A address, no Therefore, the range of its network number is 128-191. It can be found that the first two digits of a class B address are always 10, and so on. The first three digits of a class C address are 110, so its range is 192-223.

The division of IP addresses is roughly like this. As the most important clue of the network layer, we will introduce the IP address and the network layer it points to step by step in the following explanations!

Guess you like

Origin blog.csdn.net/TTmanghe/article/details/130947214