【TCP/IP】Tracerouter

Traceroute程序可以让我们看到IP数据报从一台主机传到另一台主机所经过的路由。

Traceroute相对于IP路径记录选项的比较:

       首先并不是所有的路由器都支持记录路由选项,ASA就不支持。其次IP路径记录选项记录的双向的,浪费选项地址空间,最后IP首部中留给选项的空间有限

 

Cisco的Traceroute工作原理:

       在cisco中,发送去往目的地UDP:33434(cisco默认),TTL值为1的报文,到达第一个路由器时,路由器发现TTL值为1,路由器就会给源发送一个ICMP差错信息TTL不可达。当源收到ICMP时,读取ICMP中的源地址打印出来,然后继续发送去往目的地UDP:33435,TTL值为2的报文,到达第二个路由器时,路由器发现TTL值为1,路由器又会给源发送一个ICMP差错信息TTL不可达。当源收到ICMP时,读取ICMP中的源地址打印出来,如此重复,获取经过的所有路由,当抵达目的时,目的地路由器发现是找自己的,不会看TTL值是否为1,继续查看4层信息,发现端口自己没有开启,会给源发送一个ICMP差错信息端口不可达信息。当源读取这个端口不可达信息,就知道到达目的地了,继续打印出来。

 

 

微软的Tracert的工作原理:

       发送去往目的地的ICMP请求报文TTL值为1的报文,到达第一个路由器时,路由器发现TTL值为1,路由器就会给源发送一个ICMP差错信息TTL不可达。当源收到ICMP时,读取ICMP中的源地址打印出来,然后继续发送去往目的地的ICMP请求报文TTL值为2的报文,到达第二个路由器时,路由器发现TTL值为1,路由器又会给源发送一个ICMP差错信息TTL不可达。当源收到ICMP时,读取ICMP中的源地址打印出来,若此重复,获取经过的所有路由,当抵达目的时,目的地路由器发现是找自己的,不会看TTL值是否为1,直接回应一个ICMP应答报文,当源读取这个ICMP应答报文时,就知道到达目的地了,继续打印出来。

 

 

IP源站选路选项:

严格源站路由选择:发送端指明IP数据报所必须采用的确切路由,如果一个路由器发现源路由所指定的下一个路由器不再其直接连接的网络上,那么它就会返回一个“源站路由失败”的ICMP差错报文

严格源站路由的变态之处,哪怕路由器上没有到达目的地的路由也可以通,因为严格源站路由提供了下一跳地址。

       宽松的源站路由:发送端指明了一个数据报经过的IP地址清单,但是数据报子啊清单上指明的任意两个地址之间可以通过其他路由器

路由器默认支持源站路由,防火墙都是不支持的,因为安全问题,但是我们可以把源站路由给关掉,no ip source-route。关闭后就无法使用源站路由了,会返回一个ICMP,type为3,code为5的源站路由失败的信息

Code:宽松的源站路由值为0x83,严格的源站路由值为0x89

Len和ptr字段与记录路由选项一样。

       当一个源站路由发出时,指针会指向选项位的第一个IP地址,相当于告诉客户端第一条去哪,然后R1收到的会是指针指向下一跳的IP地址,在R1发送出去的时候,会将自己出接口的IP地址填写到选项位的第一个IP地址(回去的时候才知道反向的源站路由),如此重复。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
DDU ICMP controls consist of 3 controls : TDDUOSPING - A non blocking PING protocolTDDUOSTRACEROUTE - A non blocking TraceRoute ProtocolTDDUOSDNS - A non blocking ARP/RARP controlAbout TDDUOSDNS :Host names are resolved to IP addresses, and IP address can be resolved to host names. If you enter an IP into the ADDRESS property, the HOST property will be completed, and the OnHostLookup event will occur. If you enter an IP or a HOST name into the HOST property, the ADDRESS property will be completed, and the OnAddressLookup event will occure. The runtime property OK can be queried to see if the lookup was successful. To reduce lookup overhead, an IP/Hostname cache can be used by setting the UseIPCache property to true. The cache is only persistent for the current session, and maynot be saved between sessions. You can use FlushIPCache method to clear the cache.When combined with the other controls in this package, the delay normally associated with connecting a socket can be avoided. Each control must have a unique TDDUOSDNS control.About the Demo :The demo project shows how to use each control. The TDDUOSDNS control is shown both in combination with other controls, and used independantly. DNS not an ICMP protocol, but it is included to prevent the windows application from blocking.Blocking is when your windows program stops responding to messages, waiting for a call to return. Normally, all calls blocks for a very short time, and is not noticable - but when you have to wait for 5 or 10 seconds or even longer, the application can appear to be crashed. By using threads, callback messages, and events, I have illustrated how it is possible to avoid blocking in an application.These controls form a custom set of TCP/IP controls I have been developing over the past year. The ICMP controls were written over the period of a week, and I consulted several references for information. I would like to thank Quinn Shute for his excellent book "Windows Socket Network Programming&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值