搜索
查看: 1280|: 0

centos6下KVM安装及虚机网卡问题解决

[复制链接]

183

主题

8

回帖

820

积分

高级会员

积分
820
发表于 2014-8-15 15:13:14 | 显示全部楼层 |阅读模式
The kernel component of KVM is included in mainline Linux, as of 2.6.20.

1、查看系统是否硬件虚拟化
# egrep 'vmx|svm' /proc/cpuinfo

2. 安装KVM及其组件
yum -y install qemu-kvm libvirt python-virtinst bridge-utils virt-manager
yum groupinstall Virtualization
yum groupinstall "Virtualization Platform"

# lsmod | grep kvm

# /etc/init.d/libvirtd restart

创建桥接
cp ifcfg-eth0 ifcfg-br0

# cat ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:1d:09:66:e1:f8
IPV6INIT=no
MTU=1500
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
UUID="dacbb334-5792-4969-889a-907245adbd80"
IPADDR=192.168.100.210
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
DNS1=8.8.8.8
USERCTL=no
BRIDGE=br0 ###添加关键一行

# cat ifcfg-br0
DEVICE=br0 ###修改关键行
BOOTPROTO=none
HWADDR=00:1d:09:66:e1:f8
IPV6INIT=no
MTU=1500
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Bridge ###修改关键行
UUID="dacbb334-5792-4969-889a-907245adbd80"
IPADDR=192.168.100.210
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
DNS1=8.8.8.8
USERCTL=no

问题:
使用kvm克隆的虚机把源机的mac地址也一并复制了,在启动克隆机时,网卡无法激活,提示如下:
device eth0 does not seem to be present,delaying initialization

原因:因mac地址重复,克隆机把eth0重命名成eth1了
解决:
1、列出识别的当前网卡列表
# ls /sys/class/net
eth1 lo

2、删除第一条SUBSYSTEM,把原第二条SUBSYSTEM的NAME="eth1"修改为NAME="eth0"
#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 0x15ad:0x07b0 (vmxnet3) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

3、修改网卡eth0的配置文件的mac地址HWADDR为修改后70-persistent-net.rules中的mac地址
#vim /etc/sysconfig/network-scripts/ifcfg-eth0

4、reboot.

参考:http://www.ryanchapin.com/fv-b-4 ... ing-initialization-

quot--Error-.html

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

大数据中国微信

QQ   

版权所有: Discuz! © 2001-2013 大数据.

GMT+8, 2024-12-24 01:52 , Processed in 0.055884 second(s), 25 queries .

快速回复 返回顶部 返回列表