Nmcli "unknown connection"

Can anyone tell me why this doesn’t work?

nmcli connection modify eno1 ipv4.gateway “192.168.0.1”
Error: unknown connection ‘eno1’.

nmcli connection show
NAME UUID TYPE DEVICE
Wired connection 1 81222133-5786-357e-bda7-eea86655800c ethernet eno1
lo 9df72730-213d-4e0c-972b-94e21fcda5fa loopback lo

This worked fine in el8 but doesn’t in el9 and I have no idea why since the connection exists as shown.

Are you sure ‘eno1’ is a connection, or is it a device?

You will need to do it by the device name:

nmcli conn modify "Wired connection 1" ipv4.gateway "192.168.0.1"

alternatively, also change the name of the connection from “Wired connection 1” to let’s say “eno1”.

Working example:

nmcli conn show
NAME                           UUID                                  TYPE      DEVICE    
Auto WLAN                      df6a3ebb-23de-49c3-b352-f677df2eb59f  wifi      wlp0s20f3 

nmcli conn show wlp0s20f3
Error: wlp0s20f3 - no such connection profile.

nmcli conn show "Auto WLAN"
connection.id:                          Auto WLAN
connection.uuid:                        df6a3ebb-23de-49c3-b352-f677df2eb59f

And there’s the answer!

Thank you ever so much, guys!

Sometimes I apparently can’t see what I’m looking at any more. :slight_smile:

1 Like

I do predict:

nmcli conn show df6a3ebb-23de-49c3-b352-f677df2eb59f
connection.id:                          Auto WLAN
connection.uuid:                        df6a3ebb-23de-49c3-b352-f677df2eb59f

What was the name of connection in the el8 machine?


NetworkManager does have some default behaviour. If on boot (or hot-plug) it sees a device that has no connection, then it will create on the fly a connection that uses DHCP, has name like “Wired connection N”, and is not stored to files.

The Rocky installer, if it explicitly creates a connection that is stored to file, does use name of device as name of connection. It does also set 802-3-ethernet.mac-address and does not set connection.interface-name – the connection is used for device that has said MAC address.

If you create connection manually (with nmcli), then you have to set connection.interface-name. (That can be changed later.) Binding by ifname is ok as long as ifname is persistent.

The name of the connection on el8 was apparently eno1 since the command line I posted was part of a bash script that worked on el8 and stopped working on el9.

When I set up this machine (and, I guess, the el8 machine) the installer grabbed an ip address from my dhcp server during the installation, and after I did the initial installation I used nmtui to change the connection from dchp to a manually entered ip address.