Skip to content

在 Ubuntu 12.04 LTS 使用KVM

Published: at 00:00
检查是否开启CPU虚拟化
cat /proc/cpuinfo | egrep "(vmx|svm)" --color=always
设置转发
sed -i 's/^\(net.ipv4.ip_forward =\).*/\1 1/' /etc/sysctl.conf; sysctl -p
安装KVM
apt-get install virtinst python-libvirt virt-viewer virt-manager kvm qemu bridge-utils tightvncserver libguestfs-tools
验证是否加载KVM模块
lsmod | grep kvm
设置桥接网络
vim /etc/network/interfaces

auto eth0
iface eth0 inet manual
up ifconfig $IFACE 0.0.0.0 up
up ip link set $IFACE promisc on
down ip link set $IFACE promisc off
down ifconfig $IFACE down

auto br0
iface br0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
bridge_ports eth0
创建虚拟机