Centos6克隆虚拟机改IP和mac地址

1.生成新的MAC地址

 

 

2.查看ip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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除外的删除,就是还剩下的,(注:你们根据你们自己的定

1
2
3
4
5
6
7
8
9
10
# 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  修改成下面

1
2
3
4
5
6
7
8
9
10
11
12
13
[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 重启网络

1
2
3
4
5
6
7
8
9
[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"

~

 

posted @   Amy清风  阅读(617)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示