TCP/IP protocol family

Source: Internet
Author: User

The TCP/IP network protocol stack is divided into the application layer (application), the Transport Layer (TRANSPORT), the network layer (networks) and the link layer (link) four layer.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/87/6B/wKioL1ffj3vS8PPqAAB-IAnczrw075.png "title=" capture. PNG "alt=" Wkiol1ffj3vs8ppqaab-ianczrw075.png "/>


650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/6E/wKiom1ffjXKxf7ITAABvVRFE9pI813.png "title=" TCP Ip.png "alt=" Wkiom1ffjxkxf7itaabvvrfe9pi813.png "/>


1. Data Link Layer

Implements the network driver for the NIC interface.

Protocol: ARP protocol and RARP protocol

ARP protocol: Target machine IP address-(ARP protocol) → Target machine mac address → Target machine

RARP protocol: (diskless workstation) MAC address-(RARP protocol) →IP address



2. Network layer

implement Routing and forwarding of packets. Responsible for the transfer of point-to-point (the "point": Host or router). Network layer to the upper level of the Protocol hides the network topology connection details, in the transport layer and the application layer appears to be directly connected to the communication.

Protocol: IP protocol, ICMP protocol.

The IP protocol determines how it is delivered based on the destination IP address of the packet. If the packet cannot be sent directly to the destination host, then the IP protocol finds the appropriate next-hop router for it and delivers the packet to the router for forwarding. The IP protocol uses a hop-by-step approach to determine the communication path.

The ICMP protocol is an important complement to the IP protocol for detecting network connections.



3. Transport Layer

The transport layer provides end to end communication for applications on two hosts. The transport layer only cares about the origin and destination of the communication, and does not care about the transit process of the packet.

Protocol: TCP protocol, UDP protocol, SCTP protocol

TCP protocol


Provide reliable, connection-oriented and stream-based services for the application layer;

The TCP protocol uses time-out retransmission, data determination, and so on to confirm that the datagram is correctly sent to the destination. Both parties that use TCP protocol communication must first establish a TCP connection and maintain some necessary data structures in the kernel for that connection. At the end of the communication, both parties must close the connection to release the kernel data. The TCP protocol is stream-based and the data has no bounds (length) restrictions. The sending side can write data to the data stream byte by bit, and the receiving side can read it out byte by bit

UDP protocol


Provides unreliable, non-connected, datagram-based services for the application tier.

The UPD protocol does not guarantee that the data will be properly transmitted to the destination from the sending side. applications that use the UDP protocol often have to handle the logic of data validation, time-out retransmission, and so on. The UDP protocol is not connected, so each time the application sends the data, it must explicitly specify the address (IP address, etc.) of the receiving end. Each UPD datagram has a length, and the receiving end must read all of its contents at one time in the smallest unit of that length, otherwise the data will be truncated.


TCP is a connection-oriented, open protocol, a bit like a phone call, the two sides picked up the phone to connect the identity after the establishment of the connection, and then talk on the line, this side of the word to ensure that the hearing, and is in accordance with the order of speech heard, said after the words hanging machine disconnected. That is to say, the two sides of the TCP transport need to establish a connection, then the TCP protocol to ensure the reliability of data transmission, the loss of packets automatically re-send, the upper-level applications receive always reliable data flow, communication and close the connection.

UDP protocol is not connection-oriented, nor guarantee reliability, a bit like a letter, write a letter put into a mailbox, neither can guarantee that the letter will not be lost in the post process, and can not guarantee that the letter is sent to the destination in order. Applications that use the UDP protocol need to do their own job of losing BAOZHONGFA, sorting messages, and so on.


The SCTP protocol is designed to transmit telephone signals over the Internet.



4. Application Layer

The logic responsible for handling the application

The Application layer protocol (or program) may skip the transport layer directly using the services provided by the network layer, such as the ping program and the OSPF protocol.

Application-layer protocols (or programs) typically use both TCP services and UDP services, such as DNS protocols.



Encapsulation of TCP/IP packets

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/71/wKiom1ffoZPDV56MAACqh9tPGi8898.png "title=" TCP IP packet encapsulation. png "alt=" Wkiom1ffozpdv56maacqh9tpgi8898.png "/>



650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/76/wKiom1ffogHjWKfbAAA6Ijs90tk555.png "title=" Ethernet frame encapsulation. png "alt=" Wkiom1ffoghjwkfbaaa6ijs90tk555.png "/>

An Ethernet frame uses a 6-byte (48-bit) destination physical address and a 6-byte (48-bit) source Physical address (MAC address) to represent both sides of the communication.

The Protocol type field has three values, corresponding to IP, ARP, RAPP.

The data length of the Ethernet frame specifies a minimum of 46 bytes, a maximum of 1500 bytes, and the length of the ARP and RARP packets is not 46 bytes, to be replenished later. The maximum value of 1500 is called the Ethernet Maximum Transmission Unit (MTU), different network types have different MTU, if a packet from the Ethernet route to the Dial link, the length of the packet is greater than the MTU of the Dial link, the packet will need to be fragmented (fragment) transmission.

The 4-byte CRC field at the end of the frame provides cyclic redundancy checks for other parts of the frame.


A frame is the sequence of bytes that is ultimately transmitted over the network.



TCP/IP packets cross-router communication process

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/7B/wKiom1ffomiDngwyAACin_dyGfA073.png "title=" Cross-router communication process. png "alt=" Wkiom1ffomidngwyaacin_dygfa073.png "/>

The Data Link layer (driver) encapsulates the electrical details of the physical network;

The network layer encapsulates the details of the network connection;

The transport layer encapsulates an end-to-end logical communication link for the application, which is responsible for the data receiving and sending, the link time-out and the re-connection.



Divided by

When the frame arrives at the destination host, it is passed down the protocol stack from the bottom up. Each layer protocol processes the header data in the frame, in turn, to obtain the required information and to give the processed frame to the destination application. This process is called splitting (demultiplexing).

The separation is based on the Type field in the header information.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/87/B0/wKiom1ffqLPAfqG-AAE-PkALexU118.png "title=" The split process. png "alt=" Wkiom1ffqlpafqg-aae-pkalexu118.png "/>


Compiled from "Linux High Performance Server Programming" Chapter 1th, "Linux C one-stop learning" chapter 36th


This article is from the "zgw285763054" blog, make sure to keep this source http://zgw285763054.blog.51cto.com/11591804/1854152

TCP/IP protocol family

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.