首页 > 系统相关 >Linux系统中解决Device eth0 does not seem to be present,delaying initialization问题

Linux系统中解决Device eth0 does not seem to be present,delaying initialization问题

时间:2022-11-28 22:01:36浏览次数:70  
标签:rules initialization delaying ifcfg etc Device net eth1 eth0

参考的第一篇文章

前言

  • CentOS6.5
  • 已安装好一台CentOS6.5虚拟机,假定为A。在A上执行克隆操作,获得B。在B启动后,遇到错误Device eth0 does not seem to be present

错误原因

在A系统上,网卡是eth0,系统的网络配置也是eth0(/etc/sysconfig/network-scripts/ifcfg-eth0)。
克隆得到的B系统,网卡是eth1,而系统的网络配置还是eth0(/etc/sysconfig/network-scripts/ifcfg-eth0)。
因此,错误为Device eth0 does not seem to be present

使用ifconfig命令查看网卡,结果如下:(我实际使用该命令没有显示eth1,只显示了下面第二部分内容)

shell> ifconfig -a
eth1      Link encap:Ethernet  HWaddr 00:0C:29:EE:B4:01
          inet addr:192.168.150.31  Bcast:192.168.150.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feee:b401/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6369 (6.2 KiB)  TX bytes:6959 (6.7 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

解决办法

办法一

  • 删掉网卡eth0的配置。
  • 创建网卡eth1的配置。
shell> cd /etc/sysconfig/network-scripts/
shell> mv ifcfg-eth0 ifcfg-eth1
shell> vi ifcfg-eth1
----------------------------
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.150.32
PREFIX=24
GATEWAY=192.168.150.2
DNS1=192.168.150.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth1"
----------------------------
shell> service network restart
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth1:  Determining if ip address 192.168.150.32 is already in use for device eth1...
                                                           [  OK  ]

我是按照这种方式进行解决的,并且我对ifcfg-eth0进行了备份,然后开始修改的.里面的内容也是要修改的.比如name和device,如果有这两个配置.还有ip也有换,因为我们这是克隆虚拟机.

我自己实际显示,它还是先找的eth0...,这个是我备份的文件.然后再找的eth1.

image-20221128214642563

另一种解决办法

  • 将网卡从eth1改名为eth0
shell> cp /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.backup
shell> /etc/udev/rules.d/70-persistent-net.rules
-----------删掉eth0的配置,将eth1改为eth0-----------------
# 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:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:04:0c:28", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ee:b4:01", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
----------------------------
shell> vi ifcfg-eth0
-----------删掉UUID和HWADDR-----------------
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.150.32
PREFIX=24
GATEWAY=192.168.150.2
DNS1=192.168.150.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
----------------------------
12345678910111213141516171819202122232425262728293031

上述步骤完成后,重启操作系统。

参考

https://blog.csdn.net/mier9042/article/details/86666388
https://www.linuxidc.com/Linux/2018-08/153407.htm
https://www.runoob.com/linux/linux-comm-ifconfig.html

参考的第二篇文章:

参考声明:https://blog.csdn.net/nigar_/article/details/104468723

问题:

在安装企业6的虚拟机后,制作了一个母盘,使用快照的方式复制了一个虚拟机。
原虚拟机的ip地址为172.25.254.1,需要把ip地址修改成172.25.254.2
这里我很自然的想到修改/etc/sysconfig/network-script目录下的网络接口配置文件ifcfg-eth0
接着使用/etc/init.d/network restart命令重启网络:
就出现了Device eth0 does not seem to be present的问题。
在这里插入图片描述
检查了配置文件无误后,查看桥接也没有问题。

解决:

查看/etc/udev/rules.d/70-persistent-net.rules文件
在这里插入图片描述
看到最后一行,设备是eth1,而它对应的mac地址是虚拟机网卡的mac地址
在这里插入图片描述

两种解决方法:

第一种:
/etc/sysconfig/network-script目录下的网络接口配置文件ifcfg-eth0
DEVICE=eth0改成DEVICE=eth1
再次重启网络,ip地址就成功的配上了。
但我觉得在ifcfg-eth0文件中配置eth1的信息,感觉有点拧巴,所以找到了第二种方法

第二种:
删除/etc/udev/rules.d/70-persistent-net.rules文件
在这里插入图片描述
这里删除后还是不能成功启动network,reboot重启虚拟机
再次启动network时,问题就解决了
在这里插入图片描述

标签:rules,initialization,delaying,ifcfg,etc,Device,net,eth1,eth0
From: https://www.cnblogs.com/javaxubo/p/16933771.html

相关文章