I have a home computer H (Linux), a work computer W (Mac OS X), and a public server S (same Linux as H) with IP 11.22.33.44.
As H and W are all behind NAT, I use autossh to connect them both to S and communicate with each other through tunnels:
# From H to S
ssh -R :8822:127.0.0.1:22 [email protected]
# From W to S
ssh -R :7722:127.0.0.1:22 [email protected]
When I'm in office, I often SSH to H and forward X11 back:
# on W
ssh -X -p 8822 [email protected]
xterm
...
Both H and W have very low latency to S (ping around 2-5 ms), so everything's quite smooth, until my office moved and ISP changed. The ping from W to S remains low, and everything is still fast until X forward starts. Whenever I try to start xterm from H over X11 forward, the TCP connection over which became extremely slow. However, other SSH sessions from W to H without forward remain fast. After Ctrl-C the unresponsive xterm, the forwarding SSH session immediately recovers to be responsive.
It feels like someone is watching SSH sessions and slows it down whenever a X11 communication is made. To find out which part went wrong, I did a test like this:
# on W
ssh -R 11.22.33.44:6010:127.0.0.1:6000 [email protected]
# on S
DISPLAY=11.22.33.44:10 xterm # works fine!
# on H
DISPLAY=11.22.33.44:10 xterm # unresponsive
The strange thing is, if xterm starts on S, it's fine; When it's from H, it stalls, not the H→S part, but the W→S SSH session, as typing on it became extremely slow. After Ctrl-C the hanging xterm, it recovered immediately.
It seems not a network problem, as H→S and W→S are all great (both latency- and bandwidth-wise). Over the tunnel, scp between W and H is fast; lftp fish://H
from W also works fine.
As this happened after an ISP switch, I was thinking if there's any traffic throttling by ISP, but X11 forward works fine in any direction between W and S, or between H and S. It's just that any X11 traffic between W and H, in any way I can think of, slows down the SSH connection carrying that forward.
I'm deep confusion on this mess. Can anyone help me figure out which part should I look into?