Step for setup on KVM
Many kudoes to Silverpeak kvm virtual machine setup guide.
Base system:
Ubuntu server 10.04 (LTS) (ubuntu-10.04.4-server-amd64.iso)
with 3 nics as follows:
nic wan and lan interfaces for virtual machine bridging
nic mgmt ip 192.168.2.100
Step1 : basic package install
Pls do apt-get update first
apt-get install qemu-kvm (virtual machine kernel module)
apt-get install bridge-utils (virtual networking)
apt-get install vncviewer
(virtual machine console connection, as Ubuntu server does not have X, qemu
console simulation will not work.)
Ubuntu network config file for bridging to work (/etc/network/interface)
Mapping network interface name, config goes to file /etc/udev/rules.d/70-persistent-net.rules
***************************************
auto lo
iface lo inet loopback
auto mgmt
iface mgmt inet static
address 192.168.2.100
network 192.168.2.0
netmask 255.255.255.0
gateway 192.168.2.1
auto wbr
iface wbr inet manual
bridge_ports wan
bridge_stp off
bridge_fd 0
bridge_maxwait 0
auto lbr
iface lbr inet manual
bridge_ports lan
bridge_stp off
bridge_fd 0
***************************************
Step 2: Creating Ubuntu server virtual machine for dding wanos disk image
1) creating a Ubuntu server virtual diska (20G);
qemu-img create -f raw diska 20G
2) creating a Wanos virtual diskb (70G)
qemu-img create -f raw diskb 70G
(Silverpeak emphasizes that virtual disk needs to be on raw format)
Step 3:
1) Install virtual Ubuntu server on diska
sudo qemu-system-x86_64 -device virtio-net-pci,netdev=net1,mac=DE:AD:BE:EF:35:52 -netdev tap,id=net1,script=qemu-ifup-wan -device virtio-net-pci,netdev=net0,mac=DE:AD:BE:EF:35:51 -netdev tap,id=net0,script=qemu-ifup-lan -vnc :1 -drive file=./diska,if=virtio -m 2048 -boot d -cdrom ./ubuntu-10.04.4-server-amd64.iso
vncviewer 192.168.2.100 :1
to connect console for system installation.
qemu-ifup-lan file
#!/bin/sh
nic=$1
ifconfig $nic 0.0.0.0 up
brctl addif lbr $nic
qemu-ifup-wan file
#!/bin/sh
nic=$1
ifconfig $nic 0.0.0.0 up
brctl addif wbr $nic
2) boot after completing server installation
sudo qemu-system-x86_64 -device virtio-net-pci,netdev=net1,mac=DE:AD:BE:EF:35:52 -netdev tap,id=net1,script=qemu-ifup-wan -device virtio-net-pci,netdev=net0,mac=DE:AD:BE:EF:35:51 -netdev tap,id=net0,script=qemu-ifup-lan -vnc :1 -drive file=./diska,if=virtio,boot=on -drive file=./diskb,if=virtio -m 2048
3) Upload Wanos image and dding to diskb
kvm calls diska as /dev/vda and diskb as /dev/vdb
4) dump diska and boot virtual machine on diskb
sudo qemu-system-x86_64 -device virtio-net-pci,netdev=net1,mac=DE:AD:BE:EF:35:52 -netdev tap,id=net1,script=qemu-ifup-wan -device virtio-net-pci,netdev=net0,mac=DE:AD:BE:EF:35:51 -netdev tap,id=net0,script=qemu-ifup-lan -vnc :1 -drive file=./diskb,if=virtio,boot=on -m 2048
Step 4:
by vncviewer, logging on wanos and doing clean.sh script to restart wanos.