 |
| Categories Menu |  | |
| Navigation |  |
|
|
Home |
| |
|
|
Community |
| |
|
Content |
| |
|
Support Us |
| | | | |
| |
| User Info |  |
| Welcome, Anonymous
Membership:
 Latest: chondo2
 New Today: 0
 New Yesterday: 0
 Overall: 219
People Online:
 Visitors: 15
 Members: 0
 Total: 15
| | |
| |
| hacker Beware |  | |
 | |
Software: Free Virtual Machine Software - Qemu-0.82 + kqemu on Debian'like OS
Posted on Thursday, October 05 @ 08:37:30 CDT by ewiget
|
I had begun writing this article around qemu-0.7.x and the current release is qemu-0.8.2 There were many changes that took place between those versions. This document will allow you to run any other operating system in side a virtual machine within Linux. This is handy for such things as testing new linux distributions without actually installing them, testing livecds, or even running Windows or Mac OSX inside of Linux.
Qemu is open-source, free, virtual machine software similar to VMWare, Win4Lin, etc that runs on Linux, Windows, and MacIntosh computers.
Throughout this article I will refer to several words that often get confused amoung persons new to virtual machines. These words are:
HOST = The operating system that has the qemu program installed on it (in all examples below, this is Linux) GUEST = The operating system you will run on the host operating system as a virtual machine
NAT NETWORKING - networking that uses non-routable ip addresses and gives the host access to the guest operating system services such as file shares, printers, etc. It also allows the guest operating system access to the host services. Access to the internet from the guest is possible, but the guest operating system shares the hosts ip address. This option is safer since other computers on the same network are not able to access the guest operating system directly. However, qemu offers redirection of ports to extend this type of networking (not covered in this tutorial). The default nat networking in qemu uses guest ip addresses similar to 10.0.x.x This is the default type of networking if none is specified (at least qemu version 0.8.0 and above). It is also the easiest to set up.
BRIDGED NETWORKING - bridged networking mean the guest operating system has its own ip address on the network and is visiable as if it is an actual computer on the network. This is harder to set up but is a lot more flexible.
SOCKETS NETWORKING - allows you to connect multiple virtual machines to each other - can be used to create complex test networks consisting of multiple operating systems.
You need to determine which type of networking you need. Recommended NAT unless there is a reason you need a real ip address in your virtual machine.
qemu homepage - http://www.qemu.com qemu unofficial FAQ - http://kidsquid.com/cgi-bin/moin.cgi/FrequentlyAskedQuestions qemu documentation - http://fabrice.bellard.free.fr/qemu/qemu-doc.html prebuilt qemu operating system images - http://www.freeoszoo.org/download.html
make sure you dont have an older versions of qemu or kqemu installed (steps to test for debian like distros):
[code] dpkg -L qemu [/code] |
The results are: /. /etc /etc/qemu-ifup /usr /usr/bin /usr/bin/qemu /usr/bin/qemu-armeb /usr/bin/qemu-sparc /usr/bin/qemu-system-sparc /usr/bin/qemu-system-ppc /usr/bin/qemu-i386 /usr/bin/qemu-system-mips /usr/bin/qemu-arm /usr/bin/qemu-img /usr/bin/qemu-ppc /usr/bin/qemu-system-x86_64 /usr/sbin /usr/sbin/qemu-make-debian-root /usr/share /usr/share/doc /usr/share/doc/qemu /usr/share/doc/qemu/TODO /usr/share/doc/qemu/README /usr/share/doc/qemu/qemu-doc.html /usr/share/doc/qemu/TODO.Debian /usr/share/doc/qemu/README.Debian /usr/share/doc/qemu/tundev.c /usr/share/doc/qemu/copyright /usr/share/doc/qemu/changelog.gz /usr/share/doc/qemu/qemu-tech.html /usr/share/doc/qemu/changelog.Debian.gz /usr/share/man /usr/share/man/man1 /usr/share/man/man1/qemu-img.1.gz /usr/share/man/man1/qemu.1.gz /usr/share/man/man1/qemu-user.1.gz /usr/share/man/man8 /usr/share/man/man8/qemu-make-debian-root.8.gz /usr/share/qemu /usr/share/qemu/keymaps /usr/share/qemu/keymaps/ar /usr/share/qemu/keymaps/da /usr/share/qemu/keymaps/de /usr/share/qemu/keymaps/es /usr/share/qemu/keymaps/et /usr/share/qemu/keymaps/fi /usr/share/qemu/keymaps/fo /usr/share/qemu/keymaps/fr /usr/share/qemu/keymaps/hr /usr/share/qemu/keymaps/hu /usr/share/qemu/keymaps/ja /usr/share/qemu/keymaps/is /usr/share/qemu/keymaps/it /usr/share/qemu/keymaps/lt /usr/share/qemu/keymaps/mk /usr/share/qemu/keymaps/lv /usr/share/qemu/keymaps/nl /usr/share/qemu/keymaps/no /usr/share/qemu/keymaps/pl /usr/share/qemu/keymaps/pt /usr/share/qemu/keymaps/ru /usr/share/qemu/keymaps/sl /usr/share/qemu/keymaps/th /usr/share/qemu/keymaps/sv /usr/share/qemu/keymaps/tr /usr/share/qemu/keymaps/de-ch /usr/share/qemu/keymaps/en-gb /usr/share/qemu/keymaps/en-us /usr/share/qemu/keymaps/fr-be /usr/share/qemu/keymaps/fr-ca /usr/share/qemu/keymaps/fr-ch /usr/share/qemu/keymaps/nl-be /usr/share/qemu/keymaps/pt-br /usr/share/qemu/keymaps/common /usr/share/qemu/keymaps/modifiers /usr/share/qemu/linux_boot.bin /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/qemu /usr/share/doc-base /usr/share/doc-base/qemu-doc /usr/share/man/man1/qemu-system-sparc.1.gz /usr/share/man/man1/qemu-arm.1.gz /usr/share/man/man1/qemu-i386.1.gz /usr/share/man/man1/qemu-system-ppc.1.gz /usr/share/man/man1/qemu-system-mips.1.gz /usr/share/man/man1/qemu-armeb.1.gz /usr/share/man/man1/qemu-ppc.1.gz /usr/share/man/man1/qemu-system-x86_64.1.gz /usr/share/man/man1/qemu-sparc.1.gz /usr/share/qemu/bios.bin /usr/share/qemu/vgabios-cirrus.bin /usr/share/qemu/ppc_rom.bin /usr/share/qemu/proll.elf /usr/share/qemu/vgabios.bin Remove it if results are similar to above by sudo apt-get remove qemu:
[code] sudo apt-get remove qemu [/code] |
Another way to check for installed qemu is simply type:
[code] find / -iname qemu [/code] |
If it returns a path to the qemu binary or folders, you need to remove qemu by whatever means it was installed (apt, synaptic, dpkg, rpm, manually if installed by source, etc)
search /lib/modules for existing kqemu files:
[code] find /lib/modules -iname kqemu* [/code] |
Results were: /lib/modules/2.6.14-gratis/misc/kqemu.ko
then rename any that it finds (we rename it in case the newer build fails for some reason):
[code] sudo mv /lib/modules/2.6.14-gratis/misc/kqemu.ko /lib/modules/2.6.14-gratis/misc/kqemu.ko.old [/code] |
download qemu-0.8.2.tar.gz to hard drive (I used ~/Desktop ) -
[code] wget http://fabrice.bellard.free.fr/qemu/qemu-0.8.2.tar.gz [/code] |
download kqmeu-1.3.0pre9.tar.gz to hard drive (I used ~/Desktop ) -
[code] wget http://fabrice.bellard.free.fr/qemu/kqemu-1.3.0pre9.tar.gz [/code] |
extract qemu -
[code] tar xzfv ~/Desktop/qemu*.tar.gz [/code] |
extract kqemu -
[code] tar xzfv ~/Desktop/kqemu*.tar.gz [/code] |
copy kqemu-1.3.0pre9 folder to qemu-0.8.2 folder -
[code] cp -R ~/Desktop/kqemu* ~/Desktop/qemu-0.8.2/ [/code] |
copy kqemu-1.3.0pre9 folder to qemu-0.8.2 folder and rename it to kqemu -
[code] cp -R ~/Desktop/kqemu* ~/Desktop/qemu-0.8.2/kqemu [/code] |
- UBUNTU / KUBUNTU 6.06 PRE-INSTALL
find out what kernel you are running - you will need to know this below where it says linux-source-version:
The important part from the command above is something like 2.6.some_numbers << - these numbers you need to know. Replace version below in all commands with the actual version number
install required stuff:
[code] sudo apt-get install build-essential linux-source-version libsdl1.2-dev zlib1g-dev gcc-3.4 uml-utilities bridge-utils [/code] |
[code] tar -xjf linux-source-version.tar.bz2 [/code] |
[code] cp /boot/config-`uname -r` /usr/src/linux-source-version/.config [/code] |
[code] cd /usr/src/linux-source-version [/code] |
[code] make oldconfig [/code] |
[code] make modules [/code] |
Ubuntu users can continue by following the steps below for FINALE COMPILE - MAKE - MAKE INSTALL
Install C/C++ Development Tools:
[code] sudo apt-get install build-essentials [/code] |
Install Xandros Kernel Source - replace version with whatever version uname -r shows: Open the Console as root (typing 'su' and enter the root password)
[code] sudo apt-get install xandros-kernel-source-version [/code] |
[code] tar jxf xandros-kernel-source-version.tar.bz2 ln -sf xandros-kernel-source-version linux cd /usr/src/linux cp /boot/config-version-x1 .config make EXTRAVERSION=-x1 oldconfig make EXTRAVERSION=-x1 prepare-all [/code] |
Install uml-utilities required for tun/tap networking:
[code] sudo apt-get install uml-utilities bridge-utils [/code] |
Xandos users can now follow steps below for FINALE COMPILE - MAKE - MAKE INSTALL
Install C/C++ Development Tools:
[code] sudo apt-get install build-essentials [/code] |
Install Xandros Kernel Source, config ,headers, and create the /usr/src/linux link:
[code] sudo apt-get install los-kernel-source-2.6.14 los-kernel-config-2.6.14-gratis los-kernel-headers-2.6.14 los-kernel-link-2.6.14 [/code] |
Install required sdl libraries:
[code] sudo apt-get install libsdl-gfx1.2-dev [/code] |
Install uml-utilities required for tun/tap networking:
[code] sudo apt-get install uml-utilities bridge-utils [/code] |
Freespire users can now continue to FINALE COMPILE - MAKE - MAKE INSTALL
- FINALE COMPILE - MAKE - MAKE INSTALL
change directories to extracted qemu-0.8.2. folder:
[code] cd ~/Desktop/qemu-0.8.2 [/code] |
results should show with the important lines being SDL support yes and kqemu support yes - if it does not show yes for those two lines, stop and find out why before going any further:
Results:
[code] $ ./configure Install prefix /usr/local BIOS directory /usr/local/share/qemu binary directory /usr/local/bin Manual directory /usr/local/share/man ELF interp prefix /usr/gnemul/qemu-%M Source path /home/ewiget/Desktop/qemu-0.8.2 C compiler gcc Host C compiler gcc make make install install host CPU i386 host big endian no target list i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu gprof enabled no profiler no static build no SDL support yes SDL static link no mingw32 support no Adlib support no CoreAudio support no ALSA support no DSound support no FMOD support no kqemu support yes Documentation no
[/code] |
If the above is successful:
then
[code] sudo make install [/code] |
Almost done:
[code] ./configure make sudo make install [/code] |
verify new kqemu.ko file exists:
[code] find /lib/modules -iname kqemu* [/code] |
should return the old renamed file and a new one:
[code] /lib/modules/2.6.14-gratis/misc/kqemu.ko.old /lib/modules/2.6.14-gratis/misc/kqemu.ko [/code] |
verify that device node /dev/kqemu exists:
[code] ls -la /dev/kqemu [/code] |
if not...execute following commands
[code] sudo mknod /dev/kqemu c 250 0 && sudo chmod 666 /dev/kqemu [/code] |
test loading of kqemu module:
[code] sudo modprobe kqemu [/code] |
If no errors, everything should be installed fine. You can test it by:
[code] sudo lsmod | grep kqemu kqemu 107652 0 [/code] |
Installation is completed....
Continue to INSTALLING AN OS -------------------------------------
Create a directory to hold qemu guest images - I use my home folder and create a folder qemu:
[code] mkdir ~/qemu [/code] |
Then I create a folder inside of the ~/qemu folder for each guest operating system - I will use Windows 2000 in this example -- notice there is no blank space between Windows and 2000:
[code] mkdir ~/qemu/Windows2000 [/code] |
Change directories to the folder you are creating the disk image for:
[code] cd qemu/Windows2000 [/code] |
Create an image file to contain the guest operating system inside the folder, replace 3G ith the size of the hard disk image in Gigabytes:
[code] qemu-img create windows2000.img 3G [/code] |
Insert the Windows 2000 cdrom, and run the following to begin the installation - I use the absolute path to the disk image just to make sure I don't make any mistakes - you may also need to change /dev/cdrom to whatever your system uses, i.e. /dev/cdroms/cdrom0 on some system:
[code] qemu -hda ~/qemu/windows2000/windows2000.img -cdrom /dev/cdrom -boot d -win2k-hack -m 256 [/code] |
To explain the above command: The -hda option above tells it to boot using the above created image file as it's C: drive (hda). The option -cdrom is to make the cdrom accessible (using /dev/cdrom -- this may need modified for your system). The cdrom then becomes drive d:. The option -boot d tells it to boot from D: (the cdrom). The -win2k-hack option is needed to stop windows 2000 from taking forever to install (it will still take a lot longer than expected, just be patient - I might add that other operating systems seem to install just fine within a much shorter period of time...so it must be something specific to windows 2000. For instance, when I installed freespire-1.0.13 it only took about 15 minutes total time.) The -m 256 sets up 256MB of memory for this virtual machine. You can adjust this as needed, more never hurts, however less during Windows 2000 install is not recommended - I would use double whatever microsofts recommendations are for memory requirements....meaning 256 for Windows 2000 and 512 for Windows XP or servers. After its installed, you can adjust as necessary based on whatever memory your system has and what you can spare.
After the operating system is installed, you can now test it using the following command - note the changes which is now saying to boot the c drive which holds the installed windows 2000 operating system in this example:
[code] qemu -boot c -hda ~/qemu/windows2000/windows2000.img -m 256 [/code] |
If the above works, you can create a desktop icon with the application command as the line above - however, I am sure most people will want to set up networking within the guest operating systems. There are a few options here.
NAT NETWORKING By default on version 0.8.x of qemu, not specifying a network will use the option -net nic -net user by default. User net will automatically assign a ip address to the guest operating system in the format 10.0.2.x and will require the script below to work on linux. You will still be able to surf the internet or local network connections but it requires a little more work.
Two caveats with nat networking:
- if you use ping to test your guest operating system network connection, you will find the ip address or hostname is found but then you get timeout for all ping replies. This is normal for but does not affect actually surfing the net.
- You can access shares in your host/guest operating system on their assigned ip address but only from the computer that qemu is running on (not from computers on your network or home lan).
Here is a wrapper script wrote by another user (can't give credit - forgot where I saw it since I have been in the process of writing this article for over 6 months) that you can use that helps set up the nat network (save the file in your home directory or desktop and make it executable then simply run the file from a console to start the guest operating system - do not include the lines or anything between the two ------- lines at the top and bottom of the script - those are just to let you know where the script start and ends. The very first line of the script should be the line that starts #!/bin/bash): ----------------- begin NAT NETWORKING script -----------------
[code] #!/bin/bash set -e set -x echo "Enter your password when prompted." sudo sysctl -w net.ipv4.ip_forward=1 sudo /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo sysctl -w dev.rtc.max-user-freq=1024 set +x echo "Starting QEMU" /usr/local/bin/qemu -hda ~/qemu/freespire/freespire.img -boot c [/code] |
--------------- end script ---------------
The above script explained: #!/bin/bash starts the script and sets the interpreter/environment to bash set -e This tells bash that it should exit the script if any statement returns a non-true return value. set -x turns on debugging and will produce an execution trace, each command is printed as it is executed echo "Enter your password when prompted." will print what is enclosed between "..." to the screen. sudo sysctl -w net.ipv4.ip_forward=1 will use the sysctl to turn on ip_forwarding (on=1 off=0) sudo /sbin/iptables line adds a firewall rule for the ip_forwarding to be able to access the internet through eth0 sudo sysctl -w dev.rtc.max-user-freq=1024 sets rtc.max-user-freq to 1024 clock timer set +x - stops debugging echo "Starting...." prints the text between "..." to screen last line is our actual command to start the guest operating system
A few more options you might include are in the following example that I use for freespire:
[code] qemu-system-x86_64 -boot c -hda ~/qemu/freespire/freespire.img -net nic -net tap -m 256 -localtime [/code] |
Note that instead of using qemu I am using qemu-system-x86_64 - this is needed on 64 bit systems
Skipping ahead because the networking options will take some explaining: the option -localtime sets the time in the guest operating system to the host localtime
BRIDGED NETWORKING the two options -net nic (the one to the guest system) -net tap (the one to the host system) set up tap networking so you can surf the internet using the virtual machine with a real IP address on the network. It requires tun support compiled in the kernel or as a module - /dev/net/tun or /dev/tun needs to be present. If it is, you also need to either chmod the file to allow normal users to use it, or run the entire command as sudo, i.e.:
[code] sudo qemu-system-x86_64 -boot c -hda ~/qemu/freespire/freespire.img -net nic -net tap -m 256 -localtime [/code] |
Check for tun networking device:
[code] ls -la /dev/net/tun [/code] |
should have the results:
[code] crw-rw---- 1 root root 10, 200 2006-10-02 12:34 /dev/net/tun [/code] |
If the above doesn't exist, try to load the module and check again:
[code] sudo modprobe tun [/code] |
If there are no errors in the above, the device /dev/net/tun should now exist. If it says something like not found, you will need to recompile your kernel for tun support.
set up /dev/net/tun for access by normal users:
[code] sudo chmod 666 /dev/net/tun [/code] |
Make sure the correct permissions exist after applying changes:
[code] ls -la /dev/net/tun [/code] |
Should show the results:
[code] crw-rw-rw- 1 root root 10, 200 2006-10-02 12:34 /dev/net/tun [/code] |
The quick way to set up bridged networking (tested on ubuntu dapper, kubuntu 6.06, and freespire 1.0.13) You need to set up the network interfaces for bridged networking. You need to print this article and maybe even save a copy of your desktop because you could get disconnected from the internet when setting up bridged networking. The file code below is the /etc/network/interfaces file. The easy way to set this up is to move the existing file to a backup and then copy and paste the code below into a new file. As long as you don't reboot or have a power failure, you should stay connected to the internet after this file is changed - but whatever you do, do not change this file and then not complete the remaining steps!!!!:
back up the original file:
[code] sudo mv /etc/network/interfaces /etc/network/interfaces.bak [/code] |
chose either gedit, kate, or vim text editors for the next line below and use only one of them - I chose vim:
[code] sudo vim /etc/network/interfaces [/code] |
copy and past the following code into the new file and save it: --------- begin code /etc/network/interfaces ---------
[code] # /etc/network/interface # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5).
# The loopback network interface auto lo iface lo inet loopback
# The bridge network interface(s) auto br0 iface br0 inet static address 192.168.0.114 network 192.168.0.0 netmask 255.255.255.0 broadcast 192.168.0.255 gateway 192.168.0.1 bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off [/code] |
---------- end code --------- The example above is for a static ip address. You will need to modify it to fit whatever you ip address, network, netmask, bradcast address, and gateway are. You really should try to use a static ip address if possible to make the bridged network consistant after reboots or power failures. Otherwise you will need to modify scripts each time your ip address changes.
With the above file configured and saved, we move on to the next one.
Qemu will use a configuration file located at /etc/qemu-ifup If this file already exists, back it up and then create a new blank one with the code below:
back up the file if it exists:
[code] sudo mv /etc/qemu-ifup /etc/qemu-ifup.bak [/code] |
create a new file using the code below:
[code] sudo vim /etc/qemu-ifup [/code] |
------- begin code /etc/qemu-ifup ---------
[code] #!/bin/sh
echo "Executing /etc/qemu-ifup" echo "Bringing up $1 for bridged mode..." sudo /sbin/ifconfig $1 0.0.0.0 promisc up echo "Adding $1 to br0..." sudo /usr/sbin/brctl addif br0 $1 sleep 2 [/code] |
---------- end code ---------- You should not need to edit the above file at all. Simply copy the text into the file and save it.
Make the above file executable:
[code] sudo chmod 755 /etc/qemu-ifup [/code] |
We need to allow normal users to make changes to networking interfaces. The easiest way to do this is via the sudo command. We also need to modify the /etc/sudoers file to limit specific commands the users can run. I am including mine below in its entirety however, there are only 2 lines you need to add to your file. Do not use a text editor to edit this file. You can only edit this file with a special command, visudo. Find the line that begins with Cmnd_Alias QEMU= and copy the entire line into your file in the Cmnd alias section. Next, copy the last line that starts with %admins ALL=NOPASSWD:QEMU to your file. Make sure you only edit the sudoers file using the following command (you have been warned and its not my fault if your computer explodes when you don't use the correct command to edit this file):
----------- begin /etc/sudoers code -----------
[code] # /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. #
# Host alias specification
# User alias specification
# Cmnd alias specification ## Add this line below to your file ## this allows users in the admins group to run the 3 commands below without using a password Cmnd_Alias QEMU=/sbin/ifconfig, /usr/sbin/brctl, /sbin/modprobe
# User privilege specification root ALL=(ALL) ALL
ALL ALL = (root) NOPASSWD: /usr/lib/cups/backend/ %admins ALL=(ALL) NOPASSWD: ALL ## add this line below to your file - %admins could also be %admin %admins ALL=NOPASSWD:QEMU [/code] |
--------------- end code ---------------
Finally, we need to create a script to actually do some configurations and start the guest operating system. I placed this file in my home folder and called it win2k.sh You should call it whatever you want. It should be commented well enough so that you can figure out what it does. You will need to change the lines that begin with ARGS= and add your own startup arguments for your guest operating system. You will also need to change the two lines that begins with sudo iptables and change the IP address 192.168.0.150 to whatever ip address you are going to give your guest operating system on your network.
----------- begin win2k.sh code ------------
[code] #!/bin/sh
ARGS="-hda /home/ewiget/qemu/win2000/w2k.img -boot c -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=/etc/qemu-ifup -m 256 -localtime"
echo "Loading kqemu kernel module..." sudo modprobe kqemu echo "...."
echo "Creating kqemu device..." sudo mknod /dev/kqemu c 250 0 echo "...."
echo "Setting permission of kqemu device..." sudo chmod 666 /dev/kqemu echo "...."
echo "Loading tun kernel module..." sudo modprobe tun echo "...."
echo "Creating tun device directory..." sudo mkdir /dev/net echo "...."
echo "Creating tun device..." sudo mknod /dev/net/tun c 10 200 echo "...."
echo "Changing permission of tun device..." sudo chmod 666 /dev/net/tun echo "...."
echo "Starting QEMU with..." echo $ARGS echo "...." exec /usr/local/bin/qemu $ARGS
echo "Setting up firewall rules..." sudo iptables -A FORWARD -s 192.168.0.150 -j ACCEPT sudo iptables -A FORWARD -d 192.168.0.150 -j ACCEPT echo "...." [/code] |
------------ end code ------------
Make the above code executable:
[code] sudo 755 win2k.sh [/code] |
Reboot the computer so that all networking changes take effect. When it is done rebooting, you will now have something that looks much different when running the ifconfig command. Below is an example of mine:
[code] br0 Link encap:Ethernet HWaddr 00:50:8D:84:6C:54 inet addr:192.168.0.114 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::250:8dff:fe84:6c54/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4117 errors:0 dropped:0 overruns:0 frame:0 TX packets:4071 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1039854 (1015.4 KiB) TX bytes:340604 (332.6 KiB)
eth0 Link encap:Ethernet HWaddr 00:50:8D:84:6C:54 inet6 addr: fe80::250:8dff:fe84:6c54/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3949 errors:0 dropped:0 overruns:0 frame:0 TX packets:4112 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1097455 (1.0 MiB) TX bytes:346815 (338.6 KiB) Interrupt:11 Base address:0xa000
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:10340 errors:0 dropped:0 overruns:0 frame:0 TX packets:10340 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:911100 (889.7 KiB) TX bytes:911100 (889.7 KiB) [/code] |
To explain the above results: br0 is now our bridged network device. It has the IP address that used to be assigned to eth0 because it is in fact bridged to eth0 device. eth0 does not have a ip address because it is bridged to br0 which has an ip address. lo is the local loopback interface. Start your guest operating system using the script you created above located in your home folder:
The script is commented well enough that if there are any problems, it should give an error message about what went wrong. To finish setting up the guest operating system, simply give it a real ip address on your network (I used 192.168.0.150 because I am behind a router), provide the normal gateway/route ip address used on your network, provide the dns server information. Reboot the guest operating system and test it.
From the host operating system, you should be able to ping the guest (assuming it doesn't have a firewall running like Windows XP) Be sure to use the ip address you assigned your guest operating system....
[code] ping 192.168.0.150 [/code] |
From the guest operating system, you should be able to ping the host operating system - dont forget to change the ip address to your host operating system ip address:
[code] ping 192.168.0.114 [/code] |
From the guest operating system, you should be able to ping the default gateway (mine is 192.168.0.1) - dont forget to change the ip address to your default gateway:
[code] ping 192.168.0.1 [/code] |
From the guest operating system, you should be able to ping yahoo.com or google.com or any other internet address:
[code] ping yahoo.com ping google.com [/code] |
ADDITIONAL USEFUL OPTIONS AND COMMANDS
Have a usb mouse?? Try this option:
[code] -usb -usbdevice tablet [/code] |
If you wanted to boot a linux live cd you could use this command with the cdrom in the cdrom drive: First create a small hard drive image - the size can be anything, I chose 300MB in case I ever want to use it:
[code] qemu-img create ~/qemu/livecds.img 300M [/code] |
Run the command to boot from the cdrom drive:
[code] qemu -boot d -hda ~/qemu/livecds.img -cdrom /dev/cdrom -m 256 [/code] |
You can also boot from an iso file - I am using the iso filename kubuntu.iso in this example:
[code] qemu -boot d -hda ~/qemu/livecds.img -cdrom /path/to/kubuntu.iso [/code] |
You can also try without using the -hda option, it used to work in older versions of qemu but I couldn't get it to work on newer versions of qemu - it would always give an error message similar to "could not open hard disk image" - your milage may vary: qemu -boot d -cdrom /path/to/kubuntu.iso or qemu -boot d -cdrom /dev/cdrom
Qemu Console Commands
After you start qemu, you can run these commands within the virtual console: CTRL + ALT = release cursor from guest operating system back to host CTRL + ALT + 2 = access the qemu diagnostic console CTRL + ALT + 1 = return back to the qemu console from the diagnostic console for the virtual machine operating system
Within the Diagnostic console you can run these commands: help = display all commands info = list all informational commands info kqemu = show whether or not support for kqemu accelerator is working/loading/etc
|
| |
| Related Links |  | |
| Article Rating |  | |
| Options |  | | |
|
| | The comments are owned by the poster. We aren't responsible for their content. |
|
|
|
No Comments Allowed for Anonymous, please register |
|
|
|