centos7不能启动网卡报No suitable device found for this connection错误
错误1:
ifup ens33 显示
Error: Connection activation failed: No suitable device found for this connection.
错误2:
systemctl restart network 显示:
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
日志文件/var/log/meesage显示
Sep 20 11:21:52 centos129 NetworkManager[624]: <info> [1505877712.6949] audit: op="connection-activate" uuid="c96bc909-188e-ec64-3a96-6a90982b08ad" name="ens33" result="fail" reason="No suitable device found for this connection."
Sep 20 11:21:52 centos129 network: Bringing up interface ens33: Error: Connection activation failed: No suitable device found for this connection.
Sep 20 11:21:52 centos129 network: [FAILED]
上面报的两个错误
错误1 是mac地址出问题,通命令ip a 找到mac地址
[root@centos128 /]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
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: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:87:9d:51 brd ff:ff:ff:ff:ff:ff
inet 192.168.44.128/24 brd 192.168.44.255 scope global ens33
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:47:9a:32:9e brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
其中ether 00:0c:29:87:9d:51 就是网卡ens33的mac地址
错误2 是 网卡设备的uuid问题
运行命令发现如下信息
ifup ens33
Error: Connection activation failed: No suitable device found for this connection.
查看脚本ifup 发现错误代码源于如下
echo 'a75'
[ -n "${DEVICE}" ] && is_nm_handling ${DEVICE} && exit 0
echo "[ -n "${DEVICE}" ] && is_nm_handling ${DEVICE} && exit 0"
echo "$UUID"
nmcli con up uuid "$UUID"
运行如下一行命令得得同新的错
nmcli con up uuid "$UUID"
其中 UUID值的生成来于ifup脚本加载的/etc/sysconfig/network-scripts/network-functions脚本,network-functions中的的函数get_uuid_by_config ()
get_uuid_by_config ()
{
dbus-send --system --print-reply --dest=com.redhat.ifcfgrh1 /com/redhat/ifcfgrh1 com.redhat.ifcfgrh1.GetIfcfgDetails string:"/etc/sysconfig/network-scripts/$1" 2>/dev/null | awk -F '"' '/string / { print $2 }'
}
修改$1为ifcfg-ens33运行如下
dbus-send --system --print-reply --dest=com.redhat.ifcfgrh1 /com/redhat/ifcfgrh1 com.redhat.ifcfgrh1.GetIfcfgDetails string:"/etc/sysconfig/network-scripts/ifcfg-ens33" 2>/dev/null
得到uuid:
string "c96bc909-188e-ec64-3a96-6a90982b08ad"
object path "/org/freedesktop/NetworkManager/Settings/1"
其中c96bc909-188e-ec64-3a96-6a90982b08ad就是dbus-send生成的UUID
那么运行一下
nmcli con up uuid "$UUID"
nmcli con up uuid "c96bc909-188e-ec64-3a96-6a90982b08ad"
会得到如下报错信息
Error: Connection activation failed: No suitable device found for this connection.
解决办法:
配置文件/etc/sysconfig/network-scripts/ifcfg-ens33 中添加正确的mac地址和新的uuid
注意,uuid 不要为空,为空就会运dbus-send生成的UUID,系统生成UUID此时是不可用的(具体什么原因我也不知道的),只随便生成一个UUID就行的
如下
[root@centos129 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
#BOOTPROTO=dhcp
DEFROUTE=yes
#IPV4_FAILURE_FATAL=no
NAME=ens33
HWADDR="00:0C:29:E6:B5:68"
UUID="c96bc909-188e-ec64-3a96-6a90982b08az"
DEVICE=ens33
ONBOOT=yes
#DNS1=192.168.44.2
BOOTPROTO=static
IPADDR=192.168.44.129
PREFIX=24
GATEWAY=192.168.44.2
#IPV6INIT=no
启动网卡
ifup ens33
ifconfig -a
[root@centos129 network-scripts]# ifconfig -a
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:ae:fe:6c:f6 txqueuelen 0 (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
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.44.129 netmask 255.255.255.0 broadcast 192.168.44.255
inet6 fe80::20c:29ff:fee6:b568 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e6:b5:68 txqueuelen 1000 (Ethernet)
RX packets 1656 bytes 141293 (137.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1145 bytes 455981 (445.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
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 1 (Local Loopback)
RX packets 6 bytes 600 (600.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 600 (600.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@centos129 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
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: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:e6:b5:68 brd ff:ff:ff:ff:ff:ff
inet 192.168.44.129/24 brd 192.168.44.255 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fee6:b568/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:ae:fe:6c:f6 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
转载自原文链接, 如需删除请联系管理员。
原文链接:centos7不能启动网卡报No suitable device found for this connection错误,转载请注明来源!