【问题标题】:How to identify packets of traceroute?如何识别traceroute的数据包?
【发布时间】:2016-06-20 17:15:10
【问题描述】:

我正在使用 C 语言并使用 pcap 库来分析一个 cap 文件,该文件包含在执行 traceroute 期间发送/接收的数据包。我遇到的问题是识别从traceroute 发送/接收的数据包,因为cap 文件也包含其他数据包。

在尝试确定任何给定数据包是否来自traceroute 时,我是否可以检查任何特定标准?或者这不可能?

如果您能提供任何帮助/建议,我们将不胜感激。

【问题讨论】:

    标签: c networking wireshark pcap traceroute


    【解决方案1】:
    $ man traceroute
    
    TRACEROUTE(8)             BSD System Manager's Manual            TRACEROUTE(8)
    
    NAME
         traceroute -- print the route packets take to network host
    
        ...
    
    
         -I      Use ICMP ECHO instead of UDP datagrams.  (A synonym for "-P
                 icmp"). 
    
        ...
    
    
         This program attempts to trace the route an IP packet would follow to   
         some internet host by launching UDP probe packets with a small ttl (time
         to live) then listening for an ICMP "time exceeded" reply from a gateway.
         We start our probes with a ttl of one and increase by one until we get an
         ICMP "port unreachable" (which means we got to "host") or hit a max 
         (which defaults to net.inet.ip.ttl hops & can be changed with the -m
         flag).  Three probes (changed with -q flag) are sent at each ttl setting
         and a line is printed showing the ttl, address of the gateway and round
         trip time of each probe.  If the probe answers come from different gate-
         ways, the address of each responding system will be printed.  If there is
         no response within a 5 sec. timeout interval (changed with the -w flag),
         a "*" is printed for that probe.
    
         We don't want the destination host to process the UDP probe packets so
         the destination port is set to an unlikely value (if some clod on the  
         destination is using that value, it can be changed with the -p flag).
    

    因此,默认情况下,traceroute 数据包是发送到某个随机端口的 UDP 数据包;这使得它们有点难以与其他流量区分开来。

    如果有人使用-I 选项,它将使用 ICMP ECHO 数据包,这更容易与其他流量区分开来,但不容易区分,例如来自“ ping”命令。

    可以尝试寻找具有小 TTL 的数据包。

    【讨论】:

    • 我认为最终的结论是没有真正的方法可以检查这些数据包是否属于traceroute。
    【解决方案2】:

    程序 traceroute 通过发送带有递增 IP TTL 字段的 UDP/ICMP 数据包来工作。与典型应用程序发送的内容相比,这些 IP TTL 字段通常非常小(我的是 64)。

    所以如果你用过滤器捕捉

    ip.ttl

    您可能会收到这些数据包(您可以调整上述过滤器中的数字),请记住,如果您靠近运行 traceroute 程序的主机,您甚至可以通过“ip.ttl

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-25
      • 2016-08-07
      • 1970-01-01
      • 1970-01-01
      • 2016-02-09
      • 1970-01-01
      • 2012-05-05
      • 2015-06-30
      相关资源
      最近更新 更多