其他分享
首页 > 其他分享> > 执行ifconfig eth2 up命令报错eth2: unknown interface: No such device的解决思路

执行ifconfig eth2 up命令报错eth2: unknown interface: No such device的解决思路

作者:互联网

排查问题思路

一般出现这种状况都是网卡mac地址错误引起的!要么网卡配置文件中的mac地址不对,要么/etc/udev/rules.d/70-persistent-net.rules文件中的mac地址不对!!!

问题现象描述

<CL202-R04F02-H3CS7610-SW01>display interface Ten-GigabitEthernet 1/2/0/4
Ten-GigabitEthernet1/2/0/4
Current state: UP
Line protocol state: UP
IP packet frame type: Ethernet II, hardware address: 7057-bf25-8a00
......

<CL202-R04F02-H3CS7610-SW01>display interface Ten-GigabitEthernet 2/2/0/4
Ten-GigabitEthernet2/2/0/4
Current state: UP
Line protocol state: DOWN(LAGG)
IP packet frame type: Ethernet II, hardware address: 7057-bf24-b800
......

故障分析定位

[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# ll ifcfg-*
-rw-r--r--. 1 root root 196 Mar 23 15:34 ifcfg-bond0
-rw-r--r--  1 root root 328 Mar 23 21:02 ifcfg-eth0
-rw-r--r--. 1 root root 212 Mar 23 15:30 ifcfg-eth1
-rw-r--r--  1 root root 117 May  7 16:58 ifcfg-eth2
-rw-r--r--  1 root root 117 May  7 16:58 ifcfg-eth3
-rw-r--r--. 1 root root 254 Apr 27  2018 ifcfg-lo
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# 
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# more /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="50:af:73:2e:5c:37", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="50:af:73:2e:5c:38", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x37d3 (i40e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="6c:92:bf:c5:a8:28", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x8086:0x37d3 (i40e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="6c:92:bf:c5:a8:29", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# PCI device 0x8086:0x37d3 (i40e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="6c:92:bf:a3:ac:49", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

# PCI device 0x8086:0x37d3 (i40e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="6c:92:bf:a3:ac:48", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]#
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# cat ifcfg-eth2 
DEVICE="eth2"
#HWADDR="6c:92:bf:c5:a8:28"
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
NAME="eth2"
MASTER=bond0
SLAVE=yes
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# 
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# cat ifcfg-eth3
DEVICE="eth3"
#HWADDR="6c:92:bf:c5:a8:29"
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
NAME="eth3"
MASTER=bond0
SLAVE=yes
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# 
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# cat /etc/udev/rules.d/70-persistent-net.rules 
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="50:af:73:2e:5c:37", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x1521 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="50:af:73:2e:5c:38", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x37d3 (i40e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="6c:92:bf:a3:ac:48", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x8086:0x37d3 (i40e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="6c:92:bf:a3:ac:49", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# 
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# cat ifcfg-eth2 
DEVICE="eth2"
#HWADDR="6c:92:bf:a3:ac:48"
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
NAME="eth2"
MASTER=bond0
SLAVE=yes
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# 
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# cat ifcfg-eth3
DEVICE="eth3"
#HWADDR="6c:92:bf:a3:ac:49"
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
NAME="eth3"
MASTER=bond0
SLAVE=yes
[root@CL202-R04F05-NRGL-MONGODB-SLAVE-NF5180M5-SV01 network-scripts]# 

关键最后一步 --- 重启主机

修改配置文件后,尝试过重启网卡,但是依旧未成功,所以尝试了重启主机后世界豁然开朗,网络马上ojbk。
注:没修改mac地址之前重启网卡也是无效的。

标签:No,rules,eth3,网卡,报错,net,root,eth2
来源: https://www.cnblogs.com/wholj/p/10826825.html