I have an OpenVPN server set up on my home network using TAP (rather than TUN) devices, such that clients that connect to the network remotely are bridged to the same subnet as my (wired) home network.
However, I have a laptop that I dock at home using Ethernet, and use WiFi for elsewhere (I try not to use WiFi at home--it's a disaster in crowded Manhattan apartment buildings). I also like having fixed IP addresses for every device on my network, so I fix the IP configuration for its Ethernet adapter, and use the same IP as well for the TAP device when connected to the VPN (using a client configuration directory on the server side).
Is there a good and minimally hack-ish way to configure the OpenVPN service on my laptop to only connect to OpenVPN when the Ethernet connection is not active? Having the OpenVPN service running in the background automatically is super-convenient and I don't want to manually have to shut it off every time I connect to Ethernet, but having it trying to connect to the same network I'm already physically on via VPN using the same IP address I'm already using is obviously not a good idea...
I'm sure I could hack something together with init scripts, but I'd like to minimize my divergence from the official Ubuntu configuration as much as possible. I'd really appreciate if it anyone could think of a more "proper" approach.