新闻动态

news

>
>
>
linux服务器网卡识别失败如何处理

linux服务器网卡识别失败如何处理-kb88凯时平台-首页

浏览量
【摘要】:
一台线上服务器硬件报警,最后排查发现服务器主板坏了,随即联系厂商进行更换主板,最后更换后,登录服务器,发现网卡绑定及ip信息都在,但是ip却ping不通了,进一步排查,重启网卡,提示之前的eth0和eth1网卡设备发现不了了,也就是说服务器主板更换后,之前的网卡设备都识别不了了!

    1)现象说明

 

  一台线上服务器硬件报警,最后排查发现服务器主板坏了,随即联系厂商进行更换主板,最后更换后,登录服务器,发现网卡绑定及ip信息都在,但是ip却ping不通了,进一步排查,重启网卡,提示之前的eth0和eth1网卡设备发现不了了,也就是说服务器主板更换后,之前的网卡设备都识别不了了!

 

  主板更换后,重启并登陆服务器,发现之前的网卡设备(eth0、eth1、eth2、eth3)都没有了!

 

  [root@kevin01 ~] # ifconfig -a bond 0 link encap:ethernet hwaddr 08 : 94 :ef : 5 e: ae:72 inet addr: 192.168. 10.20 bcast: 192.168. 10.255 mask: 255.255. 255.0 inet6 addr:fe80:: a94: efff: fe5e:ae72/ 64 scope:link up broadcast running master multicast mtu: 1500 metric: 1 rx packets: 75582 errors: 0 dropped: 0 overruns: 0frame: 0 tx packets: 58537 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0txqueuelen: 0 rx bytes: 5890233 ( 5.6 mib) tx bytes: 4390537 ( 4.1 mib) lo link encap:local loopback inet addr: 127.0. 0. 1 mask: 255.0. 0. 0 inet6 addr: : : 1/ 128scope:host up loopback running mtu: 65536 metric: 1 rx packets: 26 errors: 0dropped: 0 overruns: 0 frame: 0 tx packets: 26 errors: 0 dropped: 0 overruns: 0 carrier: 0collisions: 0 txqueuelen: 0 rx bytes: 1983 ( 1.9 kib) tx bytes: 1983 ( 1.9 kib) usb 0 link encap:ethernet hwaddr 0 a: 94 :ef : 5 e: ae: 79 broadcast multicast mtu: 1500metric: 1 rx packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0 tx packets: 0 errors: 0dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 rx bytes: 0 ( 0. 0 b) tx bytes: 0 ( 0. 0 b)

 

  之前的网卡设备和bond绑定的配置信息都还在(bond绑定网卡操作:http://www.cnblogs.com/kevingrace/p/7966511.html)

 

  [root@kevin ~] # cd /etc/sysconfig/network-s/ [root@kevin network-s] # ls ifcfg-bond0 ifcfg-lo ifdown-ib ifdown-ppp ifup-aliases ifup-ipv6 ifup-ppp init.ipv6- global ifcfg-eth0 ifcfg-usb0 ifdown-ippp ifdown-routes ifup-bnep ifup-isdn ifup-routes net.hotplug ifcfg-eth1 ifdown ifdown-ipv6 ifdown-sit ifup-eth ifup-plip ifup-sit network-functions ifcfg-eth2 ifdown-bnep ifdown-isdn ifdown-tunnel ifup-ib ifup-plusb ifup-tunnel network-functions-ipv6 ifcfg-eth3 ifdown-eth ifdown-post ifup ifup-ippp ifup-post ifup-wireless [root@kevin ~] # /etc/init.d/network restart ......

 

  报错说没有发现eth0和eth1网卡

 

  [root@kevin ~] # ipdown eth0

 

  报错提示说没有发现eth0网卡

 

  2)产生原因

 

  这是因为服务器更换了主板或网卡,mac地址改变所导致的。系统加载网卡驱动后会去读一个文件(即/etc/udev/rules.d/70-persistent-net.rules),这个文件是一个缓冲文件,包含了网卡的mac地址,因为更换了主板,网卡的mac地址也变了,但是这个文件的mac地址还没变,还是之前坏了的主板的上面的网卡的mac地址,这样系统在加载网卡,读取这个文件的时候读取的是之前网卡的mac地址,和现在更换后主板后的网卡mac地址不一致导致混乱,所以就识别不了当前网卡;

 

  3)解决办法

 

  一般来说,删除/etc/udev/rules.d/70-persistent-net.rules文件(或者把这个文件重新命名),重启服务器就可以解决了,重启后会重新生成这个文件,这样就顺利解决这个问题了!这里注意下,由于这台服务器绑定了网卡,所以重启网卡后,还需要进行modprobe命令使得网卡绑定生效,大致步骤如下:

 

  # mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.bak20180307 # init 6

 

  重启服务器后,查看/etc/udev/rules.d/70-persistent-net.rules文件,发现没有eth0、eth1、eth3、eth4的网卡信息(mac和设备名称)

 

  [root@kevin network-s] # 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. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. # pci device 0x14e4:0x1657 (tg3) subsystem== "net", action== "add", drivers== "?*", attr{address}== "****", attr{type}== "1", kernel== "eth*" # pci device 0x14e4:0x1657 (tg3) subsystem== "net", action== "add", drivers== "?*", attr{address}== "****", attr{type}== "1", kernel== "eth*" # pci device 0x14e4:0x1657 (tg3) subsystem== "net", action== "add", drivers== "?*", attr{address}== "****", attr{type}== "1", kernel== "eth*" # pci device 0x14e4:0x1657 (tg3) subsystem== "net", action== "add", drivers== "?*", attr{address}== "****", attr{type}== "1", kernel== "eth*"

 

  然后重启网卡等操作

 

  [root@kevin ~] # modprobe bonding [root@kevin ~] # /etc/init.d/network restart[root@kevin ~] # modprobe bonding 接着ifconfig查看,发现eth 0、eth1、eth2、eth3网卡设备都能识别了 [root@kevin ~] # ifconfig -a bond 0 link encap:ethernet hwaddr 08 : 94:ef : 5 e: ae: 72 inet addr: 192.168. 10.20 bcast: 192.168. 10.255 mask: 255.255. 255.0inet6 addr: fe80:: a94: efff: fe5e:ae72/ 64 scope:link up broadcast running master multicast mtu: 1500 metric: 1 rx packets: 108809 errors: 0 dropped: 0overruns: 0 frame: 0 tx packets: 84207 errors: 0 dropped: 0 overruns: 0 carrier: 0collisions: 0 txqueuelen: 0 rx bytes: 8471111 ( 8.0 mib) tx bytes: 6322341 ( 6.0 mib) eth 0 link encap:ethernet hwaddr 08 : 94 :ef : 5 e: ae: 72 up broadcast running slave multicast mtu: 1500 metric: 1 rx packets: 38051 errors: 0 dropped: 0overruns: 0 frame: 0 tx packets: 14301 errors: 0 dropped: 0 overruns: 0 carrier: 0collisions: 0 txqueuelen: 1000 rx bytes: 2869726 ( 2.7 mib) tx bytes: 944276 ( 922.1kib) interrupt: 16 eth1 link encap:ethernet hwaddr 08 : 94 :ef : 5 e: ae: 72 up broadcast running slave multicast mtu: 1500 metric: 1 rx packets: 69158errors: 0 dropped: 0 overruns: 0 frame: 0 tx packets: 68615 errors: 0 dropped: 0overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 rx bytes: 5469647 ( 5.2 mib) tx bytes: 5279012 ( 5.0 mib) interrupt: 17 eth2 link encap:ethernet hwaddr 08 : 94 :ef : 5e: ae: 74 broadcast multicast mtu: 1500 metric: 1 rx packets: 0 errors: 0dropped: 0 overruns: 0 frame: 0 tx packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0collisions: 0 txqueuelen: 1000 rx bytes: 0 ( 0. 0 b) tx bytes: 0 ( 0. 0 b) interrupt: 16 eth3 link encap:ethernet hwaddr 08 : 94 :ef : 5 e: ae: 75 broadcast multicast mtu:1500 metric: 1 rx packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0 tx packets: 0errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 rx bytes: 0 ( 0. 0b) tx bytes: 0 ( 0. 0 b) interrupt: 17 lo link encap:local loopback inet addr: 127.0. 0. 1mask: 255.0. 0. 0 inet6 addr: : : 1/ 128 scope:host up loopback running mtu:65536 metric: 1 rx packets: 26 errors: 0 dropped: 0 overruns: 0 frame: 0 tx packets: 26errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 rx bytes: 1983 ( 1.9kib) tx bytes: 1983 ( 1.9 kib) usb 0 link encap:ethernet hwaddr 0 a: 94 :ef : 5 e: ae:79 broadcast multicast mtu: 1500 metric: 1 rx packets: 0 errors: 0 dropped: 0overruns: 0 frame: 0 tx packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0txqueuelen: 1000 rx bytes: 0 ( 0. 0 b) tx bytes: 0 ( 0. 0 b)

  在查看/etc/udev/rules.d/70-persistent-net.rules文件,发现eth0、eth1、eth2、eth3网卡及其mac地址信息都有了

  [root@kevin ~] # 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. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. _cke_saved_name= key. # pci device 0x14e4:0x1657 (tg3)subsystem== "net", action== "add", drivers== "?*", attr{address}== "08:94:ef:5e:ae:75", attr{type}== "1", kernel== "eth*", name= "eth3" _cke_saved_name= "eth3" _cke_saved_name= "eth3" _cke_saved_name= "eth3" _cke_saved_name= "eth3" _cke_saved_name= "eth3" _cke_saved_name= "eth3" _cke_saved_name= "eth3" # pci device 0x14e4:0x1657 (tg3) subsystem== "net", action== "add", drivers== "?*", attr{address}== "08:94:ef:5e:ae:72", attr{type}== "1", kernel== "eth*", name= "eth0" _cke_saved_name= "eth0" _cke_saved_name= "eth0" _cke_saved_name= "eth0" _cke_saved_name= "eth0" _cke_saved_name= "eth0" _cke_saved_name= "eth0" _cke_saved_name= "eth0" # pci device 0x14e4:0x1657 (tg3) subsystem== "net", action== "add", drivers== "?*", attr{address}== "08:94:ef:5e:ae:73", attr{type}== "1", kernel== "eth*", name= "eth1" _cke_saved_name= "eth1" _cke_saved_name= "eth1" _cke_saved_name= "eth1" _cke_saved_name= "eth1" _cke_saved_name= "eth1" _cke_saved_name= "eth1" _cke_saved_name= "eth1" # pci device 0x14e4:0x1657 (tg3) subsystem== "net", action== "add", drivers== "?*", attr{address}== "08:94:ef:5e:ae:74", attr{type}== "1", kernel== "eth*", name= "eth2" _cke_saved_name= "eth2" _cke_saved_name= "eth2" _cke_saved_name= "eth2" _cke_saved_name= "eth2" _cke_saved_name= "eth2" _cke_saved_name= "eth2" _cke_saved_name= "eth2"

 

  接着尝试ping其他机器

 

  [root@kevin ~] # ping 192.168.10.23 ping 192.168 .10 .23 ( 192.168 .10 .23) 56( 84) bytes of data. 64 bytes from 192.168 .10 .23: icmp_seq= 1 ttl= 64 time= 0.030 ms 64bytes from 192.168 .10 .23: icmp_seq= 2 ttl= 64 time= 0.016 ms 64 bytes from 192.168.10 .23: icmp_seq= 3 ttl= 64 time= 0.016 ms

 

  如果ping不通的话,多执行下面命令

 

  [root@kevin ~] # modprobe bonding

相关产品

暂时没有内容信息显示
请先在网站后台添加数据记录。

相关附件

暂时没有内容信息显示
请先在网站后台添加数据记录。