[Computer network study notes (2)] TCP/IP introduction, TCP/IP layered model, communication process analysis

This article is published by the official account [Developing Pigeon]! Welcome to follow! ! !


Old Rules-Sister Town House:

One. TCP/IP

(1) Historical origin

1. Military Technology

       In the 1960s, an organization centered on the U.S. Department of Defense (DoD) began research on communication technology. DoD believes that in the process of communication transmission, it is immediately attacked and destroyed by the enemy, and the final communication can also be achieved through circuitous lines. Guaranteed uninterrupted. If the central node in the central location encounters an attack, it will affect the communication transmission of the entire network. If the network presents a distributed communication composed of many circuitous lines, it will be able to maintain communication even if it is attacked at a certain place.

       In order to realize this kind of distributed communication, packet switching technology came into being, which allows multiple users to share a communication line for communication at the same time, thereby improving the efficiency of the line and reducing the cost.

2. ARPANET

       In order to verify the packet switching technology, 4 nodes were built in the United States. This network is called ARPANET, which is the originator of the Internet.


3. TCP/IP

       The ARPANET experiment is not only an experiment of packet switching, but also an experiment of a communication protocol that provides reliable transmission between computers. Therefore, the TCP/IP protocol was developed. However, due to the limitation of the number of nodes in the ARPANET network, the application of this protocol was also restricted. Later, because the UNIX system realized the TCP/IP protocol, it was widely promoted and applied, and finally the network Internet based on the TCP/IP protocol was born.


(2) Standardization of TCP/IP

1. Specific meaning

       Some people may think that TCP/IP is two protocols, but actually refers to the collective name of the group of protocols used when communicating with IP, such as IP or ICMP, TCP or UDP, TELNET or FTP, and HTTP all belong to TCP/IP Agreement.

       Application protocol: HTTP, SMTP, FTP, TELNET, SNMP;

       Transmission protocol: TCP, UDP;

       Internet Protocol: IP, ICMP, ARP;

       Routing control protocol: RIP, OSPF, BGP;

2. RFC specification

       Protocols that need to be standardized are listed in RFC (Request For Comment) documents and published on the Internet, and everyone can discuss them. RFC documents organize standardization requests for each protocol by numbering. Each RFC document cannot be modified as long as it is confirmed. If you want to modify it, you can only reissue a new RFC document and invalidate the old RFC document.

(3) The structure of the Internet

       Each network in the Internet is composed of a backbone network and a terminal network, and each network is connected through a NOC (Network Operation Center). If the network operator is different, its network connection method and use method will also be Different, connecting this kind of heterogeneous network needs the support of IX (Network Exchange Center), so the Internet is a huge network interconnected by many heterogeneous networks through IX.

       To connect to the Internet, you need to apply to the ISP or local area network, and the family can apply for network access and sign a contract with the ISP.


two. TCIP/IP protocol layered model

(I. Overview

       Before we introduced the OSI model, various TCP/IP protocols can also correspond to the OSI reference model, but the OSI model focuses on the necessary functions of the communication protocol, while TCP/IP emphasizes the implementation of the protocol on the computer. Which program to develop. TCP/IP is mainly divided into 5 layers, application layer, transport layer, internet layer, network interface layer, and hardware layer.

(Two) hardware layer

       The bottom layer is the hardware responsible for data transmission, which is equivalent to physical layer equipment such as Ethernet or telephone lines.

(3) Network interface layer

       Use the data link layer in Ethernet to communicate.

(4) Internet layer

       The IP protocol is used, which is equivalent to the network layer, and the IP protocol forwards the packet data based on the IP address. The functions of the Internet layer and the transport layer in the TCP/IP layer are usually provided by the operating system, especially the router, which must realize the function of forwarding packet data packets through the Internet layer. There are three protocols at this layer:

       IP is a protocol that transmits data packets across the network so that the entire Internet can receive the data, and uses the IP address as the identification of the host. Although IP is also a group of protocols for packet switching, it does not have a retransmission mechanism and is an unreliable transmission protocol.

       The ICMP protocol is to send an exception notification to the sender when an exception occurs during the sending process using the IP protocol, and is usually used to diagnose the health of the network.

       The ARP protocol resolves the physical address from the IP address of the packet data packet.

(5) Transport layer

       The function of the transport layer is to enable communication between applications. There are usually multiple programs running inside the computer. For this reason, it is necessary to distinguish which programs and which programs are communicating, and identify them by port numbers. There are two protocols at this layer:

       TCP is a connection-oriented transport layer protocol, which can ensure that the communication between the communication hosts at both ends is reachable, can correctly handle the problems of packet loss and disorder in the transmission process, and can also effectively use bandwidth. But it is not conducive to the dissemination of audio and video.

       UDP is a connection-oriented transport layer protocol that does not pay attention to whether the opposite end actually receives the data. It is often used for less data, multicast or broadcast communication, and video communication.

(6) Application layer

1 Overview

       The session layer, presentation layer, and application layer in the OSI model are all implemented in applications. Some of these functions are implemented using a single program, and some are implemented using multiple programs.

2. Browser

       There are many fighter CS architectures or BS architectures in the current application architecture. The communication protocol between the browser and the server is HTTP. The main format of the transmitted data is HTML. HTTP belongs to the OSI application layer protocol, and HTML belongs to the presentation layer protocol.

3. Email

       When the protocol used for sending emails, SMTP can only send text format at first. After the MIME protocol is extended, binary information such as images and sounds can be sent, which belongs to the presentation layer protocol.

4. FTP

       File transfer uses FTP (File Transfer Protocol), and the transfer process can use binary or text format. When transferring files in FTP, two TCP connections are established, which are the control connection that sends out the transmission request and the data connection that actually transmits the data. The control and management of these two connections belongs to the function of the session layer.

5. Remote login

       TELNET (Teletypewriter Network) and SSH (Secure SHell) two protocols.


6. Network Management

       For network management, the SNMP protocol is used, and the hosts, bridges, and routers managed by SNMP become SNMP agents, and the management end is called the manager. Administrators can check network congestion in time and find faults.

three. TCP/IP model communication

(1) Packet header

       For each layer, a header is added to the data sent. This header contains the necessary information of the layer, such as the destination address sent, its own address and protocol type, which are opened in the next layer and received by the previous layer. The packets are all the data of this layer, and then add the header of this layer to it to continue forwarding.

       The frame is the unit of the data link layer packet, the data packet is the unit of the packet above the network layer such as IP and UDP, the end is the information in the TCP data stream, and the message refers to the unit of data in the application protocol.


(2) Send data packet

1. Application processing

       The application encodes the message, which is equivalent to the OSI presentation layer function, and then the session layer is responsible for the management function of when to establish communication and when to send data, establish a TCP connection at the moment of sending, and send the application data to TCP , And then do the actual forwarding processing.

2. TCP module processing

       TCP is responsible for establishing a connection, sending data, and disconnecting according to the instructions of the application. TCP provides reliable transmission of data sent from the application layer to the opposite end smoothly. In order to achieve this function, it is necessary to add a TCP header to the front end of the application layer data, including the source port number and the destination port number, the serial number (the serial number indicating the byte of the data packet is the real data), and the calibration Check the sum (judge whether the data is damaged), and finally send it to the IP.

3. IP module processing

       Add your own IP header to the front end of the data transmitted by TCP, including the IP address of the receiver and the IP address of the sender. Following the IP header, there is also information used to determine whether the subsequent data is TCP or UDP. After the IP packet is generated, refer to the routing control table to determine the route or host that accepts the IP packet, and then the IP packet is sent to the driver connected to the network interface of these routers or hosts in order to actually send the data. If you don't know the MAC address of the receiving end, use ARP to find the MAC address of the opposite end, and then you can pass the MAC address and IP address to the Ethernet driver to realize data transmission.


4. Network interface (Ethernet driver) processing

       Add the Ethernet header to the data sent by IP, including the receiving end MAC address and the sending end MAC address, and the protocol of Ethernet data marked as Ethernet type, and then transmit it through the physical layer to the means, set FCS to judge the data Whether the package is damaged due to noise.

Guess you like

Origin blog.csdn.net/Mrwxxxx/article/details/114436387