kvm安装和网桥配置

1.查看机器是否支持虚拟化
egrep 'vmx|svm' --color=always /proc/cpuinfo
grep -E 'vmx|svm' /proc/cpuinfo
egrep "vmx |svm" /proc/cpuinfo
2 进入bios,cpu设置,开启虚拟技术支持
3 安装kvm
yum -y install kvm
4 安装额外的虚拟化管理软件
yum -y install virt-manager libvirt libvirt-python python-virtinst
5 查看kvm是否安装成功
#modprobe kvm
#modprobe kvm-amd
#modprobe kvm-intel
(1)lsmod|grep kvm

kvm-intel          86248  3
kvm                 223264  1 kvm_intel

(2)stat /dev/kvm

6配置网络
cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 baketh0
cp ifcfg-eth0 ifcfg-br0



静态
vi ifcfg-eth0

DEVICE=eth0 
TYPE=Ethernet
HWADDR=00:14:5E:C2:1E:40 
ONBOOT=yes 
NM_CONTROLLED=no
BRIDGE=br0

 

vi ifcfg-br0

DEVICE=br0
TYPE=Bridge
NM_CONTROLLED=no
BOOTPROTO=static 
IPADDR=192.168.1.33 
NETMASK=255.255.255.0 
GATEWAY=192.168.1.1
ONBOOT=yes  


动态
vi ifcfg-eth0

DEVICE=eth0 
TYPE=Ethernet
HWADDR=00:14:5E:C2:1E:40 
ONBOOT=yes 
NM_CONTROLLED=no
BRIDGE=br0

 

vi ifcfg-br0

DEVICE=br0
TYPE=Bridge
NM_CONTROLLED=no 
BOOTPROTO=dhcp
ONBOOT=yes 

service network restart

查看网桥

    brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.00e0b6047dcc       no              eth0
virbr0          8000.525400e56f63       yes             virbr0-nic