您的位置:首页 > 其它

网卡名字eth0,eth1的修改方法

2014-06-06 11:15 766 查看
网卡 虚拟机 配置文件 eth0
http://longwind.blog.51cto.com/419072/982738

VMWARE安装虚拟机后,为了避免重新安装,一般会选择直接复制虚拟机,但当打开心得拷贝后网卡信息会变化,原来是eth0 eth1 就会变成eth2 eth3,如果不想使用eth2 eth3下面的方法就可以更改网卡名称。CentOS为例 1.使用ip link 命令 ip link set eth0 name eth2
ip link set eth1 name eth0
ip link set eth2 name eth1 即可随意更改名字,不过重启后会失效。 2.更改配置文件(重启不会失效) 直接可以在modprobe 中修改模块别名,如使用udev的情况下,  
# vi /etc/udev/rules.d/70-persistent-net.rules  
 
其中会有  
# PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)  
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:42:e7:61", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" 
 
# PCI device 0x8086:0x100f (e1000)  
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:42:e7:66", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" 
 
# PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)  
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:42:e7:6c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2" 
 
# PCI device 0x8086:0x100f (e1000)  
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:42:e7:76", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3" 
  为了避免MAC地址和其他虚拟机重复,我们可以选择更改下MAC地址,然后将eth0 eth1两行注释掉,将最后两行中的eth2 和eth3更改为eht0 和 eth1 。 完成后重启,就会发现虚拟机网卡又变成eth0和eth1了。     本文出自 “longWind” 博客,请务必保留此出处http://longwind.blog.51cto.com/419072/982738
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: