中科大,计算机网络课件08
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Solution To find the time-to-live field, we skip 8 bytes (16 hexadecimal digits). The time-to-live field is the ninth byte, which is 01. This means the packet can travel only one hop. The protocol field is the next byte (02), which means that the upper layer protocol is IGMP (see Table 8.4).
TCP/IP Protocol Suite
16
8.2 FRAGMENTATION
The format and size of a frame depend on the protocol used by the physical network. A datagram may have to be fragmented to fit the protocol regulations.
码点字段: 前6位,后两位未用。 1、当其右3位全0时,左3位意 义如同优先位。 2、当其右3位非全0时,6位码 点字段就定义了64种服务,由 相应的机构指派。
TCP/IP Protocol Suite
9
Note: The total length field defines the total length of the datagram including the header.
TCP/IP Protocol Suite
13
Example 2
In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet?
Solution The HLEN value is 8, which means the total number of bytes in the header is 8 × 4 or 32 bytes. The first 20 bytes are the base header, the next 12 bytes are the options.
TCP/IP Protocol Suite
25
Example 6
A packet has arrived with an M bit value of 1. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented?
TCP/IP Protocol Suite
3
Figure 8.2
IP datagram
TCP/IP Protocol Suite
4
Figure 8.3
Service type or differentiated services
TCP/IP Protocol Suite
5
Note: The precedence subfield was designed, but never used in version 4.
TCP/IP Protocol Suite
20
Flag field标志域
D=1:不得对该数据报分段
D=0:需要时可对该数据报分段
M=1:该分段不是最后一个分段 M=0:该分段是最后或是唯一分段
TCP/IP Protocol Suite
21
Figure 8.8
Fragmentation example
TCP/IP Protocol Suite
26
Example 7
A packet has arrived with an M bit value of 1 and a fragmentation offset value of zero. Is this the first fragment, the last fragment, or a middle fragment?.
Chapter 8
Internet Protocol
Objectives
Upon completion you will be able to:
• Understand the format and fields of a datagram • Understand the need for fragmentation and the fields involved • Understand the options available in an IP datagram • Be able to perform a checksum calculation • Understand the components and interactions of an IP package
12
Example 1
An IP packet has arrived with the first 8 bits as shown:
01000010
The receiver discards the packet. Why? Solution There is an error in this packet. The 4 left-most bits (0100) show the version, which is correct. The next 4 bits (0010) show the header length; which means (2 × 4 = 8), which is wrong. The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission.
TCP/IP Protocol Suite
15
Example 4
An IP packet has arrived with the first few hexadecimal digits as shown below: 45000028000100000102 . . .
How many hops can this packet travel before being dropped? The data belong to what upper layer protocol?
TCP/IP Protocol Suite
10
Figure 8.4
Encapsulation of a small datagram in an Ethernet frame
TCP/IP Protocol Suite
11
Figure 8.5
Multiplexing
TCP/IP Protocol Suite
TCP/IP Protocol Suite
22
Figure 8.9
Detailed fragmentation example
TCP/IP Protocol Suite
23
分段策略
1. 2.
3.
4.
第一个分段的分段偏移值是0。 将第一个分段长度除以8,结果为第二个 分段的偏移值。 将第一个和第二个分段的总长度除以8, 结果为第三个分段的偏移值。 继续以上过程直到最后一段。最后分段的 分段位M的值是0,其他是1。
Solution The HLEN value is 5, which means the total number of bytes in the header is 5 × 4 or 20 bytes (no options). The total length is 40 bytes, which means the packet is carrying 20 bytes of data (40 − 20).
TCP/IP Protocol Suite
24
Example 5
A packet has arrived with an M bit value of 0. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented?
Solution If the M bit is 1, it means that there is at least one more fragment. This fragment can be the first one or a middle one, but not the last one. We don’t know if it is the first one or a middle one; we need more information (the value of the fragmentation offset). See also the next example.
18
Table 8.5 MTUs for some networks
TCP/IP Protocol Suite
19
Fields Related to Fragmentation
与分片/段相关字段
标识ID:16位,与IP地址一道唯一地定义IP 数据报。当该数据报被分段时,标识字段的 值就复制到所有的分段中,即属于同一数据 报(分组)的不同分段具有同样标识。 标志:3位(下一页) 分段偏移:13位,表示该分段在整个数据报 中的相对位置,以8字节为度量单位。
TCP/IP Protocol Suite
6
Table 8.1 Types of service
TCP/IP Protocol Suite
7
Table 8.2 Default types of service
TCP/IP Protocol Suite
8
Differentiated Services区分服务
TCP/IP Protocol Suite
14
Example 3
In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816 . How many bytes of data are being carried by this packet?
Solution If the M bit is 0, it means that there are no more fragments; the fragment is the last one. However, we cannot say if the original packet was fragmented or not. A nonfragmented packet is considered the last fragment.
The topics discussed in this section include: Ma百度文库imum Transfer Unit (MTU) Fields Related to Fragmentation
TCP/IP Protocol Suite
17
Figure 8.6
MTU
TCP/IP Protocol Suite
TCP/IP Protocol Suite
1
Figure 8.1
Position of IP in TCP/IP protocol suite
TCP/IP Protocol Suite
2
8.1 DATAGRAM
A packet in the IP layer is called a datagram, a variable-length packet consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and delivery.
TCP/IP Protocol Suite
16
8.2 FRAGMENTATION
The format and size of a frame depend on the protocol used by the physical network. A datagram may have to be fragmented to fit the protocol regulations.
码点字段: 前6位,后两位未用。 1、当其右3位全0时,左3位意 义如同优先位。 2、当其右3位非全0时,6位码 点字段就定义了64种服务,由 相应的机构指派。
TCP/IP Protocol Suite
9
Note: The total length field defines the total length of the datagram including the header.
TCP/IP Protocol Suite
13
Example 2
In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet?
Solution The HLEN value is 8, which means the total number of bytes in the header is 8 × 4 or 32 bytes. The first 20 bytes are the base header, the next 12 bytes are the options.
TCP/IP Protocol Suite
25
Example 6
A packet has arrived with an M bit value of 1. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented?
TCP/IP Protocol Suite
3
Figure 8.2
IP datagram
TCP/IP Protocol Suite
4
Figure 8.3
Service type or differentiated services
TCP/IP Protocol Suite
5
Note: The precedence subfield was designed, but never used in version 4.
TCP/IP Protocol Suite
20
Flag field标志域
D=1:不得对该数据报分段
D=0:需要时可对该数据报分段
M=1:该分段不是最后一个分段 M=0:该分段是最后或是唯一分段
TCP/IP Protocol Suite
21
Figure 8.8
Fragmentation example
TCP/IP Protocol Suite
26
Example 7
A packet has arrived with an M bit value of 1 and a fragmentation offset value of zero. Is this the first fragment, the last fragment, or a middle fragment?.
Chapter 8
Internet Protocol
Objectives
Upon completion you will be able to:
• Understand the format and fields of a datagram • Understand the need for fragmentation and the fields involved • Understand the options available in an IP datagram • Be able to perform a checksum calculation • Understand the components and interactions of an IP package
12
Example 1
An IP packet has arrived with the first 8 bits as shown:
01000010
The receiver discards the packet. Why? Solution There is an error in this packet. The 4 left-most bits (0100) show the version, which is correct. The next 4 bits (0010) show the header length; which means (2 × 4 = 8), which is wrong. The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission.
TCP/IP Protocol Suite
15
Example 4
An IP packet has arrived with the first few hexadecimal digits as shown below: 45000028000100000102 . . .
How many hops can this packet travel before being dropped? The data belong to what upper layer protocol?
TCP/IP Protocol Suite
10
Figure 8.4
Encapsulation of a small datagram in an Ethernet frame
TCP/IP Protocol Suite
11
Figure 8.5
Multiplexing
TCP/IP Protocol Suite
TCP/IP Protocol Suite
22
Figure 8.9
Detailed fragmentation example
TCP/IP Protocol Suite
23
分段策略
1. 2.
3.
4.
第一个分段的分段偏移值是0。 将第一个分段长度除以8,结果为第二个 分段的偏移值。 将第一个和第二个分段的总长度除以8, 结果为第三个分段的偏移值。 继续以上过程直到最后一段。最后分段的 分段位M的值是0,其他是1。
Solution The HLEN value is 5, which means the total number of bytes in the header is 5 × 4 or 20 bytes (no options). The total length is 40 bytes, which means the packet is carrying 20 bytes of data (40 − 20).
TCP/IP Protocol Suite
24
Example 5
A packet has arrived with an M bit value of 0. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented?
Solution If the M bit is 1, it means that there is at least one more fragment. This fragment can be the first one or a middle one, but not the last one. We don’t know if it is the first one or a middle one; we need more information (the value of the fragmentation offset). See also the next example.
18
Table 8.5 MTUs for some networks
TCP/IP Protocol Suite
19
Fields Related to Fragmentation
与分片/段相关字段
标识ID:16位,与IP地址一道唯一地定义IP 数据报。当该数据报被分段时,标识字段的 值就复制到所有的分段中,即属于同一数据 报(分组)的不同分段具有同样标识。 标志:3位(下一页) 分段偏移:13位,表示该分段在整个数据报 中的相对位置,以8字节为度量单位。
TCP/IP Protocol Suite
6
Table 8.1 Types of service
TCP/IP Protocol Suite
7
Table 8.2 Default types of service
TCP/IP Protocol Suite
8
Differentiated Services区分服务
TCP/IP Protocol Suite
14
Example 3
In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816 . How many bytes of data are being carried by this packet?
Solution If the M bit is 0, it means that there are no more fragments; the fragment is the last one. However, we cannot say if the original packet was fragmented or not. A nonfragmented packet is considered the last fragment.
The topics discussed in this section include: Ma百度文库imum Transfer Unit (MTU) Fields Related to Fragmentation
TCP/IP Protocol Suite
17
Figure 8.6
MTU
TCP/IP Protocol Suite
TCP/IP Protocol Suite
1
Figure 8.1
Position of IP in TCP/IP protocol suite
TCP/IP Protocol Suite
2
8.1 DATAGRAM
A packet in the IP layer is called a datagram, a variable-length packet consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and delivery.