Thursday, November 12, 2009

VirtualBox










VirtualBox on OpenSuse 11.1

i have windows 7 running as guest using KVM in my opensuse, but i don't like the SVGA emulation.

So i try virtualbox, and i convert the qemu image to vmware image and use it in VirtualBox , but it failed.

opensuse:/kvm-disk # qemu-img convert -O vmdk hp-win7.img hp-win7.vmdk

So i configure a new vdi image for my windows 7 guest and start my vm, but i got an error, and the error advise me to run this:

opensuse:/kvm-disk # /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel module done
Recompiling VirtualBox kernel module failed
(Look at /var/log/vbox-install.log to find out what went wrong)

opensuse:/kvm-disk # more /var/log/vbox-install.log
Makefile:174: *** Error: unable to find the include directory for your current L
inux kernel. Specify KERN_INCL= and run Make again. Stop.

opensuse:/kvm-disk # ls -la /dev/vboxdrv
ls: cannot access /dev/vboxdrv: No such file or directory

opensuse:/kvm-disk # uname -a
Linux opensuse 2.6.27.7-9-pae #1 SMP 2008-12-04 18:10:04 +0100 i686 i686 i386 GNU/Linux

so i install the kernel source for 2.6.27-9.1 using Yast although 2.6.27.37 is available...


opensuse:/kvm-disk # /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel module done
Recompiling VirtualBox kernel module done
Starting VirtualBox kernel module done
opensuse:/kvm-disk #


seems to work...








Cloning a virtualbox VM

you install virtualbox, and install , say windows 2008, as a guest. then u realise you need to install another windows 2008 guest. do u need to install again? No. u can clone the first one. And there is no need to run NewSID on the cloned vm, yes, it is true, read it here http://blogs.technet.com/markrussinovich/archive/2009/11/03/3291024.aspx.

here is how i did it:



C:\Users\chan\.VirtualBox\HardDisks>"C:\Program Files\Sun\VirtualBox\vboxman
age" clonehd old.vdi new.vdi
VirtualBox Command Line Management Interface Version 3.0.10
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 1dfaa26a-2761-4ee4-9cd6-24642f3c8
53e

C:\Users\chan\.VirtualBox\HardDisks>





















Wednesday, November 11, 2009

KVM

KVM - kernel virtual machine

kvm uses QEMU for device emulation. So your guest will only see a VGA graphics card. Don't expect good performance here. I increase the resolution to 1024 and i could get a larger screen, but it will be better when qemu emulate some better graphicscard. Xen-HVM uses QEMU for emulation too. I tried -vga vmware in kvm-qemu, but it is worse than no specifying anything (i.e. using the default).


I run a vncserver (RealVNC) in my Windows 7 guest and connect to it from my Linux host using vncviewer, the performance sucks!! it is slow. So there is no need to use vnc to connect to your guest. But I tried Microsoft remote desktop , mstsc.exe, to connect to my Windows 2008 server guests, the results is great. You won't know you are on a VM.

Qemu allows your guests to use the usb port too.

Sunday, November 1, 2009

bridge - linux

http://www.linuxfoundation.org/en/Net:Bridge


qemu

http://qemu-buch.de/cgi-bin/moin.cgi/QemuAndTuntap

Thursday, October 22, 2009

hacking

origami is a Ruby framework designed to parse, analyze, edit, manipulate, forge, exploit PDF files. This is NOT a PDF rendering library. It aims at providing a scripting tool to generate and/or analyz...

http://packetstorm.linuxsecurity.com/UNIX/utilities/origami-1.0.0-beta1.tar.gz


Friday, October 9, 2009

printing from opensuse to fuji xerox ApeosPort 450I

opensuse 11.1 detects all the nework printers automatically. impressive!

but there is no driver for this printer and i could not find the ppd file for it. ppd - PostScript Printer Description


i use Xerox DocuPrint 4508 Foomatic/lj4dith, and it works!!!!

i managed to print out a beautiful test page... which says Printed Using CUPS v1.3

www.cups.org


btw i use "windows printer via samba" smb://domain-name/servername/printername

and key in your windows domain id and password.

it works!!

Thursday, October 8, 2009

iso

all about ISO


mount an iso file to a folder

mount -t iso9660 -o loop /home/fs/cd101.iso /mnt

If this don't work...

First of all, you'll have to check whether certain options are included in your kernel. If you're using a standard kernel from one of the major distributions, it's pretty likely that everything necessary is already included so you might want to skip this step. If you have a self-compiled kernel - and I recommend everyone to compile the kernel oneself - you'll have to enable the following options in your kernel:

in Device Drivers > Block Devices
Loopback device support

in File Systems > CD-ROM/DVD Filesystems
ISO 9660 CDROM file system support
[*] Microsoft Joliet CDROM extensions
[*] Transparent decompression extension

http://steinsoft.net/index.php?site=Programming/Articles/linux-mountiso

Monday, October 5, 2009

kvm with opensuse

using kvm on opensuse 11.1 is easy.

http://www.linux-kvm.org/page/HOWTO


my hardware: hp elitebook 6930p

install opensuse 11.1

boot cd with acpi=off

don't use auto configuration during the install process

i disable auto login too and did an internet update and it is so slow... mainly i guess due to my bb connection.. it keep breaking..

so u can skip internet update

to install KVM follow this:

http://en.opensuse.org/KVM


I installed windows 2008 server using a 10gb image file.

create image file
qemu-img create -f qcow2 disk.img 10G

How do I use dd command to create an ISO image?

Put CD into CDROM

Do not mount CD. Verify if cd is mounted or not with mount command:

# mount

If cd was mouted automatically unmout it with umount command:

# umount /dev/cdrom

OR

# umount /mnt/cdrom

Create CD-ROM ISO image with dd command:

# dd if=/dev/cdrom of=/tmp/cdimg1.iso

Where,

  • if=/dev/cdrom: Read from /dev/cdrom (raw format)
  • of=/tmp/cdimg1.iso: write to FILE cdimg1.iso i.e. create an ISO image
src: http://www.cyberciti.biz/tips/linux-creating-cd-rom-iso-image.html


boot the guest from a iso file

qemu-kvm -m 256 -hda disk.img -cdrom winxpsp2.iso -boot d
-boot d instruct qemu to boot from cdrom

what nic are supported?

qemu-kvm -hda vista1.img -net nic,model=?,macaddr=00:16:3e:23:38:45 -net user -cdrom BootMedia.iso -boot d &


opensuse:/kvm-disk # qemu: Supported ISA NICs: ne2k_isa
qemu: Supported PCI NICs: i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio


i82557b is supported by my vista

Insert KVM Modules

Insert the kvm modules as follows (as root)

For Intel processors

opensuse11:~ # modprobe kvm
opensuse11:~ # modprobe kvm-intel

For AMD processors

opensuse11:~ # modprobe kvm
opensuse11:~ # modprobe kvm-amd

To confirm the modules OK,

opensuse11:~ # lsmod | grep kvm
kvm_intel 67824 0
kvm 182936 1 kvm_intel

However, this setting lost on a reboot.

To insert this module at boot time, Click Computer – YaST – System – “/etc/sysconfig editor”. This launches the sysconfig editor.

Click “+” next to “system” and then “+” next to Kernel. Click “MODULES_LOADED_ON_BOOT“, in the right-pane, enter “kvm kvm-intel kqemu” without quotes (”kvm kvm-amd kqemu” for AMD) in the setting box and click finish. Click OK on the confirmation window.

Now, we are all set to configure and run a guest OS on your openSUSE.



Installation of Windows guest paravirtual network drivers

opensuse:/kvm-disk # qemu-kvm -hda AD.img -cdrom /home/fs/Desktop/NETKVM-20081229.iso -net nic,model=virtio
Warning: vlan 0 is not connected to host network

AD.img is the image file where i had installed a windows 2008 to function as the Domain Controller

-cdrom /home/fs/Desktop/NETKVM-20081229.iso

The iso file contained the paravirtualized network drivers that i downloaded; when the Windows 2008 boot up, the cdrom drive will behave as if there is a CD containing the drivers needed for installation.



install tap network interface

install openvpn

create 4 tap - tap0 - 3

opensuse:/etc # openvpn --mktun --dev tap0
Mon Oct 5 23:33:23 2009 TUN/TAP device tap0 opened
Mon Oct 5 23:33:23 2009 Persist state set to: ON
opensuse:/etc # openvpn --mktun --dev tap1
Mon Oct 5 23:43:39 2009 TUN/TAP device tap1 opened
Mon Oct 5 23:43:39 2009 Persist state set to: ON
opensuse:/etc # openvpn --mktun --dev tap2
Mon Oct 5 23:43:42 2009 TUN/TAP device tap2 opened
Mon Oct 5 23:43:42 2009 Persist state set to: ON
opensuse:/etc # openvpn --mktun --dev tap3
Mon Oct 5 23:43:46 2009 TUN/TAP device tap3 opened
Mon Oct 5 23:43:46 2009 Persist state set to: ON
opensuse:/etc #

ifconfig tap0 up

brigde network
opensuse:/etc # brctl addbr br0
opensuse:/etc # brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no

opensuse:/etc # brctl addif br0 eth0
opensuse:/etc # brctl addif br0 tap0
opensuse:/etc # brctl addif br0 tap1
opensuse:/etc #

opensuse:/etc # brctl show
bridge name bridge id STP enabled interfaces
br0 8000.0025b32ead04 no eth0
tap0
tap1
opensuse:/etc #


opensuse:/etc # vi /etc/sysconfig/network/scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes

opensuse:/etc # vi /etc/sysconfig/network/scripts/ifcfg-eth0
DEVICE=eth0
BRIDGE=br0
BOOTPROTO=dhcp
HWADDR=00:19:b9:7e:c8:63
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NM_CONTROLLED=no


opensuse:/etc # vi /etc/sysconfig/network/scripts/qemu-ifup
#!/bin/sh
switch=$(/sbin/ip route list | awk '/^default / { print $NF }')
/sbin/ifconfig $1 0.0.0.0 up
/usr/sbin/brctl addif ${switch} $1


opensuse:/etc/sysconfig/network/scripts # chmod o+x qemu-ifup
opensuse:/etc/sysconfig/network/scripts # chmod o+x ifcfg-br0
opensuse:/etc/sysconfig/network/scripts # chmod o+x ifcfg-eth0



opensuse:/etc # /etc/rc.d/network restart
Shutting down the NetworkManager done
Shutting down network interfaces:
br0
No configuration found for br0
Nevertheless the interface will be shut down. done
eth0 device: Intel Corporation 82567LM Gigabit Network Connection (rev 03) done
tap0
No configuration found for tap0
Nevertheless the interface will be shut down.
could not find configuration file ifcfg-tap0
tap0 tunctl not available -- install tunctl or uml-utilitiesdone
tap1
No configuration found for tap1
Nevertheless the interface will be shut down.
could not find configuration file ifcfg-tap1
tap1 tunctl not available -- install tunctl or uml-utilitiesdone
tap2
No configuration found for tap2
Nevertheless the interface will be shut down.
could not find configuration file ifcfg-tap2
tap2 tunctl not available -- install tunctl or uml-utilitiesdone
tap3
No configuration found for tap3
Nevertheless the interface will be shut down.
could not find configuration file ifcfg-tap3
tap3 tunctl not available -- install tunctl or uml-utilitiesdone
wlan0 device: Intel Corporation Wireless WiFi Link 5100 done
Shutting down service network . . . . . . . . . done
Starting the NetworkManager done
opensuse:/etc #


http://www.linux-kvm.com/content/tip-how-get-maximum-network-performance-using-paravirtual-drivers-and-bridged-networking

adding tap devices using YaST

u must disable network manager from managing the network and use if-up, if-down...

persistent tunnel

no tunnel group , no tunnel owner

must install tunctl package

for me, i need to add my proxy server in YaST control centre->network services->proxy

opensuse:/kvm-disk # ifup br0
br0
br0 Ports: [eth0] [tap0] [tap1] [tap2] [tap3]
br0 forwarddelay (see man ifcfg-bridge) ... ready
Starting DHCP4 client on br0.
br0 IP address: 192.168.0.248/24
opensuse:/kvm-disk # ifconfig
br0 Link encap:Ethernet HWaddr 00:25:B3:2E:AD:04
inet addr:192.168.0.248 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:367 errors:0 dropped:0 overruns:0 frame:0
TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:77192 (75.3 Kb) TX bytes:20045 (19.5 Kb)

eth0 Link encap:Ethernet HWaddr 00:25:B3:2E:AD:04
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:26093 errors:0 dropped:0 overruns:0 frame:0
TX packets:10256 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:19994866 (19.0 Mb) TX bytes:1176611 (1.1 Mb)
Memory:90400000-90420000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:172 errors:0 dropped:0 overruns:0 frame:0
TX packets:172 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:14060 (13.7 Kb) TX bytes:14060 (13.7 Kb)

tap0 Link encap:Ethernet HWaddr C2:14:C7:5D:74:40
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:401 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

tap1 Link encap:Ethernet HWaddr 32:54:9D:9C:03:88
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:401 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

tap2 Link encap:Ethernet HWaddr 3E:11:FD:E3:87:A8
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:401 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

tap3 Link encap:Ethernet HWaddr F6:6B:17:54:E3:4D
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:401 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

wlan0 Link encap:Ethernet HWaddr 00:21:6A:3B:EF:06
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2034 (1.9 Kb) TX bytes:5060 (4.9 Kb)

wmaster0 Link encap:UNSPEC HWaddr 00-21-6A-3B-EF-06-00-00-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

opensuse:/kvm-disk #


opensuse:/kvm-disk # qemu-kvm -hda AD.img -net nic,model=virtio,macaddr=00:11:22:33:44:55:00 -net tap invalid syntax for ethernet address

opensuse:/kvm-disk # qemu-kvm -hda AD.img -net nic,model=virtio,macaddr=00:11:22:33:44:55:00 -net tap
invalid syntax for ethernet address

opensuse:/kvm-disk # qemu-kvm -hda AD.img -net nic,model=virtio,macaddr=00:16:3e:23:38:43 -net tap
/etc/qemu-ifup: could not launch network script
Could not initialize device 'tap'

opensuse:/kvm-disk # qemu-kvm -hda AD.img -net nic,model=virtio,macaddr=00:16:3e:23:38:43 -net tap0 Unknown network device: tap0

opensuse:/kvm-disk # qemu-kvm -hda AD.img -net nic,model=virtio,macaddr=00:16:3e:23:38:43 -net tap,script=/etc/sysconfig/network/scripts/qemu-ifup
/etc/sysconfig/network/scripts/qemu-ifup: line 4: /usr/sbin/brctl: No such file or directory
/etc/sysconfig/network/scripts/qemu-ifup: could not launch network script
Could not initialize device 'tap'

opensuse:/kvm-disk # which brctl
/sbin/brctl


opensuse:/kvm-disk # vi /etc/sysconfig/network/scripts/qemu-ifup

opensuse:/kvm-disk # qemu-kvm -hda AD.img -net nic,model=virtio,macaddr=00:16:3e:23:38:43 -net tap,script=/etc/sysconfig/network/scripts/qemu-ifup

i use static ip within the Windows 2008 guest.


qemu-kvm and qemu-***

from http://wiki.archlinux.org/index.php/QEMU:
For versions of QEMU prior to 0.10.2-1 use the qemu-kvm executable. For 0.10.2-1 and later, use qemu --enable-kvm.

my qemu is

opensuse:/kvm-disk # qemu|grep version
QEMU PC emulator version 0.9.1, Copyright (c) 2003-2008 Fabrice Bellard


Windows Guest Drivers
network drivers - NetKVM - http://people.redhat.com/~yvugenfi/24.09.2009/NetKVM.zip
Storage drivers - viostor - http://people.redhat.com/~yvugenfi/24.09.2009/viostor.zip

http://www.linux-kvm.com/content/latest-release-windows-virtio-network-drivers
http://www.linux-kvm.com/content/upgrading-windows-paravirtual-network-drivers
http://www.linux-kvm.com/content/tip-how-setup-windows-guest-paravirtual-network-drivers



http://www.linux-kvm.com/content/using-windows-installer-paravirtual-network-drivers

change cdrom in QEMU

ctr - alt - 2 to go to console (lef control - left alternate and 1 )
type info block to view device status
type change ide1-cd0 /path/soemthing.iso OR change ide1-cd0 /dev/cdrom
info block



to go back , control - alternate - 1


Ref
http://qemu-buch.de/cgi-bin/moin.cgi/QemuAndTuntap


http://www.susegeek.com/virtualization/howto-install-configure-kvm-virtualization-run-guest-oses-in-opensuse/

http://qemu-buch.de/cgi-bin/moin.cgi/QemuAndTuntap