执行ifconfig eth2 up命令报错eth2: unknown interface: No such device的解决思路
排查问题思路
一般出现这种状况都是网卡mac地址错误引起的!要么网卡配置文件中的mac地址不对,要么/etc/udev/rules.d/70-persistent-net.rules文件中的mac地址不对!!!
问题现象描述
- bond网卡地址ping不通;
- 交换机侧看对应端口状态如下(无关信息省略)
<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
......
- 在配置bond的两张网卡上执行
ifconfig eth2 up
和ifconfig eth3 up
都报类似的错:eth2: unknown interface: No such device;
故障分析定位
- 从故障现象描述第3条手动UP网卡的报错信息以及交换机侧看对应端口的信息,基本可以排除是交换机侧的故障和物理链路故障,主要排查服务器侧的故障;一般此问题是服务器网卡的MAC地址不对造成的。
故障排查过程
- 查看网卡
如下,我们可以看到系统中有4张网卡,eth0、eth1、eth2和eth3:
[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]#
- 查看
/etc/udev/rules.d/70-persistent-net.rules
文件内容如下
[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]#
- 发现的问题:在网卡配置文件目录下只有eth0、eth1、eth2和eth3这4张网卡,但是在/etc/udev/rules.d/70-persistent-net.rules文件中发现竟然多了eth4和eth5这2张网卡;并且查看eth2和eth3网卡配置文件时发现其mac地址和/etc/udev/rules.d/70-persistent-net.rules文件中显示的eth2和eth3文件的mac地址不一样;eth2和eth3配置文件内容如下:
[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]#
可以从以上信息看出,eth2和eth3网卡配置文件中的mac地址和/etc/udev/rules.d/70-persistent-net.rules中eth2和eth3中的mac地址不一样;
远程登录IPMI查看主机mac地址信息如下图:
从上述信息可以判定配置文件中eth2和eth3的mac地址信息是错的
造成mac地址错误的原因
之前这台设备报修过,更换过网卡文件,所以网卡的mac地址变了;但是/etc/udev/rules.d/70-persistent-net.rules和网卡配置文件中eth2和eth3的mac地址没有对应更新,而是异常新增了并不存在的eth4和eth5网卡,而实际的bond配置还是使用的eth2和eth3网卡,所以网络异常,手动UP网卡报错unknown interface: No such device。
解决办法
修改网卡配置文件和/etc/udev/rules.d/70-persistent-net.rules,修改后正确配置如下:
- /etc/udev/rules.d/70-persistent-net.rules
[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]#
- ifcfg-eth2
[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]#
- ifcfg-eth3
[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地址之前重启网卡也是无效的。
执行ifconfig eth2 up命令报错eth2: unknown interface: No such device的解决思路的更多相关文章
- centos MAC 地址与报错eth0 unknown interface no such device
eth0 unknown interface no such device 出现这个原因是由于虚拟机直接COPY过来,MAC地址发生了变化,但eth0 里仍然记录着旧的MAC地址. 解决方法: vim ...
- adb shell报错:error: insufficient permissions for device的解决办法
1.错误描述 执行 adb shell 时,报错如下; error: insufficient permissions for device 2.解决办法 1,终端执行 lsusb 结果如下,注意绿 ...
- Mac 升级后idea执行git命令报错xcrun: error: invalid active developer path的解决办法
报错 xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun ...
- maven执行"mvn clean package" 命令报错
昨天利用mvn打包,执行程序'mvn clean package' 命令,发现打包失败 问题描述 具体看代码 发信tomcat下的log 清除不掉.为什么呢?忽然想起来我的项目服务还起着,于是我把服务 ...
- MySQL执行外部sql脚本文件命令报错:unknown command '\'
由于编码不一致导致的 虽然大部分导出是没有问题的 但是数据表中存储包含一些脚本(富文本内容)会出现该问题,强制指定编码即可解决. mysql导入时指定编码: mysql -u root -p --de ...
- mysqlbinlog查看 binlog日志报错mysqlbinlog: unknown variable 'default-character-set=utf8mb4'
今天,查看mysql slave节点 binlog日志信息时,执行mysqlbinlog命令报错mysqlbinlog: unknown variable 'default-character-set ...
- 执行Spark运行在yarn上的命令报错 spark-shell --master yarn-client
1.执行Spark运行在yarn上的命令报错 spark-shell --master yarn-client,错误如下所示: // :: ERROR SparkContext: Error init ...
- Python3安装Celery模块后执行Celery命令报错
1 Python3安装Celery模块后执行Celery命令报错 pip3 install celery # 安装正常,但是执行celery 命令的时候提示没有_ssl模块什么的 手动在Python解 ...
- RedHat中敲sh-copy-id命令报错:-bash: ssh-copy-id: command not found
RedHat中敲sh-copy-id命令报错:-bash: ssh-copy-id: command not found 在多台Linux服务器SSH相互访问无需密码, 其中进入一台Linus中,对其 ...
随机推荐
- 变量 Variables
是为了存储(store)程序(program)运算过程中的一些信息(informations),为了方便日后调用.操作和更改 变量名应该简明,见名识意,让读者和我们自己能更清晰的了解 如果我们把变量看 ...
- unity一些操作汇总
设置父物体高度自适应子物体:父物体添加ContentSizeFitter,设置Horizeontal Fit和Vertical Fit为Preferred Size. ScrollView设置Cone ...
- python笔记06
python笔记06 数据类型 上个笔记内容补充 补充 列表 reverse,反转. v1 = [1,2,3111,32,13] print(v1) v1.reverse() print(v1) v1 ...
- LaTeX技巧007:每一章开始的header引用名言应该怎么做?
[问题描述] 看到很多论文的每一章开始的右上角都有一段名人名言, 我试验了很多次一直都搞不清楚是怎么搞?是用fancyhead么?谁可以说说呢? 多谢了 [解决方案] 使用epigraph宏包来制作即 ...
- Ubuntu使用ipython出现版本不兼容的问题
今天租了一个ECS,然后准备安装了jupyter,准备配置,输入ipython,出现如下报错 ImportError: IPython 7.10+ supports Python 3.6 and ab ...
- new SparkContext()发生错误java.lang.NoSuchMethodError: scala.Predef
参考:https://blog.csdn.net/weixin_40137479/article/details/80320324 new SparkContext(conf)发生错误: Except ...
- JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串的长度超过了为 maxJsonLength 属性设置的值
在.net mvc的controller中,方法返回JsonResult,一般我们这么写: [HttpPost] public JsonResult QueryFeature(string u ...
- phpstorm同步服务器文件
配置服务器 1.连接配置 打开菜单栏 Tools -> Deployment -> Configuration 点击 + 选择 SFTP,并填写相关服务器信息: Type:连接类型,这里选 ...
- 题解 CF409A 【The Great Game】
题目传送门. 思路: 首先我们定义\(2\)个字符串,分别存放 TEAM 1 与 TEAM 2 的出招顺序.接着再定义\(2\)个变量,存放 TEAM 1 与 TEAM 2 的分数. string s ...
- Linux之温故知新2
1.关于ssh免密码登陆的ssh-keygen, ssh-copy-id的使用, 然后使用ssh-copy-id user@remote将公钥传给服务器, 以及别名 1 C:\Users\linxmo ...