Scrub all the following - the 'dnsfailure' file has just appeared!
Ah, I've just realised that this probably won't work. If the dns query isn't going via the tunnel, then simply changing the routing for the tunnel won't cause it to fail.
This may have something to do with why I'm experiencing this issue - let me explain ....
My main internet connection is unmetered fibre on WAN2.
If that connection goes down, I (manually) revert to a metered LTE connection on either WAN3 or WAN4.
I don't want to use the metered (PAYG) connection for torrents - first of all, it is much slower and secondly, relatively expensive.
To prevent torrenting via LTE, I have a route set up so that any traffic from Tower to destination port 1337 will only go via WAN2. However, if I bring up WAN3 or WAN4 the DNS query will still succeed and failure may or may not be registered, depending on how soon I (manually) bring the alternative WAN into use.
I suspect that you are correct, though, that deletion of the temporary file may be failing.
To test, without taking the rest of my network offline, I guess that I will have to route all Tower traffic to the unconnected WAN. This will stop my email and a few other services for a while, but shouldn't cause a major issue.
Just to confirm, the dns query will go to the configured NAME_SERVERS (currently 1.1.1.1 & 1.0.0.1), and not to my local dns server?