我试图想出一种方法来测量SSH连接的RTT,但是我的google太弱了(也许我问错了问题?)
类似于ping的东西,对于SSH工作的情况,但ICMP不工作。
发布于 2016-12-22 16:00:38
HPing是一个执行相当于ping的工具,但它是通过TCP执行的,因此可以在ICMP被阻塞的网络上工作。
http://backdrift.org/tcp-ping-ping-tcp-port和http://www.hping.org/更详细地描述了它。
来自前者:
$ hping -S -p 80 google.com
HPING google.com (eth0 66.249.92.104): S set, 40 headers + 0 data bytes
len=44 ip=66.249.92.104 ttl=47 id=10442 sport=80 flags=SA seq=0 win=5720 rtt=97.7 ms
len=44 ip=66.249.92.104 ttl=47 id=40838 sport=80 flags=SA seq=1 win=5720 rtt=97.7 ms
len=44 ip=66.249.92.104 ttl=47 id=64607 sport=80 flags=SA seq=2 win=5720 rtt=97.7 ms
len=44 ip=66.249.92.104 ttl=47 id=10443 sport=80 flags=SA seq=3 win=5720 rtt=97.7 ms在您的例子中,您将使用-p 22来针对SSH。
发布于 2023-03-15 06:43:28
您可以使用nmap包中的nping。它允许您发送TCP SYN段来测量往返时间(在其他模式中,请参见下面)
$ nping -c 3 --tcp -p 443 google.com
Starting Nping 0.7.80 ( https://nmap.org/nping ) at 2023-03-15 07:40 CET
SENT (0.0640s) TCP 192.168.178.60:12321 > 142.250.181.238:443 S ttl=64 id=21385 iplen=40 seq=2979354139 win=1480
RCVD (0.0695s) TCP 142.250.181.238:443 > 192.168.178.60:12321 SA ttl=60 id=0 iplen=44 seq=1443175162 win=65535 <mss 1412>
SENT (1.0648s) TCP 192.168.178.60:12321 > 142.250.181.238:443 S ttl=64 id=21385 iplen=40 seq=2979354139 win=1480
RCVD (1.0699s) TCP 142.250.181.238:443 > 192.168.178.60:12321 SA ttl=60 id=0 iplen=44 seq=1458808251 win=65535 <mss 1412>
SENT (2.0671s) TCP 192.168.178.60:12321 > 142.250.181.238:443 S ttl=64 id=21385 iplen=40 seq=2979354139 win=1480
RCVD (2.0725s) TCP 142.250.181.238:443 > 192.168.178.60:12321 SA ttl=60 id=0 iplen=44 seq=1474469141 win=65535 <mss 1412>
Max rtt: 5.325ms | Min rtt: 4.991ms | Avg rtt: 5.193ms
Raw packets sent: 3 (120B) | Rcvd: 3 (138B) | Lost: 0 (0.00%)
Nping done: 1 IP address pinged in 2.11 seconds测量RTT的其他探测模式是UDP、ICMP、ARP (当然,这一模式需要本地链路上的ip )。
https://serverfault.com/questions/822223
复制相似问题