IIlustration of the IPv4 Header
version: the version of ip service, For IPv4, its value is 4, for IPV6, its value is 6.
header length: the length of ip header, the maximum value is 60 because of using 4 bits representing the length. Generally, its value is 20.
type of service: the 8 bits are divided into 3 parts. the first part using 3 bits has been discarded, the second part uses 4 bits, each bit denotes a functionality.
the first bit tells ip module using strategy of minimum delay; the second bit tells ip module using strategy of maxmum throughput; the third bit tells ip module
using strategy of maxmum reliability and the fourth bit tells ip module using strategy of minimum cost. The four bits can be only one bit set to 1 at a time.
The last bit of type of service is reserved, not using.
total length: the length of IP datagram including length of ip header and length of data.
identification: It is unique to identify a datagram. Its value is produced randomly. Its value is automatically added by 1 after sending a datagram and would be copied
to each fragmentation, therefore all of fragmentations have the same identification.
flags: It indicates if there are fragmentations. the first bit is reserved. The second bit denotes "Don't Fragment", if this flag is set, ip module would not fragment datagram.
In this situation, if the length of datagram is greater than the MTU, ip module would abandon this datagram and return an ICMP error datagram. The third bit denotes "More Fragment".
Other fragmentation must set this bit to 1 except the last fragmentaion in the same group.
fragmentaion offset: It indicates the data offset, not including header, of a fragmentation relativing to the original datagram. The actual value using by ip module is the value left
shifting 3 bits, which means the length of each fragmentation must be multiples of 8 except the last fragmentation in the same group.
time to live: it denotes the maxmum passed steps of the datagram from source to destination, the value is generally set to 64. the value would be subtracted by 1 while the datagram
passed a router. while the value is 0, router would abandon datagram and reuturn an ICMP error datagram. This value can avoid data falling into the trap of Routing Loops.
protocol: It can be used to distinguish the protocol of upper layer, TCP, UDP, ICMP and so on.
header checksum: It is filled by sender and used by receiver to check if the header of ip datagram is entire and valid.
source IP address: It denotes the IP address of sender.
destination IP address: It denotes the IP address of receiver.
options: They are not used often and here we will not illustrate them.
推荐阅读
-
详解@Vue/Cli 3 Invalid Host header 错误解决办法
-
在vue中获取token,并将token写进header的方法
-
详解WordPress开发中get_header()获取头部函数的用法
-
ipv4的ip字符串转化为int型
-
Bootstrap页面标题Page Header的实现方法
-
Win7本地连接IPV4无访问权限的解决方法
-
PHP curl伪造IP地址和header信息代码实例
-
为PHP安装imagick时出现Cannot locate header file MagickWand.h错误的解决方法
-
PHP 使用header函数设置HTTP头的示例解析 表头
-
转换为标准IPv4格式