"Linux High-Performance Server Programming"--TCP/IP Protocol Family

Table of contents

1--TCP/IP protocol suite

2--Data link layer

3--Network layer

4--Transport layer

5--Application layer

6--Encapsulation and separation

7--The working principle of ARP protocol


1--TCP/IP protocol suite

The TCP/IP protocol suite is a four-layer protocol system, consisting of data link layer , network layer , transport layer and application layer         from bottom to top ;

2--Data link layer

        Two commonly used protocols in the data link layer: ARP protocol (Address Resolution Protocol) and RARP protocol (Reverse Address Resolution Protocol);

        ARP protocol: Convert IP address to physical address (MAC address);

        RARP protocol: used for diskless workstations. Due to the lack of storage devices, they cannot remember their own IP addresses. They need to use the physical address on the network card to query the network administrator for their own IP address;

3--Network layer

        The task of the network layer is to select intermediate nodes (routers) to determine the communication path between two hosts ;

        Two commonly used protocols at the network layer: IP protocol and ICMP protocol;

        The IP protocol uses a hop-by-hop approach to determine communication paths , and the ICMP protocol is used to detect network connections ;

        The message format used by the ICMP protocol: 8-bit type + 8-bit code + 16-bit checksum + message content ; the 8-bit type field is used to distinguish the message format, which divides ICMP messages into error messages and query messages Two major categories;

        Error messages are used to respond to network errors : type 3 indicates that the target is unreachable, type 5 indicates redirection;

        Query messages are used to query network information : the ping program uses type 8 to check whether the target is reachable;

        8-bit codes are used to further subdivide the different division criteria;

The 16-bit checksum field performs a cyclic redundancy check (CRC)         on the entire message to check whether the message is damaged during transmission;

4--Transport layer

        The transport layer provides end-to-end communication for applications on two hosts. Commonly used protocols include TCP protocol, UDP protocol and SCTP protocol;

        The TCP protocol (Transmission Control Protocol) provides reliable, connection-oriented, and stream-based services to the application layer;

        The UDP protocol (User Datagram Protocol) provides unreliable, connectionless, and datagram-based services to the application layer;

        SCTP protocol (Stream Control Transmission Protocol), used to transmit telephone signals over the Internet;

5--Application layer

        The application layer is responsible for processing the logic of the application, which is implemented in user space; commonly used protocols in the application layer include: telnet protocol, OSPF protocol, DNS protocol; the application layer protocol can use either TCP service or UDP service;

        The telnet protocol is a remote login protocol that can complete remote tasks locally;

        The OSPF (Open Shortest Path First) protocol is a dynamic routing update protocol that is used for communication between routers to inform each other of their routing information;

        The DNS protocol provides conversion of machine domain names to IP addresses;

6--Encapsulation and separation

        Each layer of protocol adds the header information of this layer on the basis of the upper layer data to realize the function of this layer. This process is called encapsulation; the data after TCP encapsulation is called TCP segment; after UDP encapsulation The data is called a UDP datagram; the data encapsulated by IP is called an IP datagram; the data encapsulated by the data link layer is called a frame; a frame is a sequence of bytes that is ultimately transmitted in the physical network;

        When the frame reaches the destination host, it will be passed along the protocol stack from bottom to top. Each layer of the protocol will process the header data responsible for this layer in the frame in order to obtain the required information, and finally hand the processed frame to the target. application, this process is called decommissioning;

7--The working principle of ARP protocol

        The ARP protocol can convert any network layer address to any physical address. Its working principle is as follows: the host broadcasts an ARP request to its own network, which contains the network address of the target machine; other machines on the network will receive this request. , only the requested target machine will respond with an ARP reply, where the reply content contains its own physical address;

        ARP maintains a cache that contains the mapping of IP addresses to physical addresses of frequently visited or recently visited machines, which can avoid repeated ARP requests and increase the speed of sending data packets;

Guess you like

Origin blog.csdn.net/weixin_43863869/article/details/132995860