Interview Summary (2)

Understand the basic protocols in TCP/IP

        The TCP/IP protocol is the basic protocol in the Internet. It consists of multiple protocols, and each protocol has specific functions. The following are the basic protocols in the TCP/IP protocol:

        1. IP protocol: IP protocol is the basic protocol of TCP/IP. It is mainly responsible for the transmission and routing of data packets. The IP protocol uses IP addresses to represent hosts and routers in the network, and then selects the best one through the routing table Path to transmit packets.

        2. TCP protocol: TCP protocol is a reliable transmission protocol that provides link-oriented and reliable data transmission. TCP protocol establishes connection through three-way handshake, and ensures the reliability of data transmission through sliding window and confirmation response mechanism. At the same time, it supports Data flow control and congestion control.

        3. DNS protocol: DNS protocol is a domain name system protocol. Its function is to resolve domain names into IP addresses, so that users can access network resources through domain names.

        4. ICMP protocol: ICMP protocol is a protocol for network error reporting and diagnosis. ICMP messages are usually sent by routers or hosts to check whether the target host is reachable, network congestion, and whether the network parameters of the host are correct.

        5. UDP protocol: UDP protocol is an unreliable transmission protocol that provides connectionless data transmission. The UDP protocol does not guarantee the reliability of data, but it has the advantages of simplicity, high efficiency, and low latency. It is often used in audio and video transmission, DNS query and other scenarios.

        6. ARP protocol: ARP protocol is a protocol used to obtain the MAC address of the target device, and map the IP address to the MAC address to facilitate the transmission of data packets in the LAN.

Briefly explain the three-way handshake in the TCP protocol

        The first handshake: the client will send a SYN packet to the server, where the SYN flag is 1, indicating that the client requests to establish a connection, and randomly generates an initial sequence number to locate seq=x;

        The second handshake: After receiving the SYN packet sent by the client, the server will restore a SYN-ACK packet, in which the flag bits of SYN and ACK are both 1, indicating that the client request is confirmed, and the server also randomly generates a serial number seq =y, the client's initial sequence number +1, so ACK=X+1;

        The third handshake: After receiving the SYN-ACK packet recovered by the server, the client sends an ACK packet, with the ACK mark bit being 1, indicating confirmation of the server’s reply, and confirming the confirmed ACK=Y+1;

Briefly explain the four waves in the TCP protocol

        The first wave: the client sends a FIN packet to the server, where the FIN flag is 1, indicating that the client no longer sends data and requests to close the connection;

        Second wave: After receiving the FIN packet sent by the client, the server replies with an ACK packet to confirm the client's close request, but at this time the server may still have data to send to the client, so the server does not close the connection immediately, continue send data;

        The third wave: After the server sends all the data, it sends a FIN packet to the client, where the FIN flag is 1, indicating that the server has completed sending data and requests to close the connection;

        The fourth wave: After receiving the FIN packet sent by the server, the client replies with an ACK packet, in which the ACK flag bit is 1, which means confirming the closing request of the server, and sets the confirmation number as the serial number of the server plus 1, that is, ack = seq_server + 1, the connection is broken.

        

        

Guess you like

Origin blog.csdn.net/weixin_64625868/article/details/129347167