Appendix K
Stuff that should have been in the manual, but wasn't...
A blog by @thejameskearney

By Date About

Git SSH Slow Response under WSL / Windows 10 and Netgear Router (Spoiler: IPv6)

This week, operations using my Git SSH remotes under WSL on Windows 10 began to take a really long time to complete. Well, to start even. In fact, it appeared that git operations would hang for a minute or two, and then complete normally.

I suspected this might be due either to something slow on the remote end (I use Bitbucket) or something in the network stack on between Ubuntu/WSL and Windows 10.

IPv6 is becoming the default

After some web searching, I came across a page on Atlassian's site that described a similar behavior, and the first answer gave me something to test my hypothesis:

It turned out that telling SSH to use IPv4 (by adding AddressFamily inet to /etc/ssh/ssh_config), my problem went away. Which meant that somehow, the problem was due to IPv6 in my environment. I can only suspect that a recent Windows or Ubuntu update configured the system to do network operations (e.g. DNS lookups) first over IPv6 by default.

Fixed!

I first confirmed that Ubuntu and Windows were both set up to use IPv6 via DHCP, and then checked my Netgear router to see how IPv6 was configured there. My particular router supports two setings for IPv6 – "DHCP" and "Auto Config", and mine was set to "Auto Config". After changing the value to "DHCP" and restarting the router, I was able to change my SSH settings back to AddressFamily any and get normal performance with git operations. Success!

Afterward

I suspect that this issue occurred because Ubuntu was attempting to establish a connection (first by performing a DNS lookup) using IPv6, and the delay was due to the fact that my router's IPv6 settings were misconfigured and that once the DNS lookup timed out, the resolver fell back to good ol' IPv4, succeeded, and then allowed SSH to connect normally.

Guess it's time to learn IPv6. :-)