In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "detailed interpretation of computer network TCP/IP protocol". In daily operation, I believe many people have doubts about the detailed interpretation of computer network TCP/IP protocol. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "detailed interpretation of computer network TCP/IP protocol"! Next, please follow the editor to study!
I. layering of computer network architecture
Computer network architecture layering
Computer network architecture layering
It is not difficult to see that there is a slight difference between TCP/IP and OSI in hierarchical modules. The OSI reference model focuses on "what are the necessary functions of the communication protocol", while TCP/IP focuses more on "what kind of program should be developed to implement the protocol on a computer".
II. TCP/IP Foundation
1. The specific meaning of TCP/IP
Literally, one might think that TCP/IP refers to both TCP and IP protocols. In real life, sometimes it does refer to these two agreements. However, in many cases, it is only the general name of the protocol group that must be used when communicating with IP. Specifically, IP or ICMP, TCP or UDP, TELNET or FTP, and HTTP are all TCP/IP protocols. They have a close relationship with TCP or IP and are an essential part of the Internet. The word TCP/IP generally refers to these protocols, so TCP/IP is sometimes referred to as the Internet protocol group.
When the Internet communicates, it needs the corresponding network protocol. TCP/IP is originally a protocol family developed for the use of the Internet. Therefore, the protocol of the Internet is TCP/IP,TCP/IP, which is the protocol of the Internet.
Internet protocol group
two。 Data packet
Packets, frames, packets, segments, messages
The above five terms are used to describe the units of data, and the general distinction is as follows:
Package can be said to be a versatile term.
Frames are used to represent the units of packets in the data link layer
A packet is the unit of a packet in layers above the network layer such as IP and UDP.
Segments represent the information in the TCP data stream
A message refers to the unit of data in the application protocol.
In each layer, a header is attached to the transmitted data, which contains the necessary information for that layer, such as the destination address and protocol-related information. Typically, the information provided for the protocol is the packet header and the content to be sent is data. From the point of view of the next layer, all packets received from the upper layer are considered to be the data of this layer.
Packet header
The packet transmitted in the network consists of two parts: one is the header to be used by the protocol, and the other is the data transmitted from the upper layer. The structure of the first part is defined in detail by the specific specifications of the agreement. In the header of the packet, it clearly indicates how the protocol should read the data. On the other hand, if you see the first part, you will be able to understand the necessary information of the protocol and the data to be processed. The head of the bag is like the face of the agreement.
3. Data processing flow
The following figure takes user a sending an email to user b as an example:
Data processing flow
① application processing
First, the application will encode, which is equivalent to the presentation layer function of OSI
After the coding is converted, the mail is not necessarily sent out immediately. This management function of when to establish a communication connection and when to send data is equivalent to the session layer function of OSI.
Processing of ② TCP module
TCP is responsible for establishing connections, sending data, and disconnecting according to the instructions of the application. TCP provides reliable transmission of data sent from the application layer to the peer. In order to achieve this function, a TCP header needs to be attached to the front end of the application layer data.
Processing of ③ IP module
IP combines the TCP header and TCP data sent by TCP as its own data, and adds its own IP header to the front end of the TCP header. After the IP packet is generated, refer to the routing control table to determine which route or host accepts the IP packet.
Processing of ④ Network Interface (Ethernet driver)
IP packets sent from IP are data to Ethernet. These data are appended with an Ethernet header and sent for processing, and the generated Ethernet packets will be transmitted to the receiver through the physical layer.
Processing of ⑤ Network Interface (Ethernet driver)
After receiving the Ethernet packet, the host first finds the MAC address from the head of the Ethernet packet to determine whether it is a packet sent to itself, and if not, discards the data.
If the packet is sent to itself, the data type is determined from the type in the header of the Ethernet packet, and then transmitted to the corresponding module, such as IP, ARP, etc. The example here is IP.
Processing of ⑥ IP module
The IP module does similar processing after receiving the data. From the header of the packet, it is judged whether the IP address matches its own IP address, and if so, the data is sent to the corresponding module, such as TCP and UDP, according to the protocol type of the header. The example here is TCP.
In addition, in the case of a router, the address of the receiver is often not its own. In this case, it is necessary to use the routing control table to investigate the host or router to which it should be sent before forwarding the data.
Processing of ⑦ TCP module
In the TCP module, the checksum is first calculated to determine whether the data has been corrupted. Then check whether the data is being received according to the serial number. * check the port number to determine the specific application. After the data is fully received, it is passed to the application identified by the port number.
Processing of ⑧ applications
The receiver application receives the data sent by the sender directly. By parsing the data, the corresponding content is displayed.
3. TCP and UDP in the transport layer
There are two representative transport layer protocols in TCP/IP, TCP and UDP.
TCP is a connection-oriented and reliable streaming protocol. Stream refers to an uninterrupted data structure. When an application uses TCP to send messages, although it can guarantee the order of sending, it still seems that the data stream without any interval is sent to the receiver. In order to provide reliable transmission, TCP implements "sequence control" or "retransmission control" mechanism. In addition, it also has many functions, such as "flow control", "congestion control", improving network utilization and so on.
UDP is an unreliable Datagram protocol. Subtle processing it will be handed over to the upper application to complete. In the case of UDP, although you can guarantee the size of the message sent, there is no guarantee that the message will arrive. Therefore, the application will sometimes resend according to its own needs.
The advantages and disadvantages of TCP and UDP cannot be simply and absolutely compared: TCP is used in situations where it is necessary to achieve reliable transmission at the transport layer; on the one hand, UDP is mainly used in communications or broadcast communications that require high-speed transmission and real-time performance. TCP and UDP should be used on demand according to the purpose of the application.
1. Port number
The address in the data link and IP refers to the MAC address and the IP address, respectively. The former is used to identify different computers in the same link, while the latter is used to identify interconnected hosts and routers in the TCP/IP network. There is also a similar concept of address at the transport layer, which is the port number. Port numbers are used to identify different applications that communicate on the same computer. Therefore, it is also called the program address.
1.1 identify applications based on port number
Multiple programs can be run on one computer at the same time. The transport layer protocol uses these port numbers to identify the applications that are communicating on the machine and transmit the data accurately.
Identify applications by port number
1.2 Communication identification by IP address, port number, and protocol number
It is far from enough to identify a communication based on the destination port number.
Identify communication by port number, IP address and protocol number
The communication between ① and ② takes place on two computers. They all have the same destination port number, which is 80. This can be distinguished by the source port number.
The destination port number and source port number of ③ and ① are exactly the same, but their source IP addresses are different.
In addition, when the IP address and port number are all the same, we can also distinguish by the protocol number (TCP and UDP).
1.3 determination of port number
Standard port number: this method is also called a static method. It means that each application has its specified port number. But this does not mean that any port number can be used at will. For example, the port numbers used in widely used application protocols such as HTTP, FTP, TELNET and so on are fixed. These port numbers are called well-known port numbers and are distributed between 0ports and 1023; in addition to well-known port numbers, some port numbers are officially registered between 1024 and 49151, but these port numbers can be used for any communication purpose.
Timing allocation method: it is necessary for the server to determine the listening port number, but the client receiving the service does not need to determine the port number. In this way, the client application can assign it to the operating system without setting its own port number. Dynamically assigned port numbers range from 49152 to 65535.
1.4 Port number and protocol
The port number is determined by the transport layer protocol it uses. Therefore, different transport layer protocols can use the same port number.
In addition, those well-known port numbers have nothing to do with the transport layer protocol. As long as the ports are consistent, the same application will be assigned for processing.
2. UDP
UDP does not provide complex control mechanisms and uses IP to provide connectionless communication services.
And it is a mechanism that sends the data sent by the application to the network as it is at the moment it is received. Even in the case of network congestion, UDP is unable to avoid network congestion, such as flow control.
In addition, if a packet is lost during transmission, UDP is not responsible for retransmission.
There is no function to correct even when the arrival order of the packet is out of order.
If you need the above details, you have to leave it to an application that uses UDP.
UDP is often used in the following aspects: 1. Communications with less packets (DNS, SNMP, etc.); 2. Video, audio and other multimedia communications (instant messaging); 3. Limited to application communication in specific networks such as LAN; 4. Broadcast communication (broadcast, multicast).
3. TCP
There is a big difference between TCP and UDP. It fully realizes all kinds of control functions in data transmission, can control the retransmission when packets are lost, and can also control the subpackets which are out of order. None of this is available in UDP.
In addition, as a connection-oriented protocol, TCP sends data only when it confirms the existence of the communication peer, so it can control the waste of communication traffic.
According to these mechanisms of TCP, high reliable communication can also be achieved on a connectionless network such as IP (mainly through verification and, sequence number, acknowledgment reply, retransmission control, connection management and window control, etc.).
3.1 three-way handshake (key)
TCP provides for connected communication transmissions. Connection-oriented means to make preparations between the two ends before the start of data communication.
The so-called three-way handshake means that when establishing a TCP connection, the client and server need to send a total of three packets to confirm the establishment of the connection. In socket programming, this process is triggered by the client executing connect.
Let's look at the flow chart of the three-way handshake:
Three-way handshake
* handshake: the client sets the flag bit SYN to 1, randomly generates a value of seq=J, and sends the packet to the server. The client enters the SYN_SENT state and waits for the server to confirm.
The second handshake: after the server receives the data packet, the flag bit SYN=1 knows that the client requests to establish a connection. The server sets the flag bit SYN and ACK to 1 seq=K, randomly generates a value of seq=K, and sends the packet to the client to confirm the connection request. The server enters the SYN_RCVD state.
The third handshake: after receiving the confirmation, the client checks whether the ack is Jacks 1, and if it is correct, set the flag bit ACK to 1, and send the data packet to the server. The server checks whether the ack is 1, and if it is correct, the connection is established successfully, and the client and the server enter the ESTABLISHED state to complete the three-way handshake, and then the client and the server can start to transfer data.
3.2 four waves (key points)
The TCP connection is terminated with four waves, which means that when a TCP connection is disconnected, the client and server need to send a total of 4 packets to confirm the disconnection. In socket programming, this process is triggered by the client or server side executing close.
Because the TCP connection is full-duplex, each direction must be closed separately. This principle is that when one party completes the data transmission task, it sends a FIN to terminate the connection in this direction. Receiving a FIN just means that there is no data flow in this direction, that is, no more data will be received, but data can still be sent on this TCP connection until FIN is also sent in this direction. The first party to close will perform an active shutdown, while the other party will perform a passive shutdown.
Let's take a look at the flow chart of four waves:
Waving four times
The disconnected end can be either the client side or the server side.
* waving: the client sends a FIN=M to disable the data transfer from the client to the server, and the client enters the FIN_WAIT_1 state. It means "my client has no data to send to you", but if you still have data to send on the server side, you don't have to close the connection in a hurry, you can continue to send data.
The second wave: after receiving the FIN, the server first sends ack=M+1 to tell the client that I have received your request, but I am not ready yet. Please continue to wait for my message. At this time, the client enters the FIN_WAIT_2 state and continues to wait for the server-side FIN message.
The third wave: when the server determines that the data has been sent, it sends a FIN=N message to the client, telling the client, all right, I have finished sending the data, and I am ready to close the connection. The server enters the LAST_ACK state.
The fourth wave: after receiving the FIN=N message, the client knows that the connection can be closed, but he still doesn't trust the network, fearing that the server does not know to shut it down, so he enters the TIME_WAIT state after sending ack=N+1. If the Server side does not receive the ACK, it can retransmit it. When the server receives the ACK, it knows it's ready to disconnect. If the client still does not receive a reply after waiting for 2MSL, it proves that the server has been shut down normally. Well, my client can also close the connection. Finally completed four handshakes.
The above is a situation in which one party shuts down actively and the other party shuts down passively, and in practice, it will also initiate an active shutdown at the same time.
The specific process is shown in the following figure:
Wave at the same time
3.3 improve reliability through serial number and confirmation reply
In TCP, when the data of the sender reaches the receiving host, the receiving host returns a notification that a message has been received. This message is called a confirmation reply (ACK). When the sender sends out the data, it will wait for the confirmation reply from the opposite side. If there is a confirmation reply, the data has successfully reached the opposite end. On the contrary, there is a great possibility of data loss.
If the sender does not wait for a confirmation reply within a certain period of time, the sender can think that the data has been lost and resend. As a result, even if packet loss occurs, the data can still be guaranteed to reach the opposite end and reliable transmission can be achieved.
Not receiving a confirmation reply does not mean that the data must be lost. It is also possible that the data has been received by the other party, but the confirmation reply returned is lost on the way. This situation can also cause the sender to mistakenly think that the data has not reached its destination and resend the data.
In addition, it is also possible to delay the arrival of acknowledgment replies due to some other reasons, and it is not uncommon to arrive after the source host retransmits the data. At this point, the source host only needs to resend the data according to the mechanism.
It is not advisable for the target host to receive the same data repeatedly. In order to provide reliable transmission for upper-layer applications, the target host must abandon duplicate packets. For this reason, we introduced the serial number.
The serial number is the numbering of each byte (8-bit byte) of the sent data in order. The receiver queries the sequence number and the length of the data in the header of the received data TCP, and sends back the sequence number that it should receive next as a confirmation reply. Through the sequence number and confirmation response number, TCP can identify whether the data has been received, and can determine whether it needs to be received, so as to achieve reliable transmission.
Serial number and confirmation reply
3.4 determination of retransmission timeout
The retransmission timeout refers to the specific time interval between waiting for an acknowledgement to arrive before resending the data. If the acknowledgement is not received after this time, the sender will resend the data. Ideally, find a minimum time that ensures that "the confirmation response will be returned within that time".
TCP requires that high-performance communication be provided no matter what the network environment is, and this characteristic must be maintained no matter how the network congestion changes. For this reason, it calculates the round-trip time and its deviation each time the package is sent. Add the round trip time and the deviation time, and the retransmission timeout is a slightly larger value than the sum.
In BSD's Unix and Windows systems, timeouts are controlled in units of 0.5 seconds, so retransmission timeouts are integer multiples of 0.5 seconds. However, at first, the default value of the retransmission timeout is generally set to about 6 seconds.
If no acknowledgement is received after the data is retransmitted, it will be sent again. At this point, the waiting time for a confirmation reply will be extended by 2 times and 4 times the exponential function.
In addition, the data will not be retransmitted repeatedly. After a certain number of retransmissions, if no acknowledgement is returned, it will be judged as an exception on the network or peer host, and the connection will be forced to close. And notify the application that the communication is forcibly terminated.
3.5 send data in segments
When establishing a TCP connection, we can also determine the unit that sends the packet, which can also be called "* message length" (MSS). Ideally, the length of the * * message is exactly the length of the * * data in IP that will not be sharded.
When TCP transmits a large amount of data, it divides and sends the data according to the size of MSS. The retransmission is also carried out in MSS.
During the three-way handshake, the MSS is calculated between the hosts at both ends. When the hosts on both sides issue a request to establish a connection, they write the MSS option in the TCP header to tell each other the size of the MSS that their interfaces can adapt to. Then choose a smaller value between the two and put it into use.
3.6 increase speed with window control
TCP takes 1 segment as a unit, and each segment is sent for acknowledgement and reply processing. One disadvantage of this transmission method is that the longer the round-trip time of the packet, the lower the communication performance.
To solve this problem, TCP introduced the concept of window. The acknowledgement reply is no longer acknowledged in each segment, but in a larger unit, and the forwarding time will be greatly reduced. In other words, the sending host does not have to wait for a confirmation reply after sending a segment, but continues to send. As shown in the following figure:
Window control
The window size refers to the * * value that can continue to send data without waiting for a confirmation reply. The size of the window in the image above is 4 segments. This mechanism realizes the function of using a large number of buffers and acknowledging multiple segments at the same time.
3.7 sliding window control
Sliding window
The data in the window in the image above can be sent even if the acknowledgement is not received. However, before the acknowledgment reply arrives throughout the window, if some of the data is lost, the sender is still responsible for retransmission. To do this, the sending host needs to set up a cache to retain the data to be retransmitted until it receives their acknowledgement.
The part outside the sliding window includes the unsent data and the data that has been received by the counterpart. When the data is sent, if the acknowledgement is received as scheduled, there is no need for retransmission, and the data can be cleared from the cache.
When a confirmation reply is received, slide the window to the location of the sequence number in the confirmation reply. In this way, a plurality of segments can be sent at the same time sequentially to improve communication performance. This mechanism is also known as sliding window control.
3.8 retransmission control in window control
In the use of window control, packet loss is generally divided into two situations:
① acknowledges that the reply failed to return. In this case, the data has reached the peer and does not need to be retransmitted, as shown below:
Partial acknowledgement reply is lost
② the case where a message segment is missing. If the receiving host receives data other than the serial number it should receive, it will return an acknowledgement response to the data received so far. As shown in the following figure, when a message segment is lost, the sender will always receive a confirmation reply with the serial number 1001, so when the window is large and the message segment is lost, the confirmation response with the same serial number will be returned repeatedly. If the sending host receives the same acknowledgement for three times in a row, it will resend its corresponding data. This mechanism is more efficient than the timeout management mentioned earlier, so it is also known as high-speed retransmission control.
High-speed retransmission control
IV. IP protocol in the network layer
IP (IPv4, IPv6) is equivalent to the third layer of the OSI reference model-the network layer. The main function of the network layer is to "realize the communication between terminal nodes". This kind of communication between terminal nodes is also called "point-to-point communication".
The main function of the next layer of the network, the data link layer, is to transfer packets between nodes together with a kind of data link. Once you cross multiple data links, you need the help of the network layer. The network layer can span different data links, and data packets can be transmitted between nodes at both ends even on different data links.
IP is roughly divided into three functional modules, which are IP addressing, routing (forwarding up to the final node) and IP packets and packets.
1. IP address
1.1 Overview of IP addr
In computer communication, in order to identify the opposite end of the communication, there must be an identification code similar to the address. The MAC address in the data link is a kind of identification code used to identify different computers in the same link.
IP, as a network layer, also has this kind of address information, which is generally called IP address. The IP address is used to identify the destination address for communication among all hosts connected to the network. Therefore, all hosts or routers must set their own IP addresses in TCP/IP communications.
No matter which data link a host is connected to, the form of its IP address remains the same.
The IP address (IPv4 address) is represented by a 32-bit positive integer. IP addresses are processed in a binary manner inside the computer. However, since we are not used to using binary mode, we divide 32-bit IP addresses into four groups, each with "." Separate and convert each set of numbers into decimal numbers. As follows:
1.2 the IP address consists of a network and a host identification.
As shown in the following figure, the network identity configures different values for each segment of the data link. The network identity must ensure that the addresses of each segment connected to each other are not duplicated. Hosts connected within the same segment must have the same network address. The "host identity" of the IP address is not allowed to repeat within the same network segment. Thus, by setting the network address and the host address, it is possible to ensure that the IP addresses of each host do not overlap each other in the entire network that is connected to each other. That is, the IP address is unique.
Host identification of IP addr
As shown in the following figure, when an IP packet is forwarded to a router on the way, it is routed using the network identity of the destination IP address. Because even if you don't look at the host ID, you can tell whether it is a host within the network segment as soon as you see the network ID.
Network identification of IP addr
1.3Classification of IP addresses
IP addresses are divided into four levels: class A, Class B, Class C, and Class D. It distinguishes its network identity and host identity based on the bit column from bit 1 to bit 4 in the IP address.
A class An IP address is the first address that begins with "0". From bit 1 to bit 8 is its network identity. In decimal terms, 0.0.0.01127.0.0.0 is a class A network address. The last 24 bits of a Class An address are equivalent to the host identity. Therefore, the maximum number of host addresses that can be contained in a network segment is 16777214.
Class B IP addresses are the first two "10" addresses. From bit 1 to bit 16 is its network identity. In decimal terms, 128.0.0.0191.255.0.0 is a class B network address. The last 16 bits of a Class B address are equivalent to the host identity. Therefore, the maximum number of host addresses that can be contained in a network segment is 65534.
Class C IP addresses are addresses with the first three digits "110". From bit 1 to bit 24 is its network identity. In decimal terms, 192.0.0.01223.255.255.0 is a class C network address. The last 8 bits of a Class C address are equivalent to the host identity. Therefore, the maximum number of host addresses that can be contained in a network segment is 254.
A Class D IP address is an address with the first four digits "1110". From bit 1 to bit 32 is its network identity. In decimal terms, 224.0.0.05239.255.255.255 is a class D network address. Class D addresses do not have a host identity and are often used for multicast.
There is one thing to note about the host identity when assigning IP addresses. That is, when you want to represent the host address in bits, you cannot have all zeros or all ones. Because all zeros are used only if the corresponding network address or IP address is not known. Hosts with all 1s are usually used as broadcast addresses. Therefore, in the process of allocation, these two cases should be removed. This is why Class C addresses can only have up to 254 (28-2 = 254) host addresses per network segment.
1.4 broadcast address
Broadcast addresses are used to send packets between hosts connected to each other on the same link. Set all the host addresses in the IP address to 1 to become the broadcast address.
Broadcasting is divided into two types: local broadcasting and direct broadcasting. Broadcasting within this network is called local broadcasting; broadcasting between different networks is called direct broadcasting.
1.5 IP Multicast
Multicast is used to send packets to all hosts in a specific group. Because it uses IP addresses directly, there is no reliable transmission.
Compared with broadcasting, multicast can not only penetrate the router, but also send packets to only those necessary groups. Please take a look at the following picture:
IP Multicast
Multicast uses a Class D address. Therefore, if the first bit to the fourth bit is "1110", it can be considered a multicast address. The remaining 28 bits can be used as multicast group numbers.
In addition, for multicast, all hosts (hosts other than routers and end hosts) must belong to group 224.0.0.1, and all routers must belong to group 224.0.0.2.
1.6 Subnet Mask
Now the network identification and host identification of an IP address are no longer limited to the category of the address, but are subdivided by an identification code called "subnet mask" into networks with smaller granularity than Class A, Class B and Class C. In fact, this method is to use the host address part of the original class A, class B, class C and other categories as subnet addresses, which can divide the original network into multiple physical networks.
If the subnet mask is expressed in binary, it is also a 32-bit number. The bits corresponding to the network identification part of the IP address are all "1", and the host identification parts of the corresponding IP address are all "0". Thus, an IP address can no longer be limited to its own category, but can freely locate its own network identity length with such a subnet mask. Of course, the subnet mask must be the first consecutive "1" of the IP address.
There are currently two representations for subnet masks. * the addresses of the IP address and the subnet mask are represented by two lines respectively. Take the case where the first 26 bits of 172.20.100.52 are network addresses, as follows:
The second representation is that the number of bits that append the network address to each IP address is separated by a "/", as follows:
two。 Routin
The address used to send the packet is the address of the network layer, the IP address. However, only the IP address is not enough to send the packet to the peer destination address, and in the process of data transmission, information such as "indicating the router or host" is also needed in order to actually send it to the destination address. The one that holds this information is the routing control table.
The routing control table is formed in two ways: one is manually set by the administrator, and the other is automatically refreshed when the router exchanges information with other routers. The former is also called static routing control, while the latter is called dynamic routing control.
The IP protocol always believes that the routing table is correct. However, IP itself does not define the protocol for making routing control tables. That is to say, IP has no mechanism to make routing control table. The representation is made by a protocol called routing protocol.
2.1 IP address and routing Control
The network address portion of the IP address is used for routing control.
The routing control table records the network address and the address that should be sent to the router next.
When sending an IP packet, we should first determine the destination address in the header of the IP packet, then find a record with the same network address from the routing control table, and forward the IP packet to the corresponding next router according to this record. If there are multiple records of the same network address in the routing control table, select the network address that best matches.
Routing Control Table and IP packet sending
3. IP subcontracting and grouping
The MTU of each data link is different because each type of data link is used for a different purpose. If the purpose of use is different, the MTU that can be carried is different.
It is necessary for any host to deal with IP fragments accordingly. Fragments are often processed when they encounter large messages on the network that cannot be sent at once.
When the fragmented IP Datagram is reorganized, it can only be carried out by the target host. Although the router is fragmented, it will not be reorganized.
3.1path MTU Discovery
The slicing mechanism also has its shortcomings. For example, the processing load of the router is increased and so on. Therefore, as long as it is allowed, it is not desirable for the router to fragment IP packets.
In order to deal with the deficiency of slicing mechanism, the "path MTU discovery" technology arises at the historic moment. Path MTU refers to the size of * MTU that does not need to be shredded from the sender to the receiver. That is, the smallest MTU of all data links that exist in the path.
Path MTU discovery can avoid fragmentation on the midway router and send larger packets in TCP.
4. IPv6
IPv6 (IP version 6) is a standardized Internet protocol to fundamentally solve the problem of IPv4 address exhaustion. The address length of the IPv4 is 4 8-bit bytes, or 32 bits. On the other hand, the address length of IPv6 is four times that of the original, that is, 128bits, which is generally written as eight 16-bit bytes.
4.1Features of IPv6
IP learned about the expansion and aggregation of routing control tables.
Improved performance. The header length of the packet uses a fixed value (40 bytes), and the header check code is no longer used. Simplify the header structure and reduce the burden on the router. The router no longer does sharding processing.
Plug and play is supported. IP addresses can be assigned automatically even if there is no DHCP server.
Authentication and encryption functions are adopted. The network security function to deal with forged IP addresses and the function to prevent line eavesdropping.
Multicasting and Mobile IP become extended functions.
4.2 marking method of IP address in IPv6
Generally speaking, 128bit IP addresses are grouped in groups of 16 bits, and each group is marked with a colon (":").
And if there are consecutive zeros, you can omit them and separate them with two colons ("::"). However, only two consecutive colons are allowed in an IP address.
4.3 structure of IPv6 addresses
IPv6, like IPv4, also identifies the type of IP address by the first few bits of the IP address.
In Internet communication, a global unicast address is used. It is the only address on the Internet and does not require a formal IP address assignment.
4.4 Global unicast address
A global unicast address is the only address in the world. It is the most commonly used IPv6 address in Internet communication and intra-domain communication.
As shown in the figure below, the formats now used in IPv6's network are n = 48m = 16 and 128n-m = 64. That is, the first 64 bits are the network identity and the last 64 bits are the host identity.
Global unicast address
4.5 Link-local unicast address
Link-local unicast addresses are addresses that are unique within the same data link. It is used for communication on the same link without going through the router. Usually the interface ID saves the 64-bit version of the MAC address.
Link-local unicast address
4.6 unique local address
The only local address is the address used when there is no Internet communication.
A unique local address will not connect to the Internet, but it will generate a unique global ID as randomly as possible.
L is usually set to 1
The value of global ID is randomly determined.
Subnet ID refers to the subnet address of this domain
Interface ID is the ID of the interface.
Unique local address
4.7 IPv6 segmented processing
The fragmentation of IPv6 is only carried out on the sending host as the starting point, and the router does not participate in the slicing.
The minimum MTU in IPv6 is 1280 bytes, so for those devices with certain system resource constraints in embedded systems, there is no need for "path MTU discovery", but when sending IP packets, they are sent in pieces in units of 1280 bytes.
4.8 IP first part (for now)
5. Technologies related to IP protocol
IP is designed to allow the final destination host to receive packets, but it is impossible to communicate with IP alone in the process. There must also be the ability to resolve host names and MAC addresses, as well as the ability to handle exceptions during packet delivery.
5.1 DNS
We usually use a string of Roman characters and periods instead of an IP address when we visit a website. On the other hand, the average user does not use the IP address when using TCP/IP to communicate. This can be done because of the support of the DNS (Domain Name System) feature. DNS can automatically convert that string to a specific IP address.
This DNS applies not only to IPv4, but also to IPv6.
5.2 ARP
As long as the IP address is determined, the IP Datagram can be sent to this destination address. However, at the underlying data link layer, it is necessary to know the MAC address corresponding to each IP address for actual communication.
ARP is a protocol that solves address problems. The target IP address is used as a clue to locate the MAC address of the next network device that should receive data packets. However, ARP is only available for IPv4, not for IPv6. In IPv6, you can use ICMPv6 instead of ARP to send neighbor discovery messages.
RARP is a protocol that reverses ARP and locates IP addresses from MAC addresses.
5.3 ICMP
The main functions of ICMP include confirming whether the IP packet is successfully delivered to the target address, notifying the specific reasons why the IP packet is abandoned in the sending process, improving the network setting, and so on.
ICMP supports IPv4 only as an auxiliary role in IPv4. In other words, in the IPv4 period, even without ICMP, IP communication can still be achieved. However, in IPv6, the role of ICMP is expanded, and normal communication cannot be carried out without ICMPv6,IPv6.
5.4 DHCP
It would be very tedious to set IP addresses for each host one by one. Especially when moving devices such as laptops, terminals, and tablets, you have to reset the IP address every time you move to a new place.
Therefore, in order to set the IP address automatically and manage the IP address assignment uniformly, the DHCP (Dynamic Host Configuration Protocol) protocol is produced. With DHCP, computers can communicate with TCP/IP as long as they are connected to the network. In other words, DHCP makes plug and play possible.
DHCP can be used not only in IPv4 but also in IPv6.
5.5 NAT
NAT (Network Address Translator) is a technology used to use private addresses in the local network and switch to global IP addresses when connecting to the Internet.
In addition to translating IP addresses, there is also a NAPT (Network Address Ports Translator) technology that can translate TCP and UDP port numbers, which enables you to communicate with multiple hosts with a global IP address.
NAT (NAPT) is actually a technology developed for IPv4, which is facing address exhaustion. However, NAT is also used in IPv6 to improve network security, and NAT-PT is often used in the communication between IPv4 and IPv6.
5.6 IP Tunnel
Two IPv6 networks with IPv4 networks
For example, in the network environment above, there is no direct communication between network An and network B. in order for them to communicate normally, the function of IP tunnel must be used.
The IP tunnel can integrate the IPv6 packets sent from network An into one data, and then add an IPv4 header to it and forward it to network C.
Generally speaking, the first part of IP is followed by the first part of TCP or UDP. However, in the current application, "the first part of IP is still the first part of IP" or "the first part of IP is followed by the first part of IPv6" and so on. This communication method that appends the head of the network layer to the head of the network layer is called "IP tunnel".
At this point, the study of "detailed interpretation of the computer network TCP/IP protocol" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.