Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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'
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.