美图欣赏 | 设为首页 | 加入收藏 | 网站地图

当前位置:电脑中国 > 网络 > 虚拟技术 > 虚拟机 >

Linux 复制虚拟机

2017-08-24 10:46|来源:未知 |作者:dnzg |点击:

1. 在visual box直接点击右键复制,注意要重新初始化网卡


2. 修改hostname

vi /etc/sysconfig/network


3. 修改网卡信息和IP地址

直接修改IP地址会导致错误: Device eth0 does not seem to be present, 所以要按一下步骤执行:
首先,打开/etc/udev/rules.d/70-persistent-net.rules内容如下面例子所示:

?
1
2
3
4
5
6
7
8
9
10
11
12
# vi /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 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:9
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:1
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

记录下,eth1网卡的mac地址00:0c:29:50:bd:17
接下来,打开/etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/sysconfig/network-scripts/ifcfg-eth0
将 DEVICE=”eth0” 改成 DEVICE=”eth1” ,
将 HWADDR=”00:0c:29:8f:89:97” 改成上面的mac地址 HWADDR=”00:0c:29:50:bd:17”
最后,重启网络
service network restart


4. 修改hosts文件

vi /etc/hosts

(责任编辑:dnzg)