KVM虚拟机创建、桥接、千兆网卡设置

[创建虚拟机]
virt-install --name test02 --ram 4096 --vcpus=2 --disk path=/data/vps/test02.img,size=100 --accelerate --cdrom /opt/CentOS-5.8-x86_64-bin-DVD-1of2.iso --graphics vnc
#开启
virsh start test01
[修改虚拟机网卡]
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=52:54:00:9C:19:EB
NM_CONTROLLED=yes
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.251
NETMASK=255.255.255.0
DHCP_HOSTNAME=test02.test.com
[修改虚拟机网络模式]
vim test.xml
<interface type='bridge'>
      <mac address='52:54:00:2c:db:4a'/>
      <source bridge='br0'/>
      <model type='virtio'/>
    </interface>
#配置文件修改后生效   
virsh list
virsh destroy test02
virsh define /etc/libvirt/qemu/test02.xml
virsh start test02
       
#将宿主机IP加为网关
route add -net 0.0.0.0 gw 192.168.0.199

 

 

#若安装系统为win2003,创建成功虚拟后,需更改配置(将光盘加载入光驱)后,重启系统才可以正常安装

virt-install --name ghvps02 --ram 8192 --vcpus=4 --disk path=/data/vps/ghvps02.img,size=100 --accelerate --cdrom /opt/win2003.iso --graphics vnc

virsh destroy ghvps02

 

vim /etc/libvirt/qemu/ghvps02.xml

 <disk type='file' device='cdrom'>

      <driver name='qemu' type='raw'/>

      <source file='/opt/win2003.iso'/>

      <target dev='hdc' bus='ide'/>

      <readonly/>

      <address type='drive' controller='0' bus='1' unit='0'/>

    </disk>

<interface type='bridge'>

      <mac address='52:54:00:fc:ad:15'/>

      <source bridge='br0'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

    </interface>

virsh define /etc/libvirt/qemu/ghvps02.xml

virsh start ghvps02

 

你可能感兴趣的:(kvm,Win2003,虚拟化)