Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6847239
  • 博文数量: 3857
  • 博客积分: 6409
  • 博客等级: 准将
  • 技术积分: 15948
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-02 16:48
个人简介

迷彩 潜伏 隐蔽 伪装

文章分类

全部博文(3857)

文章存档

2017年(5)

2016年(63)

2015年(927)

2014年(677)

2013年(807)

2012年(1241)

2011年(67)

2010年(7)

2009年(36)

2008年(28)

分类: 网络与安全

2015-05-27 08:40:02

Linux的虚拟机拷贝到另外的操作系统时,NAT方式的静态IP无效,一直是获取的DHCP动态地址

[日期:2015-05-27] 来源:Linux社区  作者:bluejavababy [字体:  ]

 

一、问题:

 

1、Linux虚拟机在A机的虚拟机中是NAT方式DHCP动态获取IP,设置了静态地址,IP地址不会发生变化,但是拷贝到B机上的虚拟机后,一直获取的时动态IP地址,无法得到静态IP。
2、执行/etc/init.d/network restart报错:
[root@master init.d]#./network restart
正在关闭接口 ens33:错误:[/etc/sysconfig/network-scripts/ifdown-eth]设备具有 MAC 地址00:00:00:00:00:00
00:0C:29:94:8E:A2,而不是配置的地址00:0C:29:8B:9A:F2。忽略。
[失败]
正在关闭环回接口:Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
[确定]
正在打开环回接口:Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
[确定]
正在打开接口 ens33:错误:没有找到可用于连接'ens33'的设备。
[失败]
3、执行 systemctl restart network报错:
Jobfor network.service failed.See"systemctl status network.service" and "journalctl -xe"for details.
4、执行journalctl -xe报错:
5月2600:29:28 master /etc/sysconfig/network-scripts/ifdown-eth[1350]:设备具有 MAC 地址00:00:00:00:00:00
00:0C:29:94:8E:A2,而不是配置的地址00:0C:29:8B:9A:F2。忽略。
5月2600:29:28 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:29:28 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:29:28 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:29:28 master NetworkManager[709]:(lo): link disconnected
5月2600:29:28 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:29:28 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:29:28 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:29:28 master NetworkManager[709]:(lo): link connected
5月2600:29:29 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:29:29 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:30:39 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:40 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:40 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:41 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:41 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:41 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:41 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:41 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:41 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:42 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:42 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:42 master systemd[1]:Configuration file /usr/lib/systemd/system/tog-pegasus.service is marked world-inaccessible.This has no effect as configuration data is acce
5月2600:30:53 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:30:53 master network[1685]:正在打开环回接口:Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
5月2600:30:53 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:30:53 master network[1685]:Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
5月2600:30:53 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:30:53 master network[1685]:Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
5月2600:30:53 master NetworkManager[709]: parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
5月2600:30:53 master network[1685]:Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
5月2600:30:54 master network[1685]:[确定]
5月2600:30:54 master network[1685]:正在打开接口 ens33:错误:没有找到可用于连接'ens33'的设备。
5月2600:30:54 master network[1685]:[失败]
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master network[1685]: RTNETLINK answers:File exists
5月2600:30:54 master systemd[1]: network.service: control process exited, code=exited status=1
5月2600:30:54 master systemd[1]:Failed to start LSB:Bring up/down networking.
--Subject:Unit network.service has failed
--Defined-By: systemd
--Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
--Unit network.service has failed.
--
--The result is failed.
5月2600:30:54 master systemd[1]:Unit network.service entered failed state.
5月2600:30:54 master systemd[1]: network.service failed.
二、解决:

 

Linux虚拟机从A拷贝到B后,MAC地址发生改变,但是配置文件中并没有同步修改,导致此问题。

1、首先执行ifconfig查看新的MAC地址:
ens33: flags=4163 mtu 1500
inet 192.168.130.109 netmask 255.255.255.0 broadcast 192.168.130.255
inet6 fe80::20c:29ff:fe94:8ea2 prefixlen 64 scopeid 0x20
ether 00:0c:29:94:8e:a2 txqueuelen 1000(Ethernet)
RX packets 550 bytes 48524(47.3KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 604 bytes 94343(92.1KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 0(LocalLoopback)
RX packets 8 bytes 800(800.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 800(800.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
可以看出ens33网卡对应的MAC地址为:00:0c:29:94:8e:a2,即ether对应的地址。

2、修改ens33网卡对应的MAC地址
vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME="ens33"
UUID="707084bc-d3aa-483f-878b-c93e6abf4a07"
ONBOOT="yes"
HWADDR="00:0C:29:8B:9A:F2"
BOOTPROTO="static"
NM_CONTROLLED="yes"
IPADDR="192.168.130.101"
NETMASK="255.255.255.0"
GATEWAY="192.168.130.2"

将HWADDR改为00:0c:29:94:8e:a2即可。

本文永久更新链接地址

阅读(1109) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~