Detailed explanation of the five-layer protocol of the network

青灯夜游
Release: 2019-11-29 16:54:33
forward
5298 people have browsed it

Detailed explanation of the five-layer protocol of the network

1. Application layer

Tasks: Provide for operating system or network applications Access the interface of network services and complete specific network applications through interaction between application processes. The application layer defines the rules for communication and interaction between application processes

Common protocols:HTTP, SMTP, FTP, ping, telnet, DNS, DHCP, etc.

HTTP protocol (Hypertext Transfer Protocol)

Main features:

●Support client/server mode

●Simple and fast: Client When requesting services from the server, you only need to transmit the request method and path; commonly used request methods are GET, HEAD, POST, etc., each method stipulates different types of contact between the client and the server; the HTTP protocol is simple, the server program is small in size, and the communication speed is fast

● Flexible: HTTP allows the transmission of any type of data object; the data type being transmitted is marked by Content-Type

● Connectionless: Connectionless means that only one request is processed per connection ;After the server processes the client request and receives the client response, it disconnects and saves transmission time

●Stateless: Stateless means that the protocol has no memory capacity for transaction processing; the response is faster, but the transmission The amount of data is large

HTTP URL: Locate network resources

● http://host[:port][abs_path]

HTTP request

● Composed of three parts: request line, message header, request body

●Format: Method Request-URI HTTP-Version CRLF

●Method: Request method, GET, POST, etc.

●Request-URI: Requested HTTP protocol version

●CRLF: Carriage return and line feed

HTTP response

●It consists of three parts: status line, message header, response body

●Status line format: HTTP-Version Status-Code Reason-Phrase CRLF

●●HTTP-Version: Server HTTP protocol version

●Status-Code: Response status code returned by the server

HTTP status code

● Composed of three digits, the first digit defines the response category

1xx: Indication information, indicating that the request has been received and processing continues;

2xx: Success

3xx: Redirect, further operations must be performed to complete the request;

●4xx: Client error, the request has a syntax error or the request cannot be implemented

●5xx: Server-side error: The server failed Implement legal requests

Common status codes

● 200: OK, the request is successful;

● 400: Bad Request, the request has a syntax error, Cannot be understood by the server;

●401: Unauthorized, the request is unauthorized;

●403: Forbidden, the server received the request but refused to provide the service;

● 404: Not Found, the requested resource does not exist;

● 500: Internet Server Error, an unexpected error occurred in the server;

● 503: Server Unavailable, the server cannot handle the customer request

2. Transport layer

Task: Responsible for providing common data services for communication between processes in two hosts (for Applications on two hosts provide end-to-end communication)

Mainly uses the following two protocols:

Transmission Control Protocol TCP : Provides connection-oriented, reliable, Stream-based data transmission service, the unit of data transmission is a message segment. Use timeout retransmission, data confirmation, etc. to ensure that data is sent correctly to the destination

User Datagram Protocol UDP: Provides connectionless, unreliable, datagram-based data transmission Service; the unit of data transmission is user datagram

3. Network layer

Task: is responsible for data packets Perform routing and store-and-forward

● Responsible for providing communication services to different hosts on the packet-switched network. When sending data, the network layer encapsulates the message segments and user datagrams generated by the transport layer into packets (IP datagrams) or packets for transmission.

●IP protocol: hop-by-hop sending mode; determine how to send the data based on the destination IP address of the data packet; if the data packet cannot be sent directly to the destination, the IP protocol is responsible for finding a suitable next-hop router. And deliver the data packet to the router for forwarding

● ICMP protocol: Internet Control Message Protocol, used to detect network connections

4. Data link layer

Task: Responsible for allocating MAC addresses

●When data is transmitted between two adjacent nodes, the data link layer hands over the network layer IP datagrams are assembled into frames and transmitted over two adjacent links. Each frame includes data and necessary control information.

● The network driver of the network card interface handles the transmission of data on physical media; different physical networks have electrical characteristics, and the network driver hides implementation details and provides a consistent interface for upper-layer protocols

● Commonly used protocols: Address Resolution Protocol (ARP) and Reverse Address Resolution Protocol (RARP) to achieve conversion between IP address and machine physical address (MAC address)

##5 .Physical layer

The unit of data transmitted by the physical layer is bit. The physical layer needs to consider what voltage is used to represent a 1 or a 0, and how the receiver recognizes the bits sent by the sender.

6. Working equipment corresponding to each layer

 ●Physical layer: repeater, hub

●Data link Road layer: bridge or switch

● Network layer relay system: router

● Relay system above the network layer: gateway

The above is the detailed content of Detailed explanation of the five-layer protocol of the network. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template