码迷,mamicode.com
首页 > 其他好文 > 详细

【基础设置】修改网卡设备名称

时间:2014-11-03 16:35:54      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:address   虚拟机   网卡   

vm使用克隆出来的虚拟机,网卡名称变成eth1,要把这个eth1改成eth0,参照如下步骤:

  1. 查看eth1对应的mac地址

    ifconfig

    如:eth1:00:0C:29:74:F2:99

  2. 修改/etc/sysconfig/network-scripts/ifcfg-eth0的mac地址为eth1的mac地址

    由于vm克隆过来,network-scripts目录下没有eth1的文件,目录下有一个ifcfg-eth0,修改如下:

hwaddr由原来的mac改成eth1的mac,保存。

DEVICE=eth0

HWADDR=00:0C:29:74:F2:99

ONBOOT=yes

IPADDR=192.168.198.10

BOOTPROTO=none

NETMASK=255.255.255.0

TYPE=Ethernet

GATEWAY=192.198.198.2

    

3. 修改/etc/udev/rules.d/70-persistent-net.rules文件


attr{address} 与 name两个字段


[root@nginx rules.d]# cat 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:55:61:94", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


# PCI device 0x1022:0x2000 (pcnet32)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:74:f2:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

[root@nginx rules.d]# 


4. 重启系统

本文出自 “尽管错,让我错到死!” 博客,请务必保留此出处http://hxw168.blog.51cto.com/8718136/1571255

【基础设置】修改网卡设备名称

标签:address   虚拟机   网卡   

原文地址:http://hxw168.blog.51cto.com/8718136/1571255

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!