LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

By scuzzman at 2006-02-21 15:32
Allow me to start by saying this is a very simple process if you have an iptables script configured, so fear not. Also, although this may be Slackware-specific in parts, it's because of that reason that this information can be (relatively) easily ported to other distributions.

My host (real) setup:
Slackware Linux with kernel 2.6.9

Client:
Windows 2000 Pro

Qemu:
Version 0.8.0

If you've not gotten it installed, you'll need qemu installed on your distribution of choice.

You'll need to create an image on your hard-drive for the virtual machine to use as a hard-drive. To do this, I used qemu-img. It was actually quite simple:
Code:
qemu-img create win2k.img 10G
Breaking this down:
qemu-img creates the images you'll be using
win2k.img is the name of the file that the virtual machine will be using as a hard-drive
10G is the size of the file - I gave it 10 gigs. The abbreviation M is also accepted. If an abbreviation is not used, it defaults to K
You'll want to do this in its own folder, and also if you're installing from a CD image on your hard-drive (I did) it's useful to put it in there, too.

Now install the operating system/format the disk. To do this, I launched qemu like this:
Code:
qemu -cdrom Win2kPro.iso -boot d -hda win2k.img
Broken down:
Win2kPro.iso is the image of my Windows 2000 Pro installation CD
-boot d tells it to boot from CD-ROM
-hda winb2k.img tells it that that file is the primary hard-drive

Now that Windows is installed, you need to get internet working. It autoconfigures its NIC with a virtual dhcp server with the IP of 10.0.2.5. You need to allow packet flow of that DHCP server, so I put these rules in my iptables config:
Code:
iptables -A FORWARD -d $IP_FROM_CLIENT_OS -j ACCEPT
iptables -A FORWARD -s $IP_FROM_CLIENT_OS -j ACCEPT
$IP_FROM_CLIENT_OS was set to the virtual dhcp server's ip: 10.0.2.5

You'll need to make sure you have the tun/tap kernel module installed. It was, in my kernel, installed as a module by default. So all I had to do was:
Code:
modprobe tun
You now have a /dev/net/tun device, and should have internet.

After that, I reloaded the image like this:
Code:
/usr/local/bin/qemu -m 128 -smp 1 -boot c -hda '/home/scuzzy/Win2kPro/win2k.img'
And the OS and internet connection were working.

Hope this helps someone :D


  



All times are GMT -5. The time now is 10:36 AM.

Main Menu

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration