TCP Ping 或 Traceroute 如何工作?

Geo*_*geU 9 networking ping icmp tcp

tcp ping 或 traceroute 如何工作?它是否只考虑了建立 TCP 握手所需的时间?

同样在ICMP ping中您可以指定数据包大小,这可以在TCP ping中实现吗?

dmo*_*ati 6

我相信您指的是这些实用程序:

http://www.vdberg.org/~richard/tcpping.html

http://michael.toren.net/code/tcptraceroute/

由于 tcpping 需要 tcptraceroute,我将从 tcptraceroute 开始。

tcptraceroute 的作者指出,与传统的 traceroute 不同,“通过发送 TCP SYN 数据包而不是 UDP 或 ICMP ECHO 数据包,tcptraceroute 能够绕过最常见的防火墙过滤器。”

进一步:值得注意的是,tcptraceroute 从未与目标主机完全建立 TCP 连接。

因此,tcptraceroute 不会测量完成三向握手所需的时间,因为这从未发生过。它测量从初始 SYN 到 SYN/ACK 的时间。这有时称为半开连接扫描。

从 nmap 联机帮助页:

          This technique is often referred to as half-open scanning,
          because you don’t open a full TCP connection. You send a SYN
          packet, as if you are going to open a real connection and then
          wait for a response. A SYN/ACK indicates the port is listening
          (open), while a RST (reset) is indicative of a non-listener. If
          no response is received after several retransmissions, the port
          is marked as filtered. The port is also marked filtered if an
          ICMP unreachable error (type 3, code 1,2, 3, 9, 10, or 13) is
          received.
Run Code Online (Sandbox Code Playgroud)

至于你的包大小问题,上面的描述也有答案。由于 tcptraceroute 发送的是标准的 SYN 数据包,因此它应该是一个小数据包,可能是 64 字节。