How to fix nmcli Error: unknown connection issue in Linux CentOS/RHEL

There could be a multiple reason for nmcli Error: unknown connection. In this tutorial I am going to fix the unknown connection issue during the IP addess configuration on a device. If you are facing issue when you are trying to configure network for a device in Linux OS. Please follow below steps to fix the same.

Let's check the current active IP address of system.

[root@TechArticles ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:e5:4f:ea brd ff:ff:ff:ff:ff:ff
    inet 192.168.111.77/24 brd 192.168.111.255 scope global dynamic noprefixroute enp0s3
       valid_lft 3491sec preferred_lft 3491sec
    inet6 2409:4089:8214:b7e0:a00:27ff:fee5:4fea/64 scope global dynamic noprefixroute
       valid_lft 3548sec preferred_lft 3548sec
    inet6 fe80::a00:27ff:fee5:4fea/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:c2:15:90 brd ff:ff:ff:ff:ff:ff
4: enp0s9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:77:43:28 brd ff:ff:ff:ff:ff:ff
5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP>mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:8b:26:aa brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever

As per above Interface details, I am going to configure IP on enp0s8 interface. In your case it may be different device name.

As per above device details, you can see device enp0s8 is available and there is no IP assigned.

I am going to configure below IP on device enp0s8.

IP address:		 192.168.111.100/24
Default gateway:	 192.168.111.100
Preferred DNS:		  8.8.8.8
IP addressing 		  static 

Let's check the device details by running nmcli device status command.

[root@TechArticles ~]# nmcli device status
DEVICE  TYPE      STATE                   CONNECTION
enp0s3  ethernet  connected               enp0s3
virbr0  bridge    connected (externally)  virbr0
enp0s8  ethernet  disconnected            --
enp0s9  ethernet  disconnected            --
lo      loopback  unmanaged               --

As you can see enp0s8 ethernet is showing disconnected.

Let's configre IP address for device enp0s8.

[root@TechArticles ~]# nmcli con mod enps08 ipv4.addresses 192.168.111.100/24
Error: unknown connection 'enps08'.
[root@TechArticles ~]#

Now, you can see device is available but its says Error: unknown connection 'enps08'.

Basicly this is not a nmcli error, it is throwing error just beacuse the device is available but there is no connection created for device enp0s8.

We can check connection by running below command.

[root@TechArticles ~]# nmcli con show
NAME    UUID                                  TYPE      DEVICE
enp0s3  b972dea7-b72d-4e48-a838-bda20615e189  ethernet  enp0s3
virbr0  58bed60d-b638-4e39-978d-5417bee137dc  bridge    virbr0

As per above command output device enp0s8 is not available, So we have to create the connection first for device enp0s8. Then we will be able to configure IP for it.

If you can see your device after running the above command, then stop here and please continue reading How to fix nmcli connection up Error: unknown connection issue in Linux CentOS/RHEL; If not, proceed to the steps to resolve the issue below.

Follow below stpes to create the connection for device enp0s8

[root@TechArticles ~]# nmcli connection add type ethernet connection.interface-name enp0s8 con-name enp0s8
Connection 'enp0s8' (14cb1621-2a4a-47f6-8092-3323e7cb4e65) successfully added.

[root@TechArticles ~]# nmcli con show
NAME             UUID                                  TYPE      DEVICE
enp0s3           b972dea7-b72d-4e48-a838-bda20615e189  ethernet  enp0s3
enp0s8  14cb1621-2a4a-47f6-8092-3323e7cb4e65  ethernet  enp0s8
virbr0           58bed60d-b638-4e39-978d-5417bee137dc  bridge    virbr0

As you can see that device enp0s8 is now available in connecion list. Let's move further to configure the IP. This time we will not get any error.

[root@TechArticles ~]# nmcli connection modify enp0s8 ipv4.addresses 192.168.111.77/24

Assign the gateway.

[root@TechArticles ~]# nmcli connection modify enp0s8 ipv4.gateway 192.168.111.1

Assign the DNS server IP.

[root@TechArticles ~]# nmcli con mod enp0s8 ipv4.dns "8.8.8.8"

Then change the connection status from auto to manual and enable the interface at boot.

[root@TechArticles ~]# nmcli con mod enp0s8 ipv4.method manual
[root@TechArticles ~]# nmcli con mod enp0s8 autoconnect yes

To save the changes, run the command.

[root@TechArticles ~]# nmcli con up enp0s8

Then verify if the IP is configured or not to interface

[root@TechArticles ~]# ip addr show dev enp0s8
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:c2:15:90 brd ff:ff:ff:ff:ff:ff
    inet 192.168.111.100/24 brd 192.168.111.255 scope global dynamic noprefixroute enp0s8
       valid_lft 560sec preferred_lft 560sec
    inet6 fe80::6618:b371:6916:184b/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

All above changed will be wrriten in /etc/sysconfig/network-scripts/ifcfg-enp0s8 file.

You can view the details of /etc/sysconfig/network-scripts/ifcfg-enp0s8 by running below command.

[root@TechArticles ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s8
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s8
UUID=14cb1621-2a4a-47f6-8092-3323e7cb4e65
DEVICE=enp0s8
ONBOOT=yes
IPADDR=192.168.111.100
PREFIX=24
GATEWAY=192.168.111.1
DNS1=8.8.8.8

Was this article of use to you? Post your insightful thoughts or recommendations in the comments section if you don't find this article to be helpful or if you see any outdated information, a problem, or a typo to help this article better.

Jay

I love keeping up with the latest tech trends and emerging technologies like Linux, Azure, AWS, GCP, and other cutting-edge systems. With experience working with various technology tools and platforms, I enjoy sharing my knowledge through writing. I have a talent for simplifying complex technical concepts to make my articles accessible to all readers. Always looking for fresh ideas, I enjoy the challenge of presenting technical information in engaging ways. My ultimate aim is to help readers stay informed and empowered on their tech journeys.

Post a Comment

Previous Post Next Post

Contact Form