收藏 分享(赏)

第七章IP协议,报文格式.ppt

上传人:wspkg9802 文档编号:5518777 上传时间:2019-03-06 格式:PPT 页数:30 大小:240KB
下载 相关 举报
第七章IP协议,报文格式.ppt_第1页
第1页 / 共30页
第七章IP协议,报文格式.ppt_第2页
第2页 / 共30页
第七章IP协议,报文格式.ppt_第3页
第3页 / 共30页
第七章IP协议,报文格式.ppt_第4页
第4页 / 共30页
第七章IP协议,报文格式.ppt_第5页
第5页 / 共30页
点击查看更多>>
资源描述

1、第七章 IP协议:报文格式,无连接通信思想 IP报文格式 IP报文选项,1 引言,网络结构虚拟网络 路由器为“节点” 物理网为“信道” 物理网在路由器间运送IP报文 路由器为IP报文选择传输路径,2 无连接通信思想,IP通信的环境 穿越多个网络 经过多个路由器 有多条可能的路径,无连接通信,不同物理网络之间存在差异 通信能力、分组长度、延时 允许IP报文从不同路径达到目的地 路由器为每个IP报文独立选路 IP通信不保证可靠性,但灵活性增加 多种网络都能满足的通信方式 允许多种选路策略(如可靠性、容量、延时) 结合应用考虑实际通信策略,3 IP报文格式,IP报文首部 携带源、目的地址 报文分段、

2、重组 Service Access Point IP Options Others IP报文数据 Any bytes of data,IP格式图,4Bytes边界对齐 Data为任意字节,IP PDU structure,struct IP_PDU U8 VerLen; /* Version and Header Length */U8 TOS; /* Type of service */U16 TLen; /* Total packet length */U16 ID; /* packet identifier */U16 FlgOff; /* Flags and Frag. Offset

3、*/U8 TTL; /* Time To Live */U8 Prot; /* Protocol ID, - upper SAP */U16 hCS; /* Header Chechsum */U32 sIP; /* Source IP addr. */U32 dIP; /* Destination IP addr */U8 OpData.; /* Option and data fields */ ;,格式域,Ver(4bit):版本号(=4) HLen(4 bit): 首部长度 长度单位:4字节 Total Length:本报文总长度 长度单位:字节 HCS:首部校验和 IP只检查首部,H

4、Len (4bytes unit),Total Length (1 bytes unit),最大HLen = 16,(11x4 bytes max Used in IP option),最大IP报文长度:65535 bytes (包括首部),TTL:Time To Live 该报文的寿命(秒,最大255) 防止路由成环时,IP被无限次转发 协议规定,路由器处理IP报文时,应减去处理所用的时间,TTL为零时,丢弃该报文 实际:TTL经过路由器时,被减1 Protocol:上层协议类型 作为IP提供的SAP,TCP,UDP,ICMP,1,17,6,IP,Assigned Protocol Numb

5、er,0:Reserved 1:ICMP 2:IGMP 3:GGP 4:IP 6:TCP 8:EGP 9:IGP 17:UDP 23:Trunk-1 25:Leaf-1,29:ISO-TP4 46:RSVP 48:MHRP 88:IGRP 89:OSPFIGP 93:AX.25 94:IPIP 97:ETHERIP ,IP校验和计算,只对首部进行校验和检查,数据部分由高层协议进行校验 计算方法 把首部看成16bit整数序列:W1、W2、 模65535,即0xFFFF(不是65536)求和,结果取反 任何情况下,HCS0,4 TOS, Type of Service,RFC791 Bits 0-

6、2: Precedence. Bit 3: Delay, 0 = Normal, 1 = Low. Bits 4: Throughput. 0 = Normal, 1 = High Bits 5: Relibility. 0 = Normal, 1 = High Bits 6: Cost. 0=Normal, 1= Low Bits 7: Must be zero. Precedence 111 - Network Control 110 - Internetwork Control 101 - CRITIC/ECP 100 - Flash Override 011 - Flash 010 -

7、 Immediate 001 - Priority 000 - Routine,TOS, Type of Service,RFC1349, TOS for: ICMP Telnet minimum Delay FTP Max throughput TFTP - Minimize delay SMTP - Maximize throughput Any IGP - Maximize reliability SNMP - maximize reliability Other use of TOS Binary number of TOS coding,5. Fragmentation,The re

8、quirements of segmentation,Transport,IP,Physical Network,Data block size is independent of MTU of underlying physical network,IP packet size must matche the MTU of underlying physical network,MTU=Maximum Transmission Unit,Typical MTU:1500 (Ethernet)20004000 (Token Ring)512 (Dial-up) 128 (Radio Link)

9、others,Host,Data Block,IP Packet,Fragmentation,Gateway requires fragmentation for different MTU of physical networks,IP,MTU1,MTU2,Gateway,Example: MTU1 = 1500 BytesMTU2 = 600 Bytes,Fragmentation & reassembly,Case 1: reassembly at Gateway and host Case 2: reassembly only at host,IP,IP,G1,G2,MTU=1500,

10、MTU=800,MTU=1000,2500,2200,Case 1,Case 2,Discussion,IP protocol specify that: The fragmentation action will appear at host or gateway where needed. The assembly will only appear at IP destination host. Discussing the advantage and disadvantage Assembly at Gateway Assemble only at end point (Host),Fr

11、agmentation control,Identifier (16 bit) distinguish different IP packets All frags of a packet hold the same Identifier Frag offset (13 bit) offset of a IP packet data 8 bytes unit (match 64K length) Flag Segmentation status -More fragments follows -Dont frag,Some IP layer cannot handle fragmentatio

12、n,Fragmentation example,0,576,1152,Offset0, M=1,Offset72(x8),M=1,Offset144(x8), M=0,MTU:1500 bytes, Header :20 bytes,MTU = 600,ID = a,ID = b,ID = b,ID = a,Offset and M-bit,ID controls assembly,Implementation,Frag,NI-2,Assembly,Route & Forwarding,NI-1,IP-in,Frag,Encapsulation,Assembly buffer,Data blo

13、ck,Assembly problems,integrity judgement of data block? Len=Length-1+length-2+ ? If frags arrived out of sequence? Missing some of fragments? Overlap among fragments,6. IP Options,OpCode,Option-1,Option-2,End,IP Option,The options may appear or not in datagrams. They must be implemented by all IP mo

14、dules (host and gateways). Copy Indicates that this option is copied into all fragments on fragmentation. Class 0 = control 1 = reserved for future use 2 = debugging and measurement 3 = reserved for future use,Security,This option provides a way for hosts to send security,compartmentation, handling

15、restrictions, and TCC (closed user group) parameters. The format for this option is as follows:,Type=130 Length=11,S:16bits,Security C:16bits,Compartmentation H:16bits,Handling TCC:24bits,Closed User group,Loose Source and Record Route,The loose source and record route (LSRR) option provides a means

16、 for the source of an internet datagram to supply routing information to be used by the gateways in forwarding the datagram to the destination, and to record the route information.,Next Gateway to go to,Strict Source and Record Route,The strict source and record route (SSRR) option provides a means

17、for the source of an internet datagram to supply routing information to be used by the gateways in forwarding the datagram to the destination, and to record the route information.,Next Gateway to go to,Record Route,The record route option provides a means to record the route of an internet datagram.

18、,Next Gateway addr to record,Stream Identifier,This option provides a way for the 16-bit SATNET stream identifier to be carried through networks that do not support the stream concept.,Internet Timestamp,The Internet timestamp option provides a means to record the route and timestamp of an internet datagram.,思考,绝大多数IP报文都没有Option,IP头部有多少字节? IP Option 最多可用多少字节? IP报文分段时,必须把头部复制到每个分段上,why?,

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 实用文档 > 往来文书

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报