《tcpip10icmp协议》由会员分享,可在线阅读,更多相关《tcpip10icmp协议(7页珍藏版)》请在金锄头文库上搜索。
1、tcpip10 icmp协议 Chapter10ICMP?Types ofmessages?Message format?Error reporting?Query?Checksum?ICMP package1Overview?IP?Lack oferror control?Lack of assistance mechanism?ICMP?A panionto theIP?Provide errorreporting forIP?Provide assistancemechanism forother layers(TCP/UDP andapplication)2Error Reportin
2、g&Error Correction?IP传输过程中出现差错是不可避免的?IP分组传输出现差错时,会产生相应的ICMP报文?通过ICMP报文提供差错报告?ICMP差错报告只能送给IP分组的源站,协议只提供了差错处理建议?出错点可能不是当前的路由器?反向传输路径可能与原路径不同源站可能无法确定差错源,需要与网络管理员一起协作处理3Inter ControlMessage Protocol?RFC792:Inter ControlMessage Protocol,1981?RFC1256:ICMP RouterDiscovery Messages,1991IP LANsMANs WANsICMP
3、IGMPARP RARPNetwork LayerNetwork AessLayer TransportLayer ApplicationLayer4Message deliveryand Encapsulation?ICMP在IP之上实现,逻辑上与IP同在网络层?Connectionless munication?直接送达目的站点,沿途的转发路由器不能获知ICMP报文内容?Encapsulation ICMP message IP header IP data Framedata Trailer(if any)Frame headerICMPmessageIP header IPdataPr
4、otocol=1510.1Types ofMessages ICMPmessages Error-reporting差错报告Query测试查询To reportproblems thata routeror a destination hostmay encounterwhen itprocesses an IP packetTo helpa hostor awork managerget specificinformation froma routeror anotherhost6Types CategoryType MessageReason Error-reporting message
5、s3Destination unreachableUnreachable4Source quenchCongestion11Time exceededToo longroute12Parameter problemFormat error5Redirection Routechanged Querymessages8or0Echo request or replyReachability13or14Timestamp requestor replySynchronization17or18Address maskrequestorreply Maskmaintenance10or9Router
6、 solicitationor advertisementCoincidence betweenrouters过时15Information request16Information response710.2Message Format Code ChecksumData sectionType8bits8bits16bits?差错报文引起差错的原始分组的一部分(首部+数据部分的前88个字节)?查询报文基于查询类型的额外信息8Rest of the ICMPhead10.3Error Reporting?ICMP justsimply reporterrors?ICMP alwaysrepo
7、rts errormessages to the originalsource?ICMP errormessage willNOT begenerated for:?A datagramcarrying anICMP errormessage?A fragmenteddatagram thatis NOTthe firstfragment?A datagramhaving amulticast address?A datagramhaving aspecial addresssuch as127.0.0.0or0.0.0.0Error reportingDestination unreacha
8、bleSource quenchTime exceededParameter problemsRedirection9Contents ofData Fieldfor ErrorMessages IP header8bytes IPdata IP header8bytes ICMPpacket ICMP headerIP header8bytes SentIP datagramICMPheaderIP headerReceived datagramProvide informationabout TCPand UDP1010.3.1Destination Unreachable?When ar
9、outer cannotroute a datagram ora hostcannot deliveradatagram?The datagramis discarded?The routeror thehost sendsadestinationunreachable messageback tothe sourceCode=012Checksum Type=3IP header+8bytes IPdata0x00000000不可达的原因供源站分析错误A routercannot detectall problemsthat preventthe deliveryof apacket11De
10、stination UnreachableCodes CodeDescription CodeDescription0网络不可达7目的主机1主机不可达8源主机被隔离2协议不可达9与目的网络的通信被禁止3端口不可达10与目的主机的通信被禁止4需要分片,但DF=111对指定TOS,网络不可达5源路由失败12对指定TOS,主机不可达6目的网络哪些目的不可达报文只能由目的主机产生?哪些目的不可达报文不能由目的主机产生?1210.3.2Source Quench?The lackof flowcontrol forIP?congestion?主机产生的数据量可能比网络快?不适当的路由使流量过分集中,超过
11、信道容量?路由器的转发性能低?路由器或主机因拥塞丢弃IP分组时,向源站发送ICMP源抑制报文,通知源站放慢分组的发送Code=0Checksum Type=4IPheader+8bytes IPdata0x0000000013The SolutionoftheCongestion?发送队列缓冲缓解短暂的突发数据?丢弃报文,产生源抑制ICMP报文给源站?丢弃算法QoS?源站减缓发送速率?源站没有收到源抑制报文后逐步提高发送速率?源抑制报文的拥塞控制能力?只能解决因主机问题造成的拥塞?对因路由或路由器问题造成的拥塞不起作用1410.3.3Time Exceeded?路由器或主机因分组超时而丢弃IP
12、分组时,向源站发送ICMP超时报文Code=0,1Checksum Type=11IPheader+8bytes IPdata0x00000000Code=0路由器检测到分组的TTL值为00Code=1目的站在规定时间内没有收到所有分片1510.3.4Parameter Problem?路由器或主机因首部字段格式或取值错误而丢弃报文时,向源站发送ICMP参数问题报文Code=0,1Checksum Type=12IPheader+8bytes IPdata0x00000000Code=0首部字段错误,指针字段指向错误字节Code=1缺少所需的选项部分,指针字段无效Pointer1610.3.5
13、Redirection?重定向Net1Net2Host AHost BR1R2A wantto senddatagrams to B,but it doesnt knowR2is thebetter choice.What willitdo?IP packettoBRedirection messageNet1直接交付0.0.0.0/0R1Net1直接交付Net2R20.0.0.0/0R117FormatCode=03Checksum Type=5IPheader+8bytes IPdata IPaddress ofthe targetrouter CodeDescription0Networ
14、k specific1Host specific2Network specific(specified service)3Host specific(specified service)缩小路由改变的范围18思考?在以下情况中,重定向报文是否有用?Host AHost BR1R2R3重定向分组R2发出的重定向报文应该送给谁?路由器重定向源主机路由器路由协议1910.3.6不应发送ICMP差错报告报文的几种情况?对ICMP差错报告报文不再发送ICMP差错报告报文。 ?对第一个分片的数据报片的所有后续数据报片都不发送ICMP差错报告报文。 ?对具有多播地址的数据报都不发送ICMP差错报告报文。 ?
15、对具有特殊地址(如127.0.0.0或0.0.0.0)的数据报不发送ICMP差错报告报文。 xx.4Query QueryEcho request and replyTimestamp requestand replyAddress maskrequestandreply Routersolicitation andadvertisement PingTrace route2110.4.1Echo Requestand Reply?To testthe reachabilityofa host Pingmand TCPUDP ICMPIP ICMPIP EchoEcho replyApprox
16、imate round-trip timeCode=0Checksum Type=8,0Optional data(Send bythe requestmessage;repeated bythe replymessage)Identifier Sequence number2210.4.2Timestamp Requestand Reply?Used tocalculate theround-trip time(ms)?发时间=收时戳-初始时戳,收时间=返回时间-发时戳?往返时间=发时间+收时间?Used tosynchronize twoclocks intwo machines?由于路径、传输,难以得到非常精确的时间Code=0Checksum Type=13,14Original timestamp(filled bysource)Identifier Sequencenumber Receivetimestamp(filled bydestination)Transmit tim