|
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
|
|