debian stretch loses gateway

After working for a while, the network repeatedly becomes disconnected, with the message connect: Network is unreachable

How to reproduce the problem:

After performing connmanctl and connecting to a WiFi AP, I get

`

root@beaglebone:~# /sbin/route -nee
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface MSS Window irtt
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 0 0 0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 0 0 0
192.168.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 wlan0 0 0 0
192.168.6.0 0.0.0.0 255.255.255.252 U 0 0 0 usb1 0 0 0
192.168.7.0 0.0.0.0 255.255.255.252 U 0 0 0 usb0 0 0 0

`

I then try to do some work – specifically

`
root@beaglebone:~# apt update

root@beaglebone:~# apt upgrade bb-node-red-installer

`

This fails spectacularly, with lots of errors, starting with

`

Err:1 http://repos.rcn-ee.com/debian stretch/main armhf bone101 armhf 1.1.12-0rcnee1~stretch+20180920
Temporary failure resolving ‘repos.rcn-ee.com

`

Looking for the cause of the failure to resolve repos.rcn-ee.com and deb.debian.org (which appears in lots of the other errors), I again run

`

root@beaglebone:~# /sbin/route -nee
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface MSS Window irtt
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 0 0 0
192.168.6.0 0.0.0.0 255.255.255.252 U 0 0 0 usb1 0 0 0
192.168.7.0 0.0.0.0 255.255.255.252 U 0 0 0 usb0 0 0 0

`

The gateway has gone missing. Why?

I’m running Debian 9.3 stretch, BeagleBoard.org Debian Image 2018-01-28, on a Beaglebone Black Wireless.

`

root@beaglebone:~# uname -a
Linux beaglebone 4.9.78-ti-r94 #1 SMP PREEMPT Fri Jan 26 21:26:24 UTC 2018 armv7l GNU/Linux

`

I’m mystified, but I assume that there’s something that explains this. And even more usefully, something that fixes it.

Thanks,
Richard