How to disconnect a device and prevent automatic activation of it using nmcli in RHEL 9 ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 9
  • nmcli (NetworkManager)

Issue

  • How to disconnect a device and prevent automatic activation of it using nmcli?
  • How to use nmcli command to disconnect a device in RHEL 9 .
  • Can I disconnect a device and prevent it from activating automatically ?

Resolution

In RHEL9 , nmcli command gives additional option which is used to disconnect a device as well as prevent the device from automatically activating further connections without user/manual intervention

This is useful in scenarios where there is need to prevent activation of device and it should be only activated with user intervention.

Note that disconnecting software devices may mean that the devices will disappear.

       If --wait option is not specified, the default timeout will be 10 seconds.

RHEL 8

[root@rhel8 ~]# nmcli con show | grep abc -B+1
NAME                UUID                                  TYPE      DEVICE 
bond-abc            7ae46c89-9686-4450-bb14-3be3957677c3  bond      abc    
[root@rhel8 ~]# nmcli device down abc
Error: argument 'down' not understood. Try passing --help instead.

RHEL 9

[root@rhel9 ~]# nmcli con show | grep abc -B+1
NAME      UUID                                  TYPE      DEVICE 
bond-abc  add5e50a-1752-401a-979c-11b5524d99b2  bond      abc    

[root@rhel9 ~]# nmcli device down abc
Device 'abc' successfully disconnected.

[root@rhel9 ~]# nmcli con show | grep -e abc -e UUID
NAME      UUID                                  TYPE      DEVICE 
bond-abc  add5e50a-1752-401a-979c-11b5524d99b2  bond      --   

To start particular connection again use following command:

[root@rhel9 ~]# nmcli connection up bond-abc 
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)

[root@rhel9 ~]# nmcli con show | grep -e abc -e DEVICE
NAME      UUID                                  TYPE      DEVICE 
bond-abc  add5e50a-1752-401a-979c-11b5524d99b2  bond      abc    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments