Oracle 克隆的网卡,VirtualBox中因克隆系统而需修改网卡名

CentOS-6.4-x86_64系统

在VirtualBox中克隆系统时如果勾选了Reinitialize the MAC address of all network cards 的话,克隆的系统会产生新的MAC地址,但是网卡名子会是以前的,这样会出现问题,这时需要修改网卡名。

1、编辑配置文件:vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0                                   -- 将网卡名改为eth0

#HWADDR=08:00:27:42:7A:AA       -- 如果开启一个网卡的话,这个可以注释掉,如果开启两个网卡的话需要写MAC地址

TYPE=Ethernet

#UUID=6d029e26-c0d6-4d2c-8f15-6c7dc013d364

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=static

IPADDR=10.10.54.97                   --修改IP地址

GATEWAY=10.10.54.254

NETMASK=255.255.255.0

---- 修改必要的参数

2、修改网卡文件: vim /etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:6d:58:09", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"        --注释掉

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:2f:9a:8a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"         --注释掉

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:9c:10:d4", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"       --将eth2改为eth0

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:e9:30:b3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"    -- 将eth3改为eth1

修改完后的结果:

#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:6d:58:09", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100e (e1000)

#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:2f:9a:8a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:9c:10:d4", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:e9:30:b3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

如果开启两个网卡的话,我们需要将这个文件中的MAC地址记录下来,写进/etc/sysconfig/network-scripts/ifcfg-eth0/1 中

重启网络服务

另一种解决方法:直接将/etc/udev/rules.d/70-persistent-net.rules删除掉,重启电脑后会产生一个新的这个文件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值