yum install virt-manager libvirt libvirt-python python-virtinst libvirt-client virt-install bridge-utils
创建网桥
/etc/sysconfig/network-scripts/ifcfg-br0 TYPE=Bridge BOOTPROTO=static IPV6INIT=no NAME=br0 DEVICE=br0 ONBOOT=yes NM_Controlled=no IPADDR=192.168.1.2 NETMASK=255.255.255.0 GATEWAY=192.168.1.1
修改实体网卡,通过网桥联网
/etc/sysconfig/network-scripts/ifcfg-em1 TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no NAME=em1 DEVICE=em1 ONBOOT=yes BRIDGE=br0
重启网络
service network restart
创建虚拟机
virt-install --name master \ --memory 8192 \ --vcpus 4 \ --cpu host \ --location /data/kvm/CentOS-7-x86_64-DVD-1810.iso \ --disk /data/kvm/openstack-master/centos7.img,size=200,format=raw \ --network bridge=br0 \ --os-type=linux --os-variant=rhel7.3 \ --virt-type kvm \ --graphics none \ --extra-args='console=ttyS0' \ --force
克隆虚拟机
virt-clone -o master -n node1 -f /data/kvm/node1/node1