3

I'm trying to figure out a way to measure RTT for SSH connection, but my google-fu is too weak (perhaps I'm asking wrong questions?).

Something akin to ping , for cases where SSH works, but ICMP does not.

StanTastic
  • 860
  • 1
  • 8
  • 25

2 Answers2

3

HPing is a tool that performs the equivalent of ping but does so over TCP, so works around networks where ICMP is blocked.

http://backdrift.org/tcp-ping-ping-tcp-port and http://www.hping.org/ describe it in more detail.

From the former:

$ 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

In your case you'd use -p 22 to target SSH.

Jason Martin
  • 5,023
  • 17
  • 24
  • You're right, but it also reminds me to *always* describe the problem in detail. In my case, I can't use hping, because I'm doing SSH over an HTTP proxy... Hm, I'll have a look if hping supports proxy. – StanTastic Jan 03 '17 at 11:12
1

You can use nping from the nmap package. It allows you to send TCP SYN segments to measure the round trip time (among other modes, see below)

$ 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

Other probe modes to measure your RTT are UDP, ICMP, ARP (this one would require an ip present at your local link, of course)

wnrph
  • 111
  • 2