前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住给大家分享一下。点击跳转到网站:https://www.captainai.net/dongkelun
前言
记录一下vmware如何克隆一个虚拟机,并解决克隆的centos7虚拟机遇到的网络问题
克隆方法
右键点击要克隆的虚拟机->管理->克隆,然后下一步->下一步,克隆类型选择创建完整克隆->输入虚拟机名称,选择位置,点击完成,然后等待一直到完成
开启虚拟机
输入用户名、密码,和之前被克隆的用户名密码一样
修改克隆后的ip
因为之前我设置的固定ip(vmware centos7 设置固定ip),所以克隆后的ip和我之前设置的固定ip一致,这样会冲突,需要修改
不修改的话ip会随机生成,并且每次都可能不一样,不重启虚拟机ip也会主动变化
1 | vi /etc/sysconfig/network-scripts/ifcfg-eno16777736 |
重启网络
1 | service network restart |
然后发现重启失败1
2
3[root@master ~]# service network restart
Restarting network (via systemctl): Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details.
[FAILED]
查看网络状态也是失败的1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17root@master ~]# systemctl status network
network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network)
Active: failed (Result: exit-code) since Mon 2020-10-26 17:07:57 CST; 1min 17s ago
Process: 2257 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
Process: 2421 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Oct 26 17:07:57 master network[2421]: Bringing up loopback interface: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Oct 26 17:07:57 master network[2421]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Oct 26 17:07:57 master network[2421]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Oct 26 17:07:57 master network[2421]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Oct 26 17:07:57 master network[2421]: [ OK ]
Oct 26 17:07:57 master network[2421]: Bringing up interface eno16777736: Error: no device found for connection 'eno16777736'.
Oct 26 17:07:57 master network[2421]: [FAILED]
Oct 26 17:07:57 master systemd[1]: network.service: control process exited, code=exited status=1
Oct 26 17:07:57 master systemd[1]: Failed to start LSB: Bring up/down networking.
Oct 26 17:07:57 master systemd[1]: Unit network.service entered failed state.
异常解决
修改mac地址
查看mac地址
1 | [root@master ~]# ip addr |
link/ether和brd之间的00:0c:29:19:34:5c就是我们要复制的新mac地址
修改
1 | vi /etc/sysconfig/network-scripts/ifcfg-eno16777736 |
然后重启网络
1 | [root@master ~]# service network restart |
重启虚拟机
重启网络,用ifconfig 查看ip地址并没有改变为我们修改的192.168.44.129,重启一下虚拟机,再查看一下就会发现生效了