在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通,就表示配置成功~

最新文章

  1. UltralEdit 替换tips
  2. PHP用星号隐藏部份用户名、身份证、IP、手机号等实例
  3. jar包目录下MANIFEST.MF标准格式
  4. Appium 服务器参数
  5. 在 Angular 中实现搜索关键字高亮
  6. PreferenceActivity使用方法
  7. iOS - 提示信息 - UIAlertView、UIActionSheet、UIAlertController的实际应用
  8. Getting Started with Zend Framework MVC Applications
  9. XML前言
  10. Ionic 测试针对Andorid平台
  11. 【Nginx】磁盘文件写入飞地发
  12. top使用命令
  13. Linux 文件读写操作与磁盘挂载
  14. 前端需要了解的HTTP协议
  15. php 关于laravel5.7框架
  16. 6.05-btc
  17. (计算几何基础 叉积) nyoj68-三点顺序
  18. Thymeleaf在IDEA中的使用
  19. unity3d-游戏实战突出重围,第二天 制作血条
  20. centos 虚拟机中最小化安装,无法上网的解决方法

热门文章

  1. C++#define的用法(含特殊)
  2. 开发环境配置--Ubuntu+Qt4+OpenCV(三)
  3. javascript中this,call,apply详解
  4. html5介绍
  5. logstash 操作redis
  6. MySQL必知必会 学习笔记(一)
  7. c++适配器模式
  8. windows 环境怎样恢复 (oracle 11g grid) ocr voting 损坏的集群
  9. 利用分布类防止EF更新模型丢失验证信息
  10. JS onkeydown控制HTML Input 只录入浮点数值