Android: TCP connection drop when disabling WiFi
stefan at agner.ch
Wed Jul 4 23:11:50 CEST 2018
I am using WireGuard for Android v0.0.20180625 with the Go userspace
backend. I am using a WiFi router with OpenWrt as Wireguard endpoint
(WAN/internet address). Wireguard tunnels all traffic through the tunnel
(Allowed IPs 0.0.0.0/0, ::/0). This works as expected: I can connect to
the Internet through the tunnel no matter whether I am locally on the
WiFi or connecting through 4G. Wireguard reconnects seamlessly.
Now what I hope is that my TCP connection stay alive when roaming from
WiFi to 4G. Since Wireguard reconnects automatically and my public IP
through the tunnel stays the same, I would expect that I can have a SSH
connection open while roaming from WiFi to 4G and back. I am using the
SSH client ConnectBot to connect to an (IPv6) server. When changing from
4G to WiFi, the connection stays alive. However, when switching off WiFi
(and hence change back to 4G) ConnectBot immediately reports "Host has
It seems as if Android somehow drops all TCP connection when WiFi
connection gets lost... Is this a known behavior? Anybody else observes
the same behavior? It seems somewhat unfortunate as I would have hoped
that Wireguard lets me keep sessions open...
Also tried with a second SSH client, so it seems a common behavior. I am
using a Nexus 6P with Stock Android 8.1.0.
More information about the WireGuard