This is the Header Format of the IP packet. corresponding to the information in the figure, we can calculate that the total length of each row is 32bit.
When viewing TCP/IP protocol Volume 1, the length of the IP header is 4 bits, and the maximum length of the header is 60 bytes?
After reading this article for a long time, I couldn't think of it. So I googled it and got this article. please correct me if you have any mistakes. Thank you !!!!
Internet Header
Length refers to the Length of the Internet header. We can see the first six behavior headers from the IP package. If Option and Padding are not set, there are only five behavior headers.
The length of each row is 32 bits, that is, 4 bytes. In this case, the number of rows is 5*4 bytes = 20 bytes, so the minimum size of the IP packet is 20 bytes ).
IHL: 4 bits
Internet Header Length is the length of the internet header
In32 bit words, and thus points to the beginning of the data. Note that
Minimum value
ForA correct header is 5.
Because IHL occupies 4 digits, the maximum decimal value that 4 bits can represent is 15. Note that the unit of the number indicated by this field is 32 characters long (the length of one 32-bit character is 4 bytes). Therefore, when the IP header length is 1111 (that is, 15 in decimal format), the header length is 15*32 bit/8 = 60 bytes. When the length of the IP Group header is not an integer multiple of 4 bytes, the last filling field must be used. Therefore, the data always starts at an integer multiple of 4 bytes, which makes it easier to implement the IP protocol. The disadvantage of the header length limit of 60 bytes is that it may not be enough. However, we hope that the user can minimize the overhead. The most common header length is 20 bytes (that is, the header length is 0101), and no option is used.
PS: What you need to know is that the IHL of the IP Address Header occupies four digits, which indicates the Length of the IP Address Header (Internet Header Length). The minimum value is 5 rows and 20 bytes; the maximum value is 4-bit. The maximum value is 1111, And the decimal value is 15. You can also consider it as 15 rows. The value is 15*32-bit/8 = 60 bytes. Internet Header Length only stores one value (number. Just like a bottle of wine, your friend asks you how much you can drink. You say you can have at least two drinks and at most one bottle.
Refer:
Http://baike.baidu.com/view/1519445.htm
Http://en.wikipedia.org/wiki/IPv4
Http://tools.ietf.org/html/rfc791
Http://dns-learning.twnic.net.tw/internet/intro6.html