TCP/IP Layer 4 protocol family

This is the fourth day of my participation in the August More text Challenge. For details, see:August is more challenging

Before the interview, the necessary review is also essential! Combined with part of the online materials and courses, sort out some knowledge points. Now I regret that I did not listen carefully in class.

1. Network connection

OSI seven-layer model TCP/IP Layer 4 protocol family Corresponding Network Protocol
Application layer The application layer HTTP, TFTP, FTP, NFS, WAIS, SMTP
Presentation layer Telnet, Rlogin, SNMP, Gopher
Session Layer SMTP, DNS
Transport The transport layer TCP, UDP
Network Layer The network layer IP, ICMP, ARP, RARP, AKP, UUCP
Data Link Layer Data link layer FDDI, Ethernet, Arpanet, PDN, SLIP, PPP
Physical layer IEEE 802.1a, IEEE 802.2.2 to IEEE 802.11
  • The OSI model, known as the Open System Interconnection, is proposed by the International Organization for Standardization (ISO). It was mainly used to solve the problem that various network technology suppliers could not unify the protocol at that time. By abstracting the whole network architecture into 7 layers, it defined from the bottom physical layer, data link layer to the top application layer.

  • TCP/IP Protocol Suite(TCP/IP Protocol Suite) is a communication model with TCP Protocol and IP Protocol as the core. This model adopts the Protocol stack to implement many communication protocols and abstract the communication system into four layers. The TCP/IP model originated from the ARPA network project of the U.S. Department of Defense (DoD) and has since been maintained by the IETF.

2. Network layer: Simplified IP network layer 3 transmission

2.1 IP header information

The IP header is the information at the beginning of an IP packet, including the IP version, source IP address, destination IP address, and TTL

2.2 Procedure for IP Layer Data Transmission

  1. The upper layer sends packets containing “data” to the network layer.
  2. The network layer then appends the IP header to the packet to form a new IP packet and delivers it to the bottom layer.
  3. The underlying layer transmits data packets to host B over the physical network.
  4. The packet is transmitted to the network layer of host B, where host B disassembles the IP header of the packet and delivers the disassembled data to the upper layer. Finally, the packet containing the “data” information reaches the upper layer of host B.

3. Transport Layer: Simplified UDP Layer 4 network connection

3.1 the UDP function

IP uses THE IP address information to send packets to the specified computer, while UDP uses the port number to send packets to the correct program

3.2 UDP header information

The port number is inserted into the UDP header, which is then combined with the original packet to form a new UDP packet. The UDP header contains information such as the destination port and the source port number

3.3 Procedure for UDP Layer Transmission

  1. The upper layer delivers the packet containing “data” to the transport layer;
  2. The transport layer appends A UDP header to the packet, forming a new UDP packet, and then delivers the new UDP packet to the network layer.
  3. The network layer then appends the IP header to the packet to form a new IP packet and delivers it to the bottom layer.
  4. The packet is transmitted to the network layer of host B, where host B disassembles the IP header and delivers the disassembled data portion to the transport layer.
  5. At the transport layer, the UDP header in the packet is disassembled and the data portion is handed over to the upper-layer application based on the port number provided in the UDP. Eventually, the packet containing the “data” information travels to the host B upper layer application

3.4 Features of UDP Data Transmission

When sending data using UDP, a variety of factors may cause errors in packets. Although UDP can verify whether the data is correct, it does not provide a mechanism for resending incorrect packets. Instead, it simply dismisses the current packet

3.5 UDP Applications

UDP does not guarantee data reliability, but it is very fast, so it is used in areas where speed is important but data integrity is not so strict, such as online video, interactive games, etc

Transport Layer: Simplified TCP Layer 4 network connection

4.1 TCP Header information

In addition to the destination and local port numbers, the TCP header also provides sequence numbers for sorting so that the receiver can reorder packets by the sequence number

4.2 Life Cycle of TCP Connections

  1. Establishment phase (three-way handshake) The client sends a connection request to the server, and the server responds. The client notifies the server that it has received the reply

  2. Data transmission for a single data packet: The receiving end needs to confirm each data packet. That is, after receiving the packet, the receiver needs to send the acknowledgement packet to the sender. Therefore, if the sender sends a packet but does not receive the acknowledgement message from the receiver within a specified time, it will be judged as packet loss and trigger the resending mechanism of the sender for large files: During transmission, a large file is divided into many small packets. When these packets arrive at the receiving end, the receiving end sorts them according to the serial number in the TCP header to ensure complete data

  3. The disconnection phase (four waves) can be initiated by either the client or the server. Both the client and the server must be in the disconnection ready state in order to actually disconnect. For example, the client initiates a disconnection request, the server acknowledges the disconnection request, returns a disconnection confirmation message, and the client is in the disconnection ready state. When the server completes the processing, it sends a disconnection request to the client, and the client returns a message that it can be disconnected, so the server is in the disconnection ready state. At this time, both the client and the server are in the disconnection ready state, and the connection is disconnected

  1. Code interpretation

    SYN indicates that the connection is established

    FIN: closes the connection

    ACK stands for response

    PSH indicates that DATA is transferred

    RST indicates connection reset

The Wireshark filter statements are as follows: IP.addr == 127.0.0.1 && ip. DST == 127.0.0.1 && tcp.port == 53100

4.3 Features of TCP Data Transmission

Transmission Control Protocol (TCP) is a connection-oriented, reliable, and byte stream-based transport layer communication Protocol

  • In case of packet loss, TCP provides a retransmission mechanism.
  • TCP introduces a packet sorting mechanism to ensure that out-of-order packets are combined into a complete file.