TCP/IP of IP datagram ip slicing ip slicing process

Main functions of the host, router network layer.


We will cover the format of ip datagrams in detail in this article First, the ip datagram is divided into two parts, the header and the data


We analyze in detail the meaning of each field in the header


The version number field takes up 4 bits: The version number of the IP protocol, usually with two values, if 4 means it is IPv4, 6 means it is IPv6 protocol. 4 → IPv4, 6 → IPv6

The initial length field occupies 4 bits: IP packet initial length, here it is in four bytes, if the value is 5, it means the initial length is 20 bytes (5×4), you can also see from the figure that the shortest ip initial length should be 20 bytes, excluding the variable part, the fixed part is 20 bytes.

The Type of Service (TOS) field takes up 8 bits: indicates what type of service is expected

  • In 1998 this field was renamed Distinguished Service
  • Only use when the network provides a differentiated service (DiffServ)
  • Not normally used, usually the value of this field (byte 2) of the IP grouping is 00H

The total length field takes up 16 bits: the total number of bytes of the IP packet (first + data)

  • Total length of the maximum IP packet: 65535B
  • Minimum IP packet prefix: 20B
  • Maximum data that can be encapsulated in an IP packet: 65535-20=65515B

Time to Live (TTL) field occupies 8 bits: the number of routers (or hop steps) an IP packet can pass through in the network

  • The router forwards one packet, TTL minus 1
  • If TTL=0, the router drops the IP packet

The protocol field occupies 8 bits: indicates which protocol packet is encapsulated in the IP packet

  • Implementing reuse/decomposition
  • E.g. 6 is TCP, indicating that the encapsulated segment is TCP; 17 is UDP, indicating that the encapsulated datagram is UDP

The first checksum field takes up 16 bits: enabling error detection of IP packet headers

  • When calculating the checksum, this field is set to all zeros
  • Summation using inverse arithmetic operations, with the inverse of the sum as the first checksum field
  • Hop-by-hop calculation, hop-by-hop verification

The source IP address and destination IP address fields each occupy 32 bits: identify the IP address of the source host/router (network interface) that sent the packet and the destination host/router (network interface) that received the packet, respectively

The options field accounts for variable length, ranging from 1 to 40B: carries security, source selection paths, timestamps, and routing records ** Rarely used in practice **

The fill field accounts for a variable length, ranging from 0 to 3B: the purpose is to fill in the entire First part, conforming to 32-bit alignment, i.e. ensuring that the length of the first part is a multiple of 4 bytes

ip slicing

When introducing the ip datagram header fields, we ignored the introduction of the second line of fields because the fields in this line relate to the slicing of ip datagrams, and we will introduce the slicing of ip datagrams before we introduce the meaning of these fields.

Network Link Presence MTU (Maximum Transmission Unit)-The upper limit of data that can be encapsulated in a link layer data frame. ** Different MTUs for different links **.


Large IP packets can be "fragmented" when forwarded to smaller MTU links

  • 1 IP packet divided into multiple IP packets
  • IP fragmentation is "reassembled" when it reaches the destination host

The relevant fields in the IP header are used to identify the slice and to determine the relative order of the slice

  • Total length, logo, flag bits and slice offsets



The identifier field takes up 16 bits: identifies an IP group

  • The IP protocol utilizes a counter that adds 1 to the IP packet counter for each IP packet generated, as the identification of that IP packet

The flag bit field takes up 3 bits.

  • DF (Don't Fragment)
  • MF (More Fragment)


  • DF = 1: banning fragmentation. DF = 0: slicing allowed
  • MF = 1: not the last piece. MF = 0: last piece (or unsliced)

The Slice Offset field takes up 13 bits: an IP packet slice encapsulates the original IP packet data relative offset

  • Slice offset fields are in 8-byte increments

ip sharding process

  • Assume that the total length of the original IP packet is L and the MTU of the link to be forwarded is M
  • ifL>M, yetDF=0, then you can/ Needs to be split
  • The identity of each slice when slicing replicates the identity of the original IP grouping
  • Normally when slicing, all slices except the last one are divided into the maximum slices allowed by the MTU
  • The data that can be encapsulated in a maximum slice should be a multiple of 8. Therefore, the data that can be encapsulated in a maximum slice is


  • The total number of tablets required is.




1、html5 frontend framework tutorial full set of video sharing knock on the blackboard
2、What is the key to campus informatization in the era of Internet
3、Safer TuplePython Basics Prequel 8
4、Cogent Logistics wins Chinas Most Valuable Investment Enterprise Award 2018
5、Blockchain Diary05

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送