重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1303|回复: 1

vmware中,如何修改网卡的名字

  [复制链接]
发表于 2015-11-3 22:58:40 | 显示全部楼层 |阅读模式
在使用vmware 做rac的过程中,安装了第一台机器后,再安装另一台机器时,一般可以通过拷贝前一台机器的方式来完成,
但我们拷贝过来后,发现网卡的名字不一样了,比如第一台机器的网卡为 eth0,eth1,但发现拷贝过来后,网卡名字为eth1,eth2了,
如果通过删除网卡,再增加网卡的方式,发现网卡一直在往前面增长,如下:
869805638c95fc0863.png

221965638c97b39238.png

比如上面,复制后,变成eth4,eth5了,这个时候如何处理呢?

其实,在/etc/udev/rules.d/70-persistent-net.rules中,有这个记录:

[root@rac1 rules.d]# pwd
/etc/udev/rules.d
[root@rac1 rules.d]# more 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 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:20:dd:f2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:20:dd:fc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d1:a3:8f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d1:a3:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:23:de:d9", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:39:df:1e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"
[root@rac1 rules.d]#



把前面的部分删除,只留最后两行,同时修改NAME

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:23:de:d9", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:39:df:1e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

之后,重启机器,再查看,

我们将看到网卡名字已经变了

870775638cb9baa737.png
回复

使用道具 举报

发表于 2016-8-27 10:30:44 | 显示全部楼层
cd /etc/udev/rules.d
60-net.rules(RHEL5)
70-persistent-net.rules (RHEL 6)
RHEL 5和6有略微的区别
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2020-3-31 00:01 , Processed in 0.150090 second(s), 35 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表