Linux-ip the meaning of the header and the fields of the datagram

Source: Internet
Author: User

Format of IP datagram:

The first ministerial and data lengths of an IP datagram are variable-length, but are always 4-byte integer multiples.
For IPV4, the 4-bit version field is 4.
  

(1) version is 4 bits, which refers to the version of IP protocol. The IP protocol versions used by both sides of the communication must be consistent. Currently widely used IP protocol versionsthe number is 4 (that is, IPv4). With regard to IPV6, it is still in the draft stage. (2) The first ministerial degree is 4, the maximum decimal value that can be expressed is 15. Note that the unit of the number represented by this field is 32-bit word length(a 32-bit word length is 4 bytes), so when the IP header length is 1111 (that is, the decimal 15), the header length reaches 60 wordssection. When the header length of an IP packet is not an integer multiple of 4 bytes, it must be populated with the last fill field. So the data section is alwaysstarting with an integer multiple of 4 bytes, which makes it easier to implement an IP protocol. The disadvantage of a header length limit of 60 bytes is sometimes not enough. However, this is done in the hope that users will minimize overhead. The most commonly used header length is 20 bytes (that is, the header length is 0101) and does not useany options. (3) Differentiated services accounted for 8, for better service. This field is called the service type in the old standard, but it has not actually beenmakeused before. 1998 the IETF renamed this field to differentiate Service DS (differentiated Services). Only when using differentiated serviceswhen theThis field does not work. (4) total length length refers to the length of the header and the sum of the data, in bytes. The total Length field is 16 bits, so the maximum length of the datagramto be2^16-1=65535 bytes. each data link layer below the IP layer has its own frame format, which includes the maximum length of the data field in the frame format, which is called the mostBigTransmission Unit MTU (Maximum Transfer unit). When a datagram is encapsulated into a link-layer frame, the total length of this datagram (that is,Firstpart) must not exceed the MTU value of the data link layer below. (5) The mark (identification) occupies 16 bits. The IP software maintains a counter in memory, each generating a datagram, a counterjustAdd 1 and assign this value to the identity field. But this "id" is not a serial number, because IP is a no-connect service, the datagram does not exist in orderto askquestions. When a datagram must be fragmented because it is longer than the MTU of the network, the value of this identity field is copied to all datagramsthe identity wordsegment. The same value of the identity field causes the fragmented datagram to be correctly re-installed as the original datagram.   (6) flag (flag) accounted for 3, but at present only 2 bits are meaningful. the lowest bit in the Flag field is recorded as MF (more Fragment). Mf=1 is a datagram that says "There are shards" later. mf=0 Tableshownitis already the last of several datagrams. The one in the middle of the flag field is recorded as DF (Don ' t Fragment), meaning "cannot shard." Shards are allowed only when df=0. (7) chip offset is 13 bits. The slice offset indicates the relative position of a piece in the original group after a long grouping in the Shard. In other words, phasetheThe starting point of the user data field from where the slice starts. The slice offset is offset in 8 bytes. This means that except for the last pointpieces, each ofthe length of the slice must be an integer multiple of 8 bytes (64 bits). (8) Survival time accounted for 8 bits, the time-to-live field used in the English abbreviation is TTL (Times to Live), indicating that the datagram is in the networkThe Longevitylife. This field is set by the source point at which the datagram is emitted. The aim is to prevent the inability to deliver datagrams in the Internet without restrictions,thus WhiteWhite consumes network resources. The original design was in seconds as the TTL unit. The TTL is subtracted from the datagram every time a router is passedon the router to eliminateconsumed for some time. If the datagram consumes less than 1 seconds on the router, the TTL value is reduced by 1. When the TTL value is 0 o'clock,just drop the datagram.. The function of the TTL field was later changed to "Hop Limit" (but the name does not change). Before forwarding datagrams, the routerreduce the TTL value by 1. If the TTL value is reducedless than zero, discard this datagram and no longer forward. Therefore, the unit of TTL now is no longer a second, but a jumpnumber. The meaning of TTL is to indicate that the datagramthe maximum number of routers that can pass through the network. Obviously, the data reported on the network over the router'sThe maximum value is 255. If the initial value of the TTLset to 1, it means that the datagram can only be transmitted on this local area network. (9) the protocol is 8 bits, and the Protocol field indicates what protocol is used for the data that this datagram is carrying, so that the IP layer of the destination host knows how manyaccording to Departmentwhich process to give to the division. (10) The first Test and 16. This field only examines the header of the datagram, but does not include the data section. This is because the data is reported everya roadThe router has to recalculate the first Test and (some fields, such as time-to-live, flag, slice-offset, and so on, can vary). DisorderlyThe data section reduces the amount of work to be calculated. (11) The source address occupies 32 bits. (12) The destination address occupies 32 bits.

Linux-ip the meaning of the header and the fields of the datagram

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.