HTTP TCP UDP ICMP IP ARP protocol detailed (10.15 day twenty-one)

ARP protocol

ARP (Address Resolution Protocol) protocol ARP

The network layer IP address in the data link layer translated into 48-bit addressing hardware address (MAC address)

In the OSI model link layer belonging ARP protocol; in the TCP / IP model, ARP protocol belongs to network layer.

 

IP protocol

 

 

 

Field Meaning fixed part of the IP packet header in

( 1) version. Accounted for four, the value of the IP protocol version. IP communications protocol version used by both sides must be consistent. The current version number is 4 (IPv4)

( 2) the header length. Accounting for 4, the unit is 4 bytes, header length default is 20 bytes, so the 0101 figures filled

( 3) Differentiated Services. Accounting for 8, to get better service, but in fact the basic never used

( 4) the total length. It accounted for 16, and refers to the header and data length in bytes. Length is 16, the maximum length of the packet (16 th -12), but due to the data link layer protocol be no more than the maximum transmission unit MTU is 1500 bytes

( 5) identification. Accounted for 16, when the IP packet length exceeds the MTU, when fragmentation, use the same identifier in each packet fragment, the receiver for packet reassembly

( 6) mark. Accounting for three, only the first two meaningful

Lowest position MF (More Fragment), when the MF = 1 which indicates there fragment

Intermediate position DF (Do not Fragment), meaning not fragment when DF = 0 if fragmentation is allowed

( 8) survival time. 8 bits, the initials TTL (Time To Live), indicates that the packet in the network lifetime. The purpose is to prevent unlimited data package can not reach the destination on the Internet circles, consume a lot of network resources. Set a certain initial value, each through a router decremented, TTL = 0, the router discards the packet

( 9) protocol. Accounting for eight points out packets which protocol is used

( 10) and header checksum. Accounted for 16, each packet through a router, must recalculate the checksum header, whether a change through a series of operations, the packet header is determined, if a change occurs to the router discards the packet.

( 11) the source IP address. Accounting for 32

( 12) the destination IP address, representing 32

 

 

 

ICMP protocol

ICMP (Internet Control Message Protocol) Internet control message protocol

For passing control messages between IP host, router. Refers to the network control messages through the operation fails, the host is reachable, a message such as whether the available route network itself. Most network maintenance techniques and tools are based on ICMP (ie ping)

Simply put, ICMP commonly used to find a network failure

 

 

 

The two main transport layer protocol:

( 1) transport control protocol TCP (Transmission Control Protocol)

( 2) User Datagram Protocol UDP (User Datagram Protocol)

the difference:

( 1) TCP provides connection-oriented services. File section, the session must be established before data transfer, flow control, to ensure reliable transmission

( 2) does not need to establish a transport connection between the UDP does not provide reliable delivery, simple point that is sent out on the matter. It can be done for a packet communication, or is not necessary to apply a retransmitted packet loss.

 

 

Transmission Control Protocol TCP (Transmission Control Protocol)

Is a transport protocol to provide reliable end to end on a byte stream unreliable network specifically designed

 

Packet Structure:

( 1) source and destination ports. Occupies 2 bytes

( 2) NO. It occupies 4 bytes, number range (0,2 ^ 32 -1), after reaching the maximum number back to zero. Byte stream transmitted in a TCP connection in each byte sequentially numbered. Starting serial number must be provided in the connection time. A sequence number field in the header byte sequence number refers to the first segment transmitted with this data. For example, the sequence number field value of a segment is 301, carrying a total of 100 bytes of data. Indicates that the first byte is a sequence number 301, 400 is the last byte sequence number, the packet period from the start 401

( 3) acknowledgment number. It occupies 4 bytes, it is desirable first interface receives a data byte sequence number of the next segment.

( 4) data offset. Accounting for 4, when the 4-byte units, recording how many bits of the TCP packet data portion begins

( 5) retention. Accounting for 6, there is no use

( 6) Emergency URG. When URG = 1, indicates that the urgent pointer valid. This message tells the system has urgent data to be transmitted as soon as possible, and the data packet is inserted into the front of the newspaper segment data, such as ctrl + c

( 7) acknowledgment ACK. TCP provides connection is established after the transfer of all segments must set the ACK bit 1

( 8) pushed PSH. Send as soon as possible

( 9) reset RST. When RST = 1, Biaoming TCP connection is a serious error (due to the host crash or other reasons), it must release the connection, re-establish a connection

( 10) synchronized SYN. By using a TCP connection is established.

( 11) termination FIN. To release a TCP connection.

( 12) window. 2 bytes, window value is (0,2 ^ 16 -1), indicating the amount of data transmitted from the other party is now allowed, but dynamic changes.

( 13) a checksum.

( 14) the urgent pointer. 2 bytes, is valid only when the URG 1 = indicates the number of bytes of urgent data segment of the newspaper.

( 15) option. Variable length up to 40 bytes

 

 

 

 

TCP connection is established - the three-way handshake

SYN / ACK acknowledgment identification number ack seq ID No.

 

 

 

TCP connection release - Fourth Wave

 

 

 

 

:( HTTP protocol No. hills Reprinted from public security attack and defense laboratories https://mp.weixin.qq.com/s/YhYIVuDDmAMgKSduin5OHQ )

Introduction to the HTTP protocol

HTTP (Hyper Text Transfer Protocol) communication protocol is a client / server model on the application layer, which consists of requests and responses, and is stateless. (Temporarily introduce HTTP2)

  • protocol

Protocol specifies communication parties must follow the format of data transmission, such communication and accurate communication to the parties in accordance with the agreed format.

  • no status

Stateless means is no relationship between the two communication connections, every time a new connection, the server does not request information before and after recording.

  • The client / server model

 

 

 

Five-layer network model

 

 

 

URL constitution

With for so long, you noticed it?

 

 

 

Agreement

Request ( the Request)

The client sends a HTTP request to the server in the format:

  • Request line
  • Request header
  • Request body

 

 

 

Response ( the Response)

The server responds to the client format:

  • State line
  • Response header
  • Response Body

 

 

 

status code

HTTP status code of three decimal digits, the first decimal digit status code defines the type, the two figures are not classified effect. HTTP status code is divided into five types:

 

 

 

More detailed status code to view the HTTP status code

But generally we only need to know a few common on the line, such as 200,400,401,403,404,500,502.

Request method

As HTTP1.1 There are several methods below:

 

 

 

Request and response common universal head

 

 

note

Content-Type, Content-Type, Content-Type generally refers to pages that exist for the type of coding and web definitions network files, the browser will decide what form, what code reading this document.

Common media format types are as follows:

 

 

 

At the beginning of the application media type format:

 

 

 

Common request headers

 

 

 

Common response headers

 

 

 

to sum up

This former FBI back-end interface to the most obvious , when you're in an application to request additional interfaces or forwarding these requests is to know. Otherwise, the probability of problems will be greatly enhanced.

Guess you like

Origin www.cnblogs.com/liujizhou/p/11680329.html