Simple understanding of TCP/IP protocol

Source: Internet
Author: User
Tags snmp file transfer protocol ftp protocol

First, what is TCP/IP

TCP/IP is a protocol family because the TCP/IP protocol includes many protocols, such as TCP, IPs, UDP, ICMP, RIP, Telnetftp, SMTP, ARP, TFTP, and so on, which are collectively known as TCP/IP protocols.

Communication is similar to language communication, the agreement can be understood as language communication, we all speak Chinese, we two people can communicate with each other.

The "Data link layer" can be likened to a person for a more descriptive protocol, but the person will not speak and communicate more difficult. In order to more convenient communication, it leads to the "network layer", you can think it is talking people, then everyone will talk, but a person speak English a person speak Chinese, we still can not better communication. Then we should discuss how to communicate, we must all speak Chinese, so that we can understand what each other said, "transmission layer" can be considered to speak Chinese people. This allows normal communication to be achieved at the transport level. For people to communicate more conveniently, or to make communication look more gorgeous and more practical. At this time the "application layer" was born. In fact, it is more convenient, more effective people communicate, it can be compared as a Chinese speaking very good people.

The TCP/IP protocol family is divided into four levels of link layer, network layer, Transport layer and application layer. (In parallel with TCP/IP protocol, OSI Network framework model---Open System Interconnect Reference Model, divided into physical layer, data link layer, network layer, transport layer, Session layer, presentation layer, application layer seven levels)

Layers are packaged from top to bottom.

1, Application layer: The top is the application layer, which has http,ftp and so on we are familiar with the agreement. (In a Layered TCP/IP hierarchy, the functionality of the session, presentation, and application tiers in the OSI reference model is centralized into the application implementation.)
Most architectures for TCP/IP applications belong to the client/server model. )

Responsible for the direct and application interface and the provision of common web application services, in addition, in order to provide effective network services to the application, the application layer also needs to establish the effectiveness of the application process of mutual communication and provide synchronization between the two sides, need to provide the application process required information exchange and remote operation, There is a need to establish a mechanism for error recovery to ensure consistency of application-level data. (FTP protocol, TFTP protocol, Telnet protocol, DNS protocol, HTTP protocol).

Provide users with a common set of applications, such as e-mail, file transfer access, Telnet, and so on. Telnet uses the Telnet protocol to provide an interface that is registered on other hosts on the network. The Telnet session provides a character-based virtual terminal. File Transfer Access FTP uses the FTP protocol to provide file copy functionality between machines in the network.

DNS protocol: The main function is to provide the user with a user-friendly name for the domain name resolution service, the host name Domain name resolves to an IP address.

HTTP protocol: Hypertext Transfer Protocol is a rule that specifies the communication between the browser and the World Wide Web server.

SMTP protocol: Easy Mail Transfer Protocol (Simple Message Transfer Protocol).

SNMP protocol: Simple Network manage Protocol (simplified web Management protocol).

FTP protocol: File Transfer Protocol (Files Transfer Protocol).

The main applications of the application layer are:

WWW: The protocol used to communicate between the browser and the server is the HTTP protocol, the main format of the transmitted data is the protocol of the OSI application layer in HTML,WWW, and the HTML belongs to the Protocol of the presentation layer.

E-mail: The protocol used to send an e-mail message is SMTP. Initially, you can send e-mail only in file format. Now the format of e-mail is extended by the MIME protocol, you can send a variety of information such as sound, image and so on. MIME belongs to the protocol of the presentation layer.

File Transfer (FTP): File transfer refers to the transfer of files on other computer disks to the local computer, or the transfer of files on the local disk to other computer disks. The protocol used by the file transfer process is called the FTP protocol. When transferring files in FTP, two TCP connections are established, which are the data connections to be used when sending the transfer request and the control connection to the actual data transfer.

Telnet (telnet and ssh): Telnet is a feature that logs on to a remote computer to enable programs on that computer to run. Telnet and SSH two protocols commonly used. (There are some other agreements, of course)

Network Management (SNMP): SNMP (Simple Network Management Protocol) protocol is used in TCP/IP. Hosts, bridges, routers, and so on, which are managed using SNMP protocols, are called SNMP agents, and the end of management is called the manager. SNMP is the protocol that this manager and agent need to use. On the agent side of SNMP, the information of network interface, the amount of communication data, the amount of abnormal data and the temperature of equipment are kept. This information can be accessed through the MIB (Management information Base). Therefore, in TCP/IP network management, SNMP belongs to the application protocol, and the MIB belongs to the presentation layer protocol.

2. Transport Layer: the famous TCP and UDP protocol is at this level (don't tell me you didn't use UDP to play StarCraft).

Provides communication between applications. Its features include:

(1) Format the flow of information;

(2) Provide reliable transmission. To achieve the latter, the Transport Layer protocol specifies that the receiving side must send back the acknowledgement, and if the packet is lost, it must be resent.

The UDP protocol (user Datagram Protocol, Subscriber Datagram Protocol) is an unreliable, non-connected Transport layer protocol that does not take into account flow control, error control, and no retransmission mechanism, and does not sequence the sorting of packets. (UDP header with 8-byte fixed-length and 2-byte multiples of data < not 2-byte multiples need to be populated with bit >) (UDP is a transport-layer protocol that targets no connectivity.) UDP does not care if the peer is actually receiving data that transmits past. If you need to check whether the peer receives packet packets, or if the peer is connected to the network, you need to implement them in your application. UDP is commonly used in multimedia fields such as small packet data or multicast, broadcast communication and video communication. )

The TCP protocol (Transport Control Protocol, Transmission Protocol) is a connection-oriented, reliable, byte-stream-based Transport layer protocol, which uses the acknowledgement mechanism, the time-out retransmission mechanism, and the incoming TCP message segments to be rearranged. (TCP header with 20-byte fixed length, options and padding < options and padding less than or equal to 40 bytes >) (TCP is a connection-oriented Transport layer protocol.) It ensures that communication between the two ends of the communication host can be reached. TCP can correctly handle drops in the transmission process, transmission sequence and other anomalies. )

UDP Benefits:

Fewer control options, no need to establish a connection, so that the data transfer process of small delay, high data transmission efficiency.

UDP is suitable for applications where reliability is not high, or network quality is guaranteed, or the demand for real-time performance is high.

TCP Benefits:

Can guarantee the reliability and stability.

TCP is suitable for end-to-end communication and is suitable for services with high reliability requirements.

3, the network layer: to handle the flow of data packets on the network (the smallest data unit in the network transmission), specify the path of the packet to the target computer, and send the packet to the other side. (IP protocol, ARP protocol, RARP protocol are closely related to TCP/IP protocol). The IP protocol is here, which is responsible for adding IP addresses and other data (as described later) to the data to determine the destination of the transmission.

Responsible for communication between neighboring computers. Its functions include three aspects.

(1) Processing packets from the transport layer to send the request, after receiving the request, will be grouped into the IP datagram, populate the header, select the path to the host, and then send the datagram to the appropriate network interface.

(2) Processing input datagram: first check its legitimacy, and then to find the path-if the datagram has arrived at the Beacon, then remove the header, the rest to the appropriate transmission protocol, if the datagram has not arrived, then forward the datagram.

(3) Processing path, flow control, congestion and other problems.

IP protocol: internetworking Protocol (Network protocol), IP is a protocol that transmits packets across the network, enabling the entire Internet to receive data. IP is also a protocol for packet switching, but it does not have a retransmission mechanism, so it is an unreliable transport protocol.

IPV4: The head consists of a 20-byte fixed length and an optional variable-length portion (less than or equal to 40 bytes), 32-bit record source-side IP address, 32-bit record destination IP address, and the maximum content length is 2^16=65476 bytes.

IPV6: The head consists of a 40-byte fixed length. 128-bit record source-side IP address, 128-bit record destination IP address.

ARP protocol: Address Resolution Protocol, a protocol designed to map a 32-bit IP address to a 48-bit MAC address of a network card that resolves a physical address (MAC address) from the IP address of a packet packet. )。

RARP protocol: Primarily used to convert a 48-bit MAC address of a network card to a 32-bit IP address.

ICMP protocol: Internet Control message Protocol (Internet Controlled Information Protocol), an exception notification needs to be sent to the sending side when an exception occurs during the transmission of an IP packet that fails to reach the destination address. ICMP is designed for this function.

4, Link layer: used to deal with the hardware part of the network, including control of the operating system, hardware device drivers and network adapters, and optical fiber and other physical visible parts. The category of hardware is within the scope of the link layer.

The lowest level of TCP/IP software is responsible for receiving IP datagrams and sending them over the network, or receiving physical frames from the network, extracting IP datagrams and handing them over to the IP layer.

This level adds an Ethernet protocol header to the data to be transmitted and is CRC-encoded to prepare for the final data transfer. Then down is the level of hardware, responsible for the transmission of the network, the definition of this level includes the cable format, network card definition and so on (these we do not care, we do not do network cards), so some books do not put this level in the TCP/IP protocol family, because it almost and tcp/ The creator of the IP protocol does not have any relationship.

The host sending the protocol encapsulates the data from top to bottom, while the host receiving the data is untied from the received packet and finally gets the required data. This structure is very stack-flavored, so some articles also refer to the TCP/IP protocol family as the TCP/IP protocol stack.

Popular Understanding:

TCP/UDP is a transport-layer-oriented protocol, HTTP is an application-level protocol that TCP and UDP use to transfer packets from one network to another. Think of IP as a highway that allows other protocols to travel and find the exits of other computers.  TCP and UDP are "trucks" on highways, and the goods they carry are protocols such as HTTP, File Transfer Protocol FTP, and so on. You should be able to understand that TCP and UDP are the transport layer protocols used by FTP,HTTP and SMTP. Although both TCP and UDP are used to transmit other protocols, they have a significant difference: TCP provides guaranteed data transfer, and UDP does not. This means that TCP has a special mechanism to ensure that data is safe from one endpoint to another without error, and UDP does not provide any such assurance.  In addition, TCP is connection-oriented, can be analogous to the call, UDP is non-connected, can be likened to texting.  TCP/IP protocol is the Transport Layer protocol, which mainly solves how data is transmitted in the network, and HTTP is the application layer protocol, which mainly solves how to wrap the data. HTTP (Hypertext Transfer Protocol): A protocol that leverages TCP to transfer information between two computers, typically Web servers and clients. The client initiates an HTTP request to the Web server using a Web browser, and the Web server sends the requested information to the client. First, it is a protocol and is an application-layer protocol based on the TCP/IP protocol. The HTTP protocol details the rules for communication between the browser and the server, and is the basis for the World Wide Web exchange of information. HTTP is based on the request-response form and is a short connection, and is a stateless protocol.  For its stateless characteristics, in the actual application needs to have the form of the state, so generally through the Session/cookie technology to solve this problem. Socket:socket is not a protocol category, but a calling interface (API), socket is the encapsulation of the TCP/IP protocol, by calling the socket, the TCP/IP protocol can be used. The socket connection is a long connection, in theory the client and server side will not actively disconnect this connection once the connection is established. The socket connection is a request-response form, and the server can proactively push messages to the client. Second, the HTTP protocol as an example of work flow

The protocols closely related to it are Ip/tcp/dns

After the DNS resolves the hostname to the IP address, IP resolves to the destination host after ARP parsing, and TCP establishes the connection with the destination host by three handshake.

After connecting, if one side wants to actively cancel the connection, TCP cancels the connection with the active host by four waves.
1, the TCP connection established three handshake process:

(Prerequisite: A active open, B passive open.) Client is represented by a, server side is represented by B)

    1. The client sends a request "open the door now, I want to come in" to the server;
    2. The server sends a "come in, I'll open the door for you" to the client;
    3. The client has very polite to send a "Thank you, I want to come in" to the server.

2. Four wave-waving process released by TCP connection

(Prerequisite: A active off, b passive off.) Client is represented by a, server side is represented by B)

  

    1. The client sends a "time is not early, I want to go" to the server, wait for the server to get up to send him;
    2. Server heard, send a "I know, then I send you out" to the client, and other clients go;
    3. After the server shut the door, send a "I shut down" to the client, and then wait for the client to go (like a sentimental AH);
    4. The client sends a "I know, I'm Gone" and then I'm gone.
Iii. when visiting a webpage, the functions of all protocols are as follows:

Four. In-depth understanding of TCP/IP

Simple understanding of TCP/IP protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.