zoukankan      html  css  js  c++  java
  • Vmware 克隆CentOS 网络IP配置

    在VMware里克隆出来的CentOS Linux。。

    ifconfig...没有看到eth0.。然后重启网卡又报下面错误。

    故障现象:

    service network restart
    Shutting down loopback insterface:                                                                                                     [  OK  ]
    Bringing up loopback insterface:                                                                                                          [  OK  ]
    Bringing up interface eth0:  Device eth0 does not seem to be present,delaying initialization.                    [FAILED]

    解决办法:

    1.查看新添加的网卡的MAC
    方法1:打开/etc/udev/rules.d/70-persistent-net.rules内容如下面例子所示:

    # vi /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 0x1022:0x2000 (pcnet32)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:9
    7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    # PCI device 0x1022:0x2000 (pcnet32)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:1
    7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

    记录下,eth1网卡的mac地址00:0c:29:50:bd:17

    方法2:

    编辑虚拟机,查看网络适配器,虚拟机部署完成都会生成一个MAC.



    2. 接下来,打开/etc/sysconfig/network-scripts/ifcfg-eth0

    # vi /etc/sysconfig/network-scripts/ifcfg-eth0

    将 DEVICE="eth0"  改成  DEVICE="eth1"  ,
    将 HWADDR="00:0c:29:8f:89:97" 改成上面的mac地址  HWADDR="00:0c:29:50:bd:17"

    3. 最后,重启网络

    # service network restart
    或者

    # /etc/init.d/network restart

    正常了

    特殊情况下,需要网关不在同一个网段,需要做下面的操作:

    vim /etc/rc.local

    route add -host 10.34.52.1 eth2                 #添加静态路由

    route add default gw 10.34.52.1

    保存后退出。重启机器。

    开机后,可使用route 命令查看默认网关是否配置成功。

    ping 网关可以正常ping通,就表示配置成功~

  • 相关阅读:
    目录结构
    RabbitMQ 将监听的IP从localhost修改为指定IP
    概念
    RabbitMQ 基础概念
    修改shell提示符的显示格式
    VIM常用设置
    RabbitMQ 开启WEB管理
    用pecl/pear独立编译PHP扩展 vs. 把扩展编译到PHP内核中
    安装composer
    安装php-amqplib(RabbitMQ的phpAPI)
  • 原文地址:https://www.cnblogs.com/yu2000/p/3784534.html
Copyright © 2011-2022 走看看