zoukankan      html  css  js  c++  java
  • 虚拟机 克隆 设置固定ip eth0 不存在 service network restart失败

    前言很重要:

    1)如果你看来网上很多设置固定ip的资料,依然没有成功;

    2)如果你虚拟机是克隆的,如果你重启网络报错:Bringing up interface eth0:  Error: No suitable device found: no device found for connection 'System eth0'.

    3)如果你没有eth0 那么你很可能来对地方了
    解决问题:1)设置固定ip,2)克隆的虚拟机重启网络service network restart 报错

    步骤:

    1. ifconfig -a  查看你的网络配置信息,你发现没有eth0

    eth2      Link encap:Ethernet  HWaddr 00:0C:29:76:85:48  
              inet addr:192.168.137.100  Bcast:192.168.137.255  Mask:255.255.255.0
              inet6 addr: fe80::20c:29ff:fe76:8548/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:9 errors:0 dropped:0 overruns:0 frame:0
              TX packets:74 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:2798 (2.7 KiB)  TX bytes:5724 (5.5 KiB)

    eth3      Link encap:Ethernet  HWaddr 00:0C:29:76:85:3E  
              inet6 addr: fe80::20c:29ff:fe76:853e/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:688 errors:0 dropped:0 overruns:0 frame:0
              TX packets:407 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:215826 (210.7 KiB)  TX bytes:137610 (134.3 KiB)

    2.cat /etc/udev/rules.d/70-persistent-net.rules    这里存放了你ifcfg-eth*  文件的某些信息,显示如下信息

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b4:00:4f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

    # PCI device 0x8086:0x100f (e1000)

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b4:00:59", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

    # PCI device 0x8086:0x100f (e1000)

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:76:85:48", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

    # PCI device 0x8086:0x100f (e1000)

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:76:85:3e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

    3.vim /etc/sysconfig/network-scripts

    然后 ll -a 命令看看有eth*  *号代表数字,因为是克隆,得到所以有eth0,vim ifcfg-eth0,前提是你知道 ifcfg-eth0内容的意思不懂的去查,网上满大街,内容vim打开如下

    DEVICE="eth0"              需要改
    BOOTPROTO="static"  
    IPADDR=192.168.137.100
    NETMASK=255.255.255.0
    HWADDR="00:0c:29:76:85:48"                            这里对于上面的 ATTR{address}需要改
    IPV6INIT="no"
    NM_CONTROLLED="yes"
    ONBOOT="yes"
    TYPE="Ethernet"
    #UUID="3d52ccab-7580-4c0c-8758-3c04e739b0a0"
    因为你只有eth2,所以需要将eth0改成eth2,   复制eth0 文件得到eth2,在同路径下 cp ifcfg-eth0  ifcfg-eth2,编辑ifcfg-eth2,将eth0改成eth2,HWADDR该对于的根据内容:

    cat /etc/udev/rules.d/70-persistent-net.rules 

    保存修改内容之后  service network restart,你应该会发现没有报错了,一路的ok提示,重启虚拟机发现 查看ip发现成功了  。

    注明:可以有不写错的命令,时间太匆忙,没有检查,请谅解,理解意思是关键,qq 1195748675 我q

  • 相关阅读:
    [算法]外部排序
    [笔试]华为编程大赛题目
    [C++]字符串处理方法(STL与C风格)
    如何动态建立VFP能够打开的中文字段 dbf 表 北极星
    使用 VCL BDE 组件动态创建数据库表 北极星
    如何用Table控件判断数据库是否为空 北极星
    DNGuard HVM副产品(元数据名称编辑器)
    常见dotNet加密保护工具分析介绍
    DNGuard HVM 试用版 RC1 发布
    [转载]Modifying IL at runtime
  • 原文地址:https://www.cnblogs.com/longsanshi/p/7153409.html
Copyright © 2011-2022 走看看