In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
The TCP/IP network protocol stack is divided into four layers: application layer (Application), transport layer (Transport), network layer (Network) and link layer (Link).
1. Data link layer
The network driver of the network card interface is realized.
Protocols: 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
two。 Network layer
Realize the routing and forwarding of data packets. Responsible for point-to-point (point to point) transmission ("point": host or router). The network layer hides the details of the network topology connection to the upper layer protocol. In the transport layer and the application layer, the two sides of the communication are directly connected.
Protocol: IP protocol, ICMP protocol.
The IP protocol determines how to deliver a packet based on its destination IP address. If the packet cannot be sent directly to the destination host, the IP protocol finds a suitable next-hop router for it and delivers the packet to that router for forwarding. The IP protocol determines the communication path on a hop-by-hop basis.
ICMP protocol is an important supplement to IP protocol, which is used to detect network connections.
3. Transport layer
The transport layer provides end-to-end (end to end) communication for applications on two hosts. The transport layer is only concerned with the beginning and destination of the communication, and does not care about the transit process of the packet.
Protocols: TCP protocol, UDP protocol, SCTP protocol
TCP protocol
Provide reliable, connection-oriented and stream-based services for the application layer
TCP protocol uses timeout retransmission, data determination and other methods to confirm that datagrams are correctly sent to the destination. Both parties using TCP protocol to communicate must first establish a TCP connection and maintain some necessary data structures for the connection in the kernel. 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 boundary (length) restrictions. The sender can write data to the data stream byte by byte, and the receiver can read it byte by byte.
UDP protocol
Provide unreliable, connectionless, Datagram-based services for the application layer.
The UPD protocol cannot guarantee the correct transmission of data from the sender to the destination. Applications that use the UDP protocol usually handle logic such as data validation, timeout retransmission, and so on. The UDP protocol is connectionless, so every time the application sends data, it clearly specifies the address of the receiver (information such as IP address). Each UPD Datagram has a length, and the receiver must read out all its contents at once in the smallest unit of length, otherwise the data will be truncated.
TCP is a connection-oriented, open protocol, which is a bit like making a phone call. After the two parties pick up the phone and communicate with each other, they establish a connection and then talk to each other. This side of the conversation is guaranteed to be heard, and it is heard in the order in which they speak, and then hang up and disconnect. In other words, the two sides of TCP transmission need to establish a connection first, then the TCP protocol ensures the reliability of data sending and receiving, the lost packets are automatically retransmitted, and the upper applications always receive reliable data streams, and then close the connection after communication.
The UDP protocol is not connection-oriented, nor does it guarantee reliability. It is a bit like sending a letter. When you write a letter and put it in the mailbox, there is no guarantee that the letter will not be lost in the mail, nor can it guarantee that the letter will be sent to its destination in order. Applications that use the UDP protocol need to do packet loss retransmission, message sorting and so on.
The SCTP protocol is designed to transmit telephone signals over the Internet.
4. Application layer
Responsible for handling the logic of the application
Application layer protocols (or programs) may skip the transport layer and directly use services provided by the network layer, such as ping programs and OSPF protocols.
Application layer protocols (or programs) can usually use both TCP services and UDP services, such as the DNS protocol.
Encapsulation of TCP/IP packet
Ethernet frames use 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, and RAPP.
The data length of Ethernet frame specifies a minimum of 46 bytes and a maximum of 1500 bytes. The length of ARP and RARP packets is less than 46 bytes, which should be filled in later. The maximum value of 1500 is called Ethernet maximum Transmission Unit (MTU). Different network types have different MTU. If a packet is routed from Ethernet to the dial-up link and the length of the packet is longer than the MTU of the dial-up link, the packet needs to be fragment transmitted.
The 4-byte CRC field at the end of the frame provides a cyclic redundancy check for the rest of the frame.
The frame is the sequence of bytes that is finally transmitted over the network.
TCP/IP packet communication process across routers
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 data sending and receiving, time-out reconnection of the link and so on.
Separate use
When the frame reaches the destination host, it is passed from the bottom up along the protocol stack. Each layer protocol in turn processes the header data responsible for this layer in the frame to obtain the required information, and gives the processed frame to the destination application. This process is called demultiplexing.
The division is achieved by relying on the type field in the header information.
Compiled from "Linux High performance Server programming" Chapter 1, "Linux C one-stop Learning" Chapter 36
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.