環境:centos6.4 python
eth0--->接公司網絡,用於遠程鏈接操做vim
eth1--->接adsl撥號,單號多撥centos
kvm安裝網絡
yum install kvm virt-manager libvirt libvirt-python python-virtinst libvirt-client virt-viewer -yide
啓動libvirtd服務orm
service libvirtd startip
檢查是否安裝kvm虛擬機
lsmod | grep kvmit
kvm_intel 45674 0 io
kvm 291811 1 kvm_intel
配置橋接網絡br0
vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE="br0"
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=dhcp
STP=on
DELAY=0
配置eth1
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED="no"
配置eth0
DEVICE="eth0"
BOOTPROTO="static"
ONBOOT=yes
IPADDR=192.168.3.3
GATEWAY=192.168.3.254
HWADDR="00:25:90:AF:A0:28"
NM_CONTROLLED="no"
TYPE="Ethernet"
UUID="1e9d5a81-d216-4172-96ec-edffb99427f7"
更改img存放路徑
查看卷的信息
virsh vol-info --pool kvm_p_w_picpathsguest1-rhel6.1
創建存儲池的目錄
mkdir /kvm/p_w_picpaths
定義一個存儲池
virsh pool-define-as kvm_p_w_picpaths dir - - - - "/kvm/p_w_picpaths"
查看建立的存儲池信息
virsh pool-list --all
使存儲池生效
virsh pool-start kvm_p_w_picpaths
存儲池自動運行
virsh pool-autostart kvm_p_w_picpaths
驗證存儲池
virsh pool-info kvm_p_w_picpaths
創建虛擬磁盤
virsh vol-create-as kvm_p_w_picpaths winser2010.img 50G --formatqcow2
命令建立虛擬機
virt-install --name winser2010 --ram 2048 --vcpus=1 --os-variant=win2k8 --accelerate --cdrom=/opt/iso/winser2010.iso --disk path=/kvm/p_w_picpaths/winser2010.img,size=10,format=qcow2,bus=virtio --bridge=br0,model=virtio --vnc --vncport=5991 --vnclisten=0.0.0.0