Computer Network (xiii) IPv4 header and the IPv6 header format

1.IPv4 neck

When communicating by IP, the IP header information needs to be added in front of data.
IP header contains the necessary information for the IP protocol must control the contract.

IP packet format (IPv4)

a. version (Version)

4-bit configuration, the identifier indicating the version number of the IP header.
IPv4 is the version number 4, so the value is "4" in this field.
The version number of the IP header

b. header length (IHL)

Composed of four bits indicate the size of the IP header, in units of 4 bytes (32 bits).
For IP packets have no options, header length is set to "5." I.e., when there is no option, the length of the IP header is 20 bytes (4x5 = 20).

c. Differentiated Services (TOS)

It consists of 8 bits, to indicate the quality of service.
This value is often caused by application developed to achieve extremely complex control TOS, TOS lead to almost the entire Internet was not put into use.
The meaning of each type of service bits

d.DSCP segment with the ECN section

DSCP and ECN segment segment
DSCP (Differentiated Services Code Point) is part of the TOS. It is now referred to as DiffServ, for quality control.
If the bit is 3-5 0,0-2 category selection codes were called bit point. This can provide eight types of quality control level as priority as the TOS.
If the fifth bit is 1, it represents the mean experimental or local use.
ECN (Explicit Congestion Notification) is used to report a network congestion and consists of two bits.
ECT position 6 for notifying the upper layer protocols are TCP layer processing ECN.
When the router forwards the packet is ECN process 1, if the network congestion occurs, it will CE bit is set to 1
ECN field

e. the total length (Total Length)

IP represents the total number of bytes together with header data portion. This field is 16 bits long. Thus the maximum length of the IP packet is 65535 bytes.

f. identification (ID)

It consists of 16 bits, for fragment reassembly.
One and the same identification value of the slice, different values for different slice identification.
Typically, each transmit an IP packet, it increments the value gradually.
Even if the same ID, these if the destination address, source address or a different protocol, then, would be considered different slice.

g. flags (Flags)

Composed of 3 bits, the packet indicates fragmentation related information.
Meaning you mark segment

h. Fragment Offset (FO)

It consists of 13 bits, for identifying fragments of each segment relative to the original data.
The first fragment corresponding to the value 0.
Since the FO for a field 13, and thus it may represent up to 8192 relative positions.
Units of 8 bytes, the maximum raw data may represent the position of 8x8192 = 65536 bytes.

i. survival time (TTL)

Consists of 8 bits, it was originally meant as a unit recording period in seconds the current packet on the network should survive.
In practice, it refers to the number of transit routers can mean. Each through a router, TTL will be reduced by 1, until it becomes 0 discard the packet.

j. Protocol (Protocol)

Composed of 8 bits, it indicates a protocol in which the IP header portion of the header belongs.
IP protocol number
IP protocol number

k. header checksum (Header Checksum)

A 16-bit configuration, also known as the IP header checksum.
The header checksum field is only datagrams not check data part. Ensure that the IP datagram is not destroyed.
Checksum calculation process:
1. First of all the positions set to 0 and the checksum
2. 16 bits divided in units of IP header
3 and calculate all 16 bit words with 1's complement, and
4. The final the resulting sum is assigned to the complement of a header checksum field.

l. source address (Source Address)

Composed of 32 bits, the sender IP address indicates.

m. the target address (Destination Address)

Composed of 32 bits, it indicates the IP address of the receiving end.

n. Options (Options)

Variable length, usually only used when conducting experiments or diagnosis. The information field contains the following points:
1. security level
2 source path
3 path record
4. timestamps

o. padding (the Padding)

Also known as fillings. In the case of available options, the header length may not be an integer multiple of 32 bits. To this end, by filling the field to 0, adjusted to an integer multiple of 32 bits.

p. data (Data)

Stored data. The upper layer protocol IP header also as data processing.

2.IPv6 header format

IPv6 in order to reduce the burden on the router, a header is omitted checksum field, the checksum calculation is no longer required and routers, thus improving the efficiency of packet forwarding.
Slices used for processing the identification code becomes optional.
IPv6 headers and options constituted by 8 bytes.
IPv6 packet format

a. version (Version)

Like IPv4, is constituted by 4 bits. IPv6 its version number is 6, so a value of "6" in this field.

b. traffic class (Traffic Class)

Corresponds to the IPv4 TOS field, be composed of 8 bits.

c. flow label (Flow Label)

由20比特构成,准备用于服务质量控制(QoS)。
在进行服务质量控制时,将流标号设置为一个随机数;
然后利用一种可以设置流的协议RSVP在路由器上进行QoS设置。
流标号、源地址以及目标地址三项完全一致时,才被认为是一个流。

d.有效载荷长度(Payload Length)

有效载荷是指包的数据部分。
IPv4的TL是指包括首部在内的所有长度。然而IPv6中的这个Playload Length不包括首部,只表示数据部分的长度。
由于IPv6的可选项是指连接IPv6首部的数据,因此当 有可选项时,此处包含可选项数据的所有长度就是Playload Length。

e.下一个首部(Next Header)

相当于IPv4中的协议字段。由8比特构成。
通常表示IP的上一层协议是TCP或UDP。
在有IPv6扩展首部的情况下,该字段表示后面第一个扩展首部的协议类型。

f.跳数限制(Hop Limit)

由8比特构成。与 IPv4中的TTL意思相同。
数据每经过一次路由器就减1, 减到0则丢弃数据。

g.源地址(Source Address)

由128比特构成。表示发送端IP地址。

h.目标地址(Destination Address)

由128比特构成。表示接收端IP地址。

3.IPv6扩展首部

IPv6 header length is fixed and can not be an option added. Instead, the function has been effectively extended by extension header.
Typically between IPv6 extension headers and header TCP / UDP header portion intermediate.
IPv6 extension headers may be of any length.
Which header extension may further comprise extended protocol header and the next header extension field.
IPv6 header field and a flag is not identified, the IP data packets need to be fragmented, the extension header may be used.
IPv6 extension headers
When the need for IPv6 datagram is divided sheet, it may be provided as an extension field 44 (Fragemant Header).
When using the IPsec, can be used 50, 51 of the ESP, AH.
The case of Mobile IPv6 headers can be used with the destination address option 60 135 with the mobile.
IPv6 extension headers and a protocol number

Guess you like

Origin blog.csdn.net/NEUChords/article/details/91351005