Linux Disable Interface with Netplan (or not)

Published by Torry Crass on

So, based on everything I’ve found, you can’t.

In my opinion this is a shortcoming of using netplan versus the old way of simply using ifupand ifdown. This is in many ways super frustrating as it’s like the developers took the stance of “why on would anyone ever want to be able to turn OFF a network interface?!?”

A short and valid answer to that is simple, troubleshooting. Dealing with a DHCP range and not wanting a system to continue to pull DHCP addresses for the duration of troubleshooting.

<slight rant> If you’re going to develop a new way of doing something that’s supposed to be an improvement. Please add core features that were included in previous tool sets that you’re replacing. Don’t assume people don’t, or won’t use the feature. If you’re not going to implement it share some other way to perform the required task even if it’s a different tool. If you create a utility to manage network connections, then create a utility to manage network connections… all aspects of it. Especially if that utility is going to replace functionality across the spectrum of distros.</slight rant>

So, on to the best alternative that I’ve found to accomplish (temporarily or otherwise) disabling a network interface at the command line when you have netplan installed. Good ol’ trusty ip.

On to the one command to rule it all (or in other words turn off the connection): sudo ip link set <interface> down

This should take care of it, if you need to bring it up run the same and change downto up.


Leave a Reply