how to keep eth link down across reboots ?

Thomas Haller thaller at redhat.com
Thu Dec 14 11:54:05 UTC 2023


On Thu, 2023-12-14 at 12:17 +0100, Íñigo Huguet wrote:
> On Thu, Dec 14, 2023 at 12:01 PM lejeczek <peljasz at yahoo.co.uk>
> wrote:
> > Thanks a lot! That seems more practical.
> > There is one aspect I did not think of at first - will NM
> > this way(or any other) be able to detect physical link/cable
> > removal (naturally while device+profile/iface is up/on) ?
> > BTW, what would a good way to watch such link (for such
> > cable removal) outside (but perhaps with NM help) of NM?
> > 
> > many thanks, L.
> > 
> 
> NM can show you de carrier state of any device, even unmanaged
> devices, I think: nmcli -g WIRED-PROPERTIES.CARRIER device show eth0
> 
> If you have a profile on the interface and autoconnect=yes, it will
> react to carrier up/down events, activating or deactivating that
> profile (this won't happen if you configure ignore-carrier in the
> .conf files, but for ethernet, by default carrier events are
> considered).
> 
> Also, with some python scripting you could listen to the
> notify::carrier signal that is sent via DBUS. Ask here for an example
> if you intend to take this way.
> 

But if the interface is down (`ip link set down`), then kernel does not
report the carrier-state. The carrier state is determined by kernel,
and it's what you see in `ip link` (LOWER_UP flag).

Which is the main reason, why NetworkManager always brings interfaces
up (unless the interface is unmanaged).


Thomas



More information about the Networkmanager mailing list