how to keep eth link down across reboots ?

lejeczek peljasz at yahoo.co.uk
Thu Dec 14 11:00:17 UTC 2023



On 13/12/2023 09:16, Thomas Haller wrote:
> On Wed, 2023-12-13 at 09:05 +0100, lejeczek wrote:
>>   Hi guys.
>>   
>>   how would you keep an Ethernet link/port powered down?
>>   I was thinking I'll try first _udev_ rules - given other
>> tools/managers are told to stay away from the link/port just as an
>> extra precaution, complementing this:
>>   
>>   [keyfile]
>>   unmanaged-devices=interface-name:gateway
>>   
>>   in NM's conf, but that part of the config - in order for NM to be
>> able to bring iface up/down again - needs to be absent/not-used & NM
>> has to reloaded.
>>   Anybody would have a better, more practical solution?
>>   
>>   Just to stress - this is about having physical port "powered-down"
>> and not just NM profile/iface not being up.
>>   
>>   many thanks, L.
>
> Hi,
>
>
> just configure the interface as unmanaged.
>
>
> I think the best way is a file /etc/NetworkManager/conf.d/90-device-
> unmanage-gateway.conf with
>
>     [device-90-device-unmanage-gateway]
>     match-device=interface-name:gateway
>     managed=0
>
>
> This is best, because you can still overwrite it at runtime with `nmcli
> device set $DEVICE managed yes` (only if you choose to).
>
> Alternatives are:
>
> - udev attribute NM_UNMANAGED=1
> - udev attribute "ID_NET_MANAGED_BY" set to something other than
> "org.freedesktop.NetworkManager" (since 1.45)
> - [keyfile].unmanaged-devices= in NetworkManager.conf
>
> (you don't need multiple ways for the same thing, as a "precaution").
>
>
> See `man NetworkManager` and `man NetworkManager.conf`.
>
>
> Thomas
>
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.


More information about the Networkmanager mailing list