Ubuntu 6.06 Dapper Drake 32 bit on Windows XP with Qemu, Qemu networking, Linux applications in Windows using X server
With this little tutorial I will explain what I did to:
- install Qemu and its accelerator kqemu
- create an image file where the guest operating system will be installed
- install and then run Ubuntu 6.06 Dapper Drake 32 bit as a guest operating system
- connect from Windows host to Linux guest with qemu
rediroption - connect from Windows host to Linux guest and connect from Linux guest to Windows host using tap driver
- run seamless Linux applications in the Windows graphical environment using an X server
I downloaded and installed Qemu and kqemu for Windows:
- unzip qemu to c:\qemu
- untar kqemu to c:\qemu\kqemu
- install kqemu with right click and Install on kqemu.inf
- I tested the preconfigured linux image:
qemu.exe -L . -hda linux.img
and it worked. - I created a new image where to install Ubuntu:
qemu-img.exe create -f qcow h:\os\qemu\ubuntu32.img 15G
Theqcowoption means the image file size will be dynamic and will not extend past the 15 GB limit indicated as a parameter. - I enabled kqemu:
net start kqemu
- I installed Ubuntu on the image created before from an iso I downloaded yesterday:
qemu.exe -L . -cdrom h:\os\ubuntu-6.06.1-alternate-i386.iso -hda h:\os\qemu\ubuntu32.img -m 512 -boot d -kernel-kqemu
I partitioned my 15GB virtual hard disk as this:/dev/hda1 pri 14 GB / /dev/hda5 log 1.1GB swap
When installation finished and the vm rebooted I closed qemu window - Finally I changed the boot option from d to c:
qemu.exe -L . -cdrom h:\os\ubuntu-6.06.1-alternate-i386.iso -hda h:\os\qemu\ubuntu32.img -m 512 -boot c -kernel-kqemu
and Ubuntu started without any problems.
Networking
During Ubuntu installation the network was automatically configured to use dhcp and it worked even if I don't have a dhcp server because qemu works as a dhcp server for its guest. In this way or configuring a fixed IP, Ubuntu can connect to Internet and to my Windows host.Connecting from Windows host to Linux guest with redir option
The fastest and simplest solution to make Windows host connect to Linux guest is to start qemu with redirection options:
qemu.exe -L . -cdrom h:\os\ubuntu-6.06.1-alternate-i386.iso -hda h:\os\qemu\ubuntu32.img -m 256 -boot c -kernel-kqemu -redir tcp:9022::22The
-redir tcp:9022::22 means that if I have to open a ssh connection from Windows host to Ubuntu guest I must connect to localhost:9022: Qemu listen to port 9022 and redirect the tcp traffic to its guest on port 22.
Connecting from Windows host to Linux guest and from Linux guest to Windows host using tap driver
I followed this guide:- I downloaded and installed OpenVPN 2.0.2 version: during setup it installs tap driver, that can be found under Settings | Network Connections as a new device named "TAP-Win32 Adapter V8"; it can be checked with this command in DOS Prompt:
C:\>openvpn --show-adapters Available TAP-WIN32 adapters [name, GUID]: 'tap' {5974718A-DD55-4A93-A57F-213A5F0A4A67} - I renamed the new connection as "tap" and I change its IP. Here is my configuration:
Windows host IP: 192.168.0.16 and 192.168.0.17 (two NICs)
Gateway: 192.168.0.9 (router)
Tap device IP is 192.168.100.1 and its default gateway is 192.168.0.9: IP must be on another network (192.168.100 and 192.168.0 are different networks)
Linux guest IP will be 192.168.100.2 and its default gateway will be 192.168.100.1

Runningip config /allin DOS Prompt I see:Ethernet adapter tap: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : TAP-Win32 Adapter V8 Physical Address. . . . . . . . . : 00-FF-59-74-71-8A Dhcp Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.168.100.1 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.0.9 - I run qemu:
qemu.exe -L . -cdrom h:\os\ubuntu-6.06.1-alternate-i386.iso -hda h:\os\qemu\ubuntu32.img -m 512 -boot c -kernel-kqemu -net nic -net tap,ifname=tap
- Then I configured Linux guest network:
# modprobe ne2k-pci # ifconfig eth0 192.168.100.2 # route add default gw 192.168.100.1 eth0
To ping Windows host from Linux guest I should ping 192.168.0.16
Both pings were successful. Linux guest can't go to internet, so I configured single Linux programs (Firefox, Synaptic, etc.) to connect to the proxy server located at 192.168.100.1:8080, where I'm running Proxomitron.
Linux guest applications displayed in Windows using X server
I installed Xming and PuTTY and followed this very good guide:- to be safe I added these two lines to
/etc/ssh/sshd_config:AllowTcpForwarding yes X11UseLocalHost yes
- then I generated only the rsa1 key because dsa and rsa keys already existed:
/usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ''
- I restarted ssh with:
/etc/init.d/ssh restart
- Finally I opened PuTTY and made these changes:
- check
X11 | Enable X11 forwarding - host and port
- if using
rediroption:Host Name: localhost,Port: 9022 (the same port of the-redir tcp:9022::22command-line option of Qemu - if using tap driver:
Host Name: 192.168.100.2,Port: 22
- if using
- check
SSHoption-box
- check
gnome-terminal & after a few seconds the gnome-terminal window opened in Windows.
And some curious things could happen ...
Posted by: Z24 | Sat, Sep 16 2006 |
Category: /windows |
Permanent link |
home
Tagged as: client-server, linux, qemu, virtualization, windows, xp
http://www.mycomputingart.com/
To contact the webmaster and author write to: info<at>mycomputingart<dot>com
© mycomputingart.com, year(today()).


