brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ss -ti shows the round trip time of every open TCP connection

Linux
~/tips/tip-networking-ss-ti-tcp-rtt

ss -tin dst 192.168.1.30

Shows round trip time, MTU and congestion window for each TCP connection to a host.

Ping tells you how fast a host answers ICMP. What I often want to know is how an existing TCP connection is doing, the slow file copy or the stream that keeps buffering. The kernel already tracks that per socket, and ss will show it to you.

The -i flag (--info) adds the internal TCP information to each connection. Combine it with -t for TCP only, -n to skip name lookups, and a filter so you don’t drown in output:

ss -tin dst 192.168.1.30

Under each connection you get a line of fields. The man page lists them; the ones I’d read first are rtt: (average round trip time and its variation, in milliseconds), mss and pmtu (segment size and path MTU), cwnd (the congestion window) and send, the egress rate in bits per second. lastsnd and lastrcv tell you how many milliseconds ago data went out or came in.

For example, when a copy from my MacBook to the Unraid server crawls, I’d run this on the server with the Mac’s address as dst. On a wired LAN I’d expect the rtt well under a few milliseconds. Tens of milliseconds to a machine in the same house points at Wi-Fi or a congested link. A small pmtu or mss hints at an MTU problem somewhere on the path, and a tiny cwnd on a long transfer means TCP keeps backing off.

One caveat: these are the kernel’s own estimates for that socket, and the man page says the fields may appear, so what you see depends on the kernel and the connection. On an idle connection the rtt can be old news, so check lastsnd and lastrcv first. It only covers TCP, so a UDP stream such as WireGuard won’t show any of this.

Further reading: ss(8) man page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link