Linux Error:Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged).
在使用Linux的过程中,你可能会遇到如题所示的错误。
该错误的具体故障表现如下图所示:

导致该问题的原因是:MAC地址相同,导致的冲突
一般比较容易出现该问题的场景是:克隆后的虚拟机
在RHEL 7.x之后,网卡的管理是通过NetworkManager管理的;
当Linux使用NetworkManager来管理网卡的时候,NM是不允许发生MAC地址相同的情况的,这样,就会导致网卡无法启动。
在RHEL 6.X的时候,网卡的管理是通过network管理的。
如果不想使用NetworkManager,可以修改网卡配置文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
[root@linux network-scripts]# cat ifcfg-ens32 TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" NM_CONTROLLED="no" #BOOTPROTO="dhcp" BOOTPROTO="static" IPADDR="192.168.27.128" NETMASK="255.255.255.0" 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="ens32" UUID="2ef3b226-aa45-4c85-a29d-d32f7160850d" DEVICE="ens32" ONBOOT="yes" DNS1=114.114.114.114 [root@linux network-scripts]# |
如上,添加了参数【NM_CONTROLLED=”no”】,表示当前网卡不被NetworkManager所管理;
这时候,网卡就可以被激活了。
另一种方法:
就算网卡的配置文件中没有标明【NM_CONTROLLED】,如果停掉了NetworkManager的服务,也是可以成功激活网卡的;
具体如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
[root@linux network-scripts]# systemctl status NetworkManager ● NetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2020-07-28 15:37:25 CST; 24min ago Docs: man:NetworkManager(8) Main PID: 747 (NetworkManager) Tasks: 3 CGroup: /system.slice/NetworkManager.service └─747 /usr/sbin/NetworkManager --no-daemon Jul 28 15:38:24 linux NetworkManager[747]: <info> [1595921904.8995] audit: op="co...." Jul 28 15:39:30 linux NetworkManager[747]: </info><info> [1595921970.1923] agent-manager...ed Jul 28 15:39:30 linux NetworkManager[747]: </info><info> [1595921970.1933] audit: op="co...." Jul 28 15:41:07 linux NetworkManager[747]: </info><info> [1595922067.2908] agent-manager...ed Jul 28 15:41:07 linux NetworkManager[747]: </info><info> [1595922067.2919] audit: op="co...." Jul 28 15:57:59 linux NetworkManager[747]: </info><info> [1595923079.6632] agent-manager...ed Jul 28 15:58:29 linux NetworkManager[747]: </info><info> [1595923109.6841] ifcfg-rh: upd...") Jul 28 15:58:29 linux NetworkManager[747]: </info><info> [1595923109.7373] device (ens32...ed Jul 28 16:01:39 linux NetworkManager[747]: </info><info> [1595923299.3525] ifcfg-rh: upd...") Jul 28 16:01:39 linux NetworkManager[747]: </info><info> [1595923299.3529] ifcfg-rh: Man...e. Hint: Some lines were ellipsized, use -l to show in full. [root@linux network-scripts]# [root@linux network-scripts]# cat ifcfg-ens32 | grep NM_CONTROLLED #NM_CONTROLLED="no" [root@linux network-scripts]# [root@linux network-scripts]# ifup ens32 Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged). [root@linux network-scripts]# [root@linux network-scripts]# systemctl stop NetworkManager [root@linux network-scripts]# [root@linux network-scripts]# systemctl status NetworkManager ● NetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled) Active: inactive (dead) since Tue 2020-07-28 16:02:32 CST; 7s ago Docs: man:NetworkManager(8) Process: 747 ExecStart=/usr/sbin/NetworkManager --no-daemon (code=exited, status=0/SUCCESS) Main PID: 747 (code=exited, status=0/SUCCESS) Jul 28 15:58:29 linux NetworkManager[747]: </info><info> [1595923109.7373] device (ens32...ed Jul 28 16:01:39 linux NetworkManager[747]: </info><info> [1595923299.3525] ifcfg-rh: upd...") Jul 28 16:01:39 linux NetworkManager[747]: </info><info> [1595923299.3529] ifcfg-rh: Man...e. Jul 28 16:02:06 linux NetworkManager[747]: </info><info> [1595923326.7647] agent-manager...ed Jul 28 16:02:06 linux NetworkManager[747]: </info><info> [1595923326.7656] audit: op="co...." Jul 28 16:02:32 linux NetworkManager[747]: </info><info> [1595923352.0507] caught SIGTER...y. Jul 28 16:02:32 linux systemd[1]: Stopping Network Manager... Jul 28 16:02:32 linux NetworkManager[747]: </info><info> [1595923352.0553] device (virbr...r0 Jul 28 16:02:32 linux NetworkManager[747]: </info><info> [1595923352.0802] exiting (success) Jul 28 16:02:32 linux systemd[1]: Stopped Network Manager. Hint: Some lines were ellipsized, use -l to show in full. [root@linux network-scripts]# [root@linux network-scripts]# ifconfig lo: flags=73<up ,loopback,running=""> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 12727 bytes 50996422 (48.6 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12727 bytes 50996422 (48.6 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<up ,broadcast,multicast=""> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:7d:fc:b5 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@linux network-scripts]# [root@linux network-scripts]# ifup ens32 [root@linux network-scripts]# [root@linux network-scripts]# ifconfig ens32 ens32: flags=4163</up><up ,broadcast,running,multicast=""> mtu 1500 inet 192.168.27.128 netmask 255.255.255.0 broadcast 192.168.27.255 inet6 fe80::20c:29ff:fe81:6f24 prefixlen 64 scopeid 0x20<link /> ether 00:0c:29:81:6f:24 txqueuelen 1000 (Ethernet) RX packets 101 bytes 6338 (6.1 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 63 bytes 8537 (8.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@linux network-scripts]# </up></host></up></info> |
可以看到,当NetworkManager服务停掉后,网卡就可以被成功激活了。
注意上面【ifconfig】的反馈信息中,可以看到【ens32】这张网卡的MAC地址【ether 00:0c:29:81:6f:24】。
看看虚拟机的网卡的真实MAC地址:

可以看到,MAC地址是一致的,没有问题。
至此,文首遇到的问题,已经得到了解决。
with you have a good time.