Scripts to make kvm easier to use, day-to-day How to use these scripts: 1. Check them out (duh...) 2. Make a directory to hold a virtual machine mkdir -p ~/virtualization/test 3. Make an image for the machine qemu-img create -f raw ~/virtualization/test/test.img 20G 4. Copy the kvm-run.conf and edit appropriately (setting at least IMGFILE) cp /path/to/kvm-tools/kmv-run.conf ~/virtualization/test vim ~/virtualization/test/kvm-run.conf 5. Run kvm cd ~/virtualization/test /path/to/kvm-tools/kvm-run That's it. Note on bridged networks: For bridged networks to work, you must have the bridge setup ahead of time. On gentoo, this is dead easy. 1. Emerge usermode-utilities and bridge-utils 2. Set up your host configuration /etc/conf.d/net: bridge_br0="eth0" RC_NEED_br0="net.eth0" config_br0=( "dhcp" ) config_eth0=( "null" ) Symlink /etc/init.d/net.eth0 and /etc/init.d/net.br0 like normal. The result should be br0 with a dhcp'd IP and eth0 in it. 3. Set bridge mode in kvm-run.conf, optionally setting a name VDE NATed Enable ip forwarding: sudo sysctl -w net.ipv4.ip_forward=1 (set it in /etc/sysctl.conf to get it every boot) Enable natting on all external interfaces: sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo /etc/init.d/iptables save sudo rc-update add iptables default Set up a vtap0 interfacece: cd /etc/init.d && sudo ln -s net.lo net.vtap0 edit /etc/conf.d/net and add these lines: networkmanager_vtap0="ignore" tuntap_vtap0="tap" config_vtap0=("192.168.192.254/24") edit /etc/conf.d/vde: VDE_TAP="vtap0" VDE_SOCK_CHMOD="770" VDE_SOCK_CHOWN=":qemu" sudo rc-update add vde default