虚拟机克隆的服务器怎么改mac地址,Centos6克隆虚拟机改IP和mac地址

1.生成新的MAC地址

2.查看ip

[root@localhost ~]# ifconfig

eth1 Link encap:Ethernet HWaddr 00:50:56:23:B0:4F

inet addr:192.168.146.130 Bcast:192.168.146.255 Mask:255.255.255.0

inet6 addr: fe80::250:56ff:fe23:b04f/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:121 errors:0 dropped:0 overruns:0 frame:0

TX packets:54 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:10975 (10.7 KiB) TX bytes:6571 (6.4 KiB)

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:16 errors:0 dropped:0 overruns:0 frame:0

TX packets:16 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:940 (940.0 b) TX bytes:940 (940.0 b)

[root@localhost ~]#

3.使用vim /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 0x8086:0x100f (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:31:32:0e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:23:b0:4f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

~

~

4.根据ifconfig查看HWaddr 00:50:56:23:B0:4F除外的删除,就是还剩下的,(注:你们根据你们自己的定)

# 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:50:56:23:b0:4f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

~

5.使用vim /etc/sysconfig/network-scripts/ifcfg-eth0修改成下面

[root@localhost ~]# cd /

[root@localhost /]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"

BOOTPROTO="dhcp"

HWADDR="00:50:56:23:B0:4F"

IPV6INIT="yes"

NM_CONTROLLED="yes"

ONBOOT="yes"

TYPE="Ethernet"

UUID="2dbea590-a659-4e94-9626-f5f59dacde22"

IPADDR="192.168.146.130"

NETMASK="255.255.255.0"

GATEWAY="192.168.146.1"

6.service network restart重启网络

[root@localhost /]# service network restart

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: [ OK ]

Bringing up interface eth0: Active connection state: activating

Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1

state: activated

Connection activated

[ OK ]

[root@localhost /]#

这样就可以了

# 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:50:56:23:b0:4f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

~

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值