TCP/IP protocol ----- excellent notes, tcpip protocol -----

Source: Internet
Author: User

TCP/IP protocol ----- excellent notes, tcpip protocol -----
1. Introduction

The TCP/IP Protocol is not a single TCP Protocol or an IP Protocol. It is a group of protocols, including TCP and IP Protocol, UDP Protocol, and ICMP Protocol) protocol and other protocol groups (a set of protocols). When you call them, they are collectively referred to as TCP/IP.

2. overall architecture

The TCP/IP protocol does not fully comply with the OSI Layer-7 Reference Model. The traditional Open System Interconnection Reference Model is a layer-7 abstract reference model of communication protocols, where each layer executes a specific task. This model aims to make various hardware communicate with each other at the same level. These seven layers are: physical layer, data link layer, network layer, transmission layer, voice layer, presentation layer and application layer. The TCP/IP communication protocol uses a layer-4 hierarchy. Each layer calls the network provided by its next layer to meet its own needs. The four layers are:

Application Layer: layer for communications between applications, such as simple Email transmission (SMTP), file transfer protocol (FTP), and network remote access protocol (Telnet.

Transport Layer: In this layer, it provides data transmission services between nodes, such as transmission control protocol (TCP) and User Datagram Protocol (UDP, TCP and UDP add transmitted data to the data packet and transmit it to the next layer. This layer is responsible for transmitting data and confirming that the data has been delivered and received.

Interconnect Network Layer: provides basic data packet transmission functions so that each data packet can reach the target host (but does not check whether it is correctly received), such as Internet Protocol (IP ).

Network Interface Layer: manages the actual network media and defines how to transmit data using the actual network (such as Ethernet and Serial Line.

[Image Source: http://www.cnblogs.com/roverliang/p/5176456.html]

TCP/IP Communication Data Stream

Corresponding protocols

3. Protocol 3.1 and IP protocol in TCP/IP

IP address (Internet protocol), the IP address here is not worthy of what we usually call 192.168.1.1, this IP address refers to a protocol,Is the heart of TCP/IP and the most important protocol in the network layer..

  IP layerReceives a packet from a lower layer (network interface layer, such as an Ethernet device driver) and sends the packet to a higher layer-TCP or UDP layer, the IP layer also sends packets received from the TCP or UDP layer to the lower layer. IP packets are unreliable because the IP does not do anything to confirm that the packets are sent in order or are not damaged.IP data packetsContains the address (source address) of the host that sent it and the address (Destination Address) of the host that received it ).

  IP protocolThe function is to pass all kinds of data packets to the other party accurately. The two important conditions are the IP Address and the MAC Address (Media Access Control Address ). Because the IP address is a rare resource, it is impossible for everyone to have an IP address. Therefore, the common IP address is the IP address generated by the router. the MAC address is recorded in the router. The MAC address is the only one in the world and cannot be repeated except for human factors. For example, in real life, the IP address is like the address of our residential area, and the MAC address is the person in the room in the building where we live. For MAC addresses, click Connect to view Baidu. The following content is excerpted from graphic HTTP

Use ARP to communicate with MAC addresses

The communication between IP addresses depends on the MAC address. On the network, there are very few communication parties in the same LAN. Generally, they can connect to each other only after multiple computers and network devices. During the transfer, the MAC address of the next transfer device is used to search for the next transfer target. Address Resolution Protocol is used ). ARP is a protocol used to parse an address. Based on the IP address of the Communication Party, the corresponding MAC address can be retrieved.

You can send a message to another computer. How can you find the other computer in the dark:

[Image Source: http://www.cnblogs.com/roverliang/p/5176456.html]

3.2. TCP protocol

If the IP protocol finds the detailed address of the other party. Therefore, the TCP protocol is to bring things securely to the other party. Each has its own division of labor and does not conflict with each other.

By layer, TCP is a transport layer that provides reliable byte stream service. What is byte stream service? This name sounds unknown. Let me explain it in plain words. The so-called byte stream is actually similar to information cutting. For example, if you are a bicycle seller, you have to deliver the goods. The installed bicycle is too large, unstable, and prone to damage. It is better to split the bicycle directly and paste the name of the consignee on each part. After delivery, the bicycles belonging to the same person are assembled. The process of dismantling, transportation, and assembly is actually the process of TCP byte stream.

Rigorous academic expression:

The Byte Stream Service (Byte Stream Service) refers to the management of data packets in segments to facilitate transmission. Reliable transmission means that data can be transmitted to the other party accurately and reliably. In a word, the TCP protocol separates data for easier transmission of big data, and the TCP protocol can confirm whether the data is finally sent to the other party.

[Upload]

If an IP packet contains a TCP packet that has been blocked, the IP will send them to the upper layer. TCP sorts packets and checks errors to connect virtual circuits. TCP packets include serial numbers and validation, so packets not received in order can be sorted, and damaged packets can be re-transmitted.

TCP sends its information to higher-level applications, such as Telnet service programs and customer programs.

[Downstream]

Applications send information back to the TCP layer in turn, and the TCP layer forwards them down to the IP layer, device drivers and physical media, and finally to the receiver.

[Illustration :]

To ensure that the information is accurate,TCP adopts the famous three-way handshake Policy(Three-way handshaking ):

[Image Source: http://www.cnblogs.com/roverliang/p/5176456.html]

The first handshake: the client sends the syn Packet (seq = x) to the server and enters the SYN_SEND status, waiting for confirmation from the server;

The second handshake: when the server receives the syn packet, it must confirm the customer's SYN (ack = x + 1) and send a SYN Packet (seq = y), that is, SYN + ACK packet, the server enters the SYN_RECV status;

The third handshake: the client receives the server's SYN + ACK package and sends the ACK (ack = y + 1) Confirmation package to the server. After the package is sent, the client and server enter the ESTABLISHED status, complete three handshakes.

The package transmitted during the handshake does not contain data. After the three-way handshake is completed, the client and the server formally start to transmit data. Ideally, once a TCP connection is established, the TCP connection will remain until either of the two parties closes the connection.

3.3. UDP protocol

UDP and TCP are on the same layer and are "non-connection oriented" protocols. That is, you do not need to establish a connection with the other party before formal communication, and send the connection directly regardless of the other Party's status. Similar to a text message: when you send a text message, you only need to enter the phone number of the recipient and it will be OK.

Therefore, UDP is not applied to connection-oriented services that use virtual circuits. UDP is mainly used for query-oriented services, such as NFS. Compared with FTP or Telnet, these services require less information to be exchanged. Services that use UDP include NTP (Network-Based Time Protocol) and DNS (DNS also uses TCP ).

Spoofing UDP packets is easier than spoofing TCP packets because UDP does not establish an initial connection (also known as a handshake) (because there is no virtual circuit between the two systems). That is to say, UDP-related services face greater risks.

3.4. DNS protocol

  DNS (Domain names System) is a service at the application layer like HTTP protocol, providing resolution services between Domain names and IP addresses.

The Internet communicates with each other through IP addresses, but the IP addresses do not conform to the recognition and memory habits. People like to remember meaningful words. So the DNS service is born to solve this problem. In fact, it is very understandable, like the host file on our computer.

192.168.95.11 test.com

When we access test.com, the computer will not go to the Internet server for query and directly access 192.168.95.11. This is a simple domain name hijacking, which is enough to explain the meaning of DNS.

4. webpage access Diagram

The following is the role of various protocols in accessing a webpage.

[Image Source: http://www.cnblogs.com/roverliang/p/5176456.html]

 

5. References

PS: It wasn't long before the cainiao got into touch with the TCP/IP protocol. When studying the TCP/IP protocol, I studied an article by Daniel roverliang and the blog articles of various great gods on the internet, taking the essence of each article as a note, this article is just a personal note and also for your reference.

 

(The above are some of your own opinions. If you have any shortcomings or errors, please point them out)

Author: The leaf with the wind http://www.cnblogs.com/phpstudy2015-6/

Address: http://www.cnblogs.com/phpstudy2015-6/p/6805759.html

Statement: only the points or conclusions I have summarized at a certain time in my work and study. When reprinting, please provide the original article link clearly on the Article Page

 

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.