Modify files according to your actual situation, here only record my work environment; 1, install the system required file yum-yinstallkvmkmod-kvmkvm-qemu-imgyum-yinstallbridge-utilstunctl2, create ifcf-br0 file vi/etc/sysconfig/network-scripts/ifcfg-br0DEVICE = br0HWADDR = F4: 6D: 04: 40
Modify the file according to your actual situation, and only record your work environment here;
1. files required for installing the system
Yum-y install kvm kmod-kvm-qemu-img
Yum-y install bridge-utils tunctl
2, create the ifcf-br0 file vi/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE = br0
HWADDR = F4: 6D: 04: 40: 90: 47
TYPE = Bridge
IPADDR = 192.168.1.22
NETMASK = 255.255.255.0
ONBOOT = yes
NM_CONTROLLED = no
3, modify the system Nic configuration file ifcfg-eth3, the modification content is as follows:
DEVICE = eth3
HWADDR = F4: 6D: 04: 40: 90: 47
ONBOOT = yes
BRIDGE = br0
NM_CONTROLLED = no
4. modify/etc/qemu-ifup
#! /Bin/sh
Set-x
Bridge = br0
Interface = $1
/Sbin/ip link set $ interface up
/Usr/sbin/brctl addif $ bridge $ interface
5. modify/etc/qemu-ifdown.
#! /Bin/sh
Set-x
Bridge = br0
Interface = $1
Ifconfig $ interface down
Tunctl-d $ interface
6,/etc/init. d/network restart
If the configuration is normal, after connecting the device
1. create a virtual machine
Qemu-img create-f qcow2 linux-6-x86_64.img 10G
2. install virtual machines
/Usr/libexec/qemu-kvm? M 1024-hda. /linux-6-x86_64.img-localtime-net nic, macaddr = DE: AD: BE: EF: F0: 01-net tap-cdrom/opt/release/centos-6-x86_64-CD.iso-boot d-vnc: 1
3. run the VM
/Usr/libexec/qemu-kvm-m 1024-hda. /linux-6-x86_64.img-localtime-net nic, macaddr = DE: AD: BE: EF: F0: 01-net tap-vnc: 1