network redirection conditional to sock5 server in iptables, only if the server works

I have a stupid situation. My network has direct slow internet access that can be used at any time. However, I have a subscription for fast but limited vpn that works like a sock5 server (not sure if it's transparent or not).

My question is: is it possible to configure iptables to redirect all TCP traffic to the sock5 server only if the server is working and using the slow connection otherwise?

So something special:

  • Linux Ubuntu 18.04 as a router
  • eth0 – the external interphase, ip-dynamic, got
    through the DHCP protocol
  • vpn – ip is the same as the gateway of the
    external network with port 1986
  • eth1 – the inner network that can be
    configured as I want.