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