Tcp

TCP Ping 或 Traceroute 如何工作?

  • May 24, 2011

tcp ping 或 traceroute 是如何工作的?它是否只考慮建立 TCP 握手所需的時間?

同樣在 ICMP ping 中您可以指定數據包大小,這可以在 TCP ping 中實現嗎?

我相信您指的是這些實用程序:

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.

至於你的數據包大小問題,上面的描述也有答案。由於 tcptraceroute 發送一個標準的 SYN 數據包,它應該是一個小數據包,可能是 64 字節。

引用自:https://serverfault.com/questions/269234