In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
1. The format of IP Datagram
The header length and data length of IP datagrams are variable, but they are always integer multiples of 4 bytes.
(1) for IPv4, the 4-bit version field is 4.
(2) the value of the 4-bit header length is in 4 bytes, and the minimum value is 5, that is, the minimum header length is 4x5=20 bytes, that is, the IP header without any options, and the maximum value that 4 bits can represent is 15, that is, the maximum header length is 60 bytes.
(3) the 8-bit TOS field has 3 bits to specify the priority of the IP Datagram (currently obsolete), 4 bits to indicate the optional service type (minimum delay, maximum throughput, maximum reliability, minimum cost), and one bit that is always 0.
(4) the total length of 16 bits is the number of bytes of the entire Datagram, including the IP header and the IP layer payload.
(5) for each IP Datagram transmitted, the 16-bit identity is added by 1, which can be used for slicing and reassembling the Datagram.
(5) 3-bit mark and 13-bit offset are used for slicing.
(6) TTL (Time to live) is used like this: the source host sets a lifetime for the packet, such as 64, which is subtracted by 1 for each router. If it is reduced to 0, the packet is discarded if the route is too long to find the network of the destination host, so the unit of survival time is not seconds, but hop.
(7) the protocol field indicates whether the upper layer protocol is TCP, UDP, ICMP or IGMP.
(8) checksum, only the IP header is checked, and the higher-level protocol is responsible for the data verification.
(9) the length of the IP address of IPv4 is 32 bits.
II. Slicing
When the length of the IP Datagram to be sent exceeds the maximum transmission unit MTU, and fragmentation is allowed, IP fragmentation occurs.
The shard information field of an unsliced Datagram is all 0, that is, multiple fragment flag bits are 0, and the fragment offset is 0. To slice a Datagram, you need to perform the following steps:
1. Check the DF flag to see if slicing is allowed. If this bit is set, the Datagram is discarded and an ICMP error is returned to the source side.
two。 Based on the MTU value, the data field is divided into two or more parts. Except for the last data section, the length of all new data options must be a multiple of 8 bytes.
3. Each piece of data is put into an IP Datagram. The headers of these datagrams have slightly modified the original headers.
4. Except for the final Datagram shard, all shards have multiple fragment flag bits set.
5. The slice offset field in each shard is set to the position that this data part occupies in the original Datagram, relative to the beginning of the original unsliced Datagram.
6. If an option is included in the original Datagram, the high byte of the option type byte determines whether this information is copied to all fragmented datagrams or only to the first Datagram.
7. Set the header field and total length field of the new Datagram.
8. Recalculate the message header checksum field.
At this point, each Datagram in these fragmented datagrams is forwarded like a complete IP Datagram. IP processes each Datagram fragment independently. Datagram fragmentation can reach its destination through different routers. If they pass through those defined smaller MTU networks, they can be further fragmented.
III. Assembly
In order to reassemble these Datagram fragments, the receiving host allocates a storage buffer when the first shard arrives. The host will also start a timer. When subsequent fragments of the Datagram arrive, the data is copied to the location indicated by the slice offset field in the buffer memory. When all the fragments arrive, the complete unfragmented original packet is restored. Processing continues as if it were an unfragmented Datagram.
Fourth and third digit marks
The first bit is reserved for later use; the second bit is the "unfragmented" bit. If it is 1, the Datagram will not be fragmented, if it cannot be forwarded over any available network, it will be discarded, and an ICMP error message will be sent to the originator. If 0, the Datagram will be fragmented if needed. The third bit is the "more shard" bit, which is 1, which means that there are more shards, and if it is 0, it is the last shard.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
TCP is like carrying money. UDP is like fire fighting.
© 2024 shulou.com SLNews company. All rights reserved.