NetworkManager and (not) dealing with conflicting network connections
I recently tweeted a wish for NetworkManager:
I wish there was some straightforward way to tell NetworkManager to not automatically connect to any wifi networks if my laptop has a wired network connection, while still auto-connecting if there is no wired Ethernet.
In NetworkManager you can set a priority for network connections, but as far as I can tell you can't tell it that two connections conflict with each other and should never be brought up at the same time. You can write scripts that run when connections change and that take down connections (on Twitter @zigford pointed me to a script for this here), but I don't consider this straightforward. So let me give you the story of how I have wound up wanting this.
I have a work laptop, which I've brought home periodically for short periods of light use in the past (for example over our Christmas vacations). At that point I set it up for wireless networking and to automatically connect to my home wireless for convenience. Then, thanks to current world and local events, I took my work laptop home for extended use over a longer period, and soon discovered that my home wireless network has surprisingly high and variable latency. Fortunately I'd also taken the laptop's USB Ethernet adapter and I have a little home switch, so I could change over to having my laptop use a wired connection (although not without fun discoveries).
As it happens, I don't have two home subnets, one wired and one wireless; I have one that everything is on (and the AP just extends it out from wired to wireless). When I initially set up my laptop at home on the wireless, I gave it a fixed IP address and name so that I could easily SSH to it (and because I give everything here a fixed IP address). When I 'switched' my laptop to using a wired connection, I gave that wired Ethernet address the same fixed IP address, because I had no desire to have to SSH to 'laptop-wired' versus 'laptop-wifi' (I just want to SSH to 'laptop'). Unfortunately this means that if both the wired and the wireless connections are active at once, both get the same IP and then fun things happen. Especially, some of my traffic to my laptop goes over the wireless, with increased and variable latencies, which is what I set up a wired connection to avoid.
(I'm honestly surprised that my DHCP server didn't object to handing out the same IP at once to two different things, but then I did tell it that both the wired and the wireless Ethernet addresses could have the same IP. I'm also surprised at how long it took me to notice this; I only did because I was running 'ifconfig -a' for another reason and noticed that my wifi adapter had an IP assigned.)
My current solution is to tell NetworkManager to not automatically connect to my home wireless network. This is less convenient if I want to use my work laptop from somewhere else, but in practice I almost never do (my work laptop is mostly used for video conferencing, since it has a camera and a microphone; actual work happens from my home desktop).