Network latency measurement (Linux)
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Luau
--
Chapters
00:00 Network Latency Measurement (Linux)
01:06 Answer 1 Score 5
01:20 Answer 2 Score 12
01:37 Accepted Answer Score 6
02:29 Thank you
--
Full question
https://superuser.com/questions/301997/n...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #networking #time #latency
#avk47
ANSWER 1
Score 12
Try ping:
$ ping -U 192.168.1.3
From the ping manual:
-U Print full user-to-user latency (the old behaviour). Normally ping prints network round trip time, which can be different f.e. due to DNS failures.
ACCEPTED ANSWER
Score 6
The tcpdump(8)
program's -ttt
flag may be just what you need:
00:00:00.000031 IP haig.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.0.168.192.in-addr.arpa. (42)
00:00:01.897031 IP haig.45240 > stackoverflow.com.www: Flags [F.], seq 866615166, ack 62506321, win 123, options [nop,nop,TS val 6026371 ecr 419296939], length 0
00:00:00.000030 IP haig.45242 > stackoverflow.com.www: Flags [F.], seq 853537650, ack 61102072, win 123, options [nop,nop,TS val 6026371 ecr 419296939], length 0
00:00:00.000019 IP haig.45243 > stackoverflow.com.www: Flags [F.], seq 863535366, ack 62086489, win 123, options [nop,nop,TS val 6026371 ecr 419296939], length 0
The timestamp at the beginning of the lines show the time in microseconds since the previous packet. By giving a different number of -t
on the command line, you can get either absolute times, relative times since the first packet, or relative times between packets.
I've just shown random mdns and web traffic because that's what is easy to find on my system; you could easily filter for SNMP traffic with tcpdump(8)
to get only the packets you're interested in. (Which would be a good idea, as dumping all traffic from busy systems can generate a huge load.)
ANSWER 3
Score 5
Run you program and the meantime capture network traffic with tcpdump
or wireshark
. Check the time of the request and the reply and do a simple subtraction.