Using Qemu on FC4/FC5

Terry Kemp tkemp at mer-med.com
Wed Apr 19 02:38:11 UTC 2006


On Tue, 2006-04-18 at 17:33 -0600, Philip Prindeville wrote:
> I have a couple of machines I'd like to be able to run Qemu on,
> so that I could have a Windows session for running the usual
> bureaucratic stuff (like Outlook, Visio, etc)... but using FC5 for
> most things.
> 
> I was wondering if anyone has a relatively straight-forward config
> for the network stuff so that a virtualized Ethernet interface is
> created with its own IP address (I'll be using DHCP on Windows)...
> rather than having to use NAT, or IP-over-IP encapsulation, etc.
> 
> I googled some mention of using bridging, but mostly it was about
> the problems in doing so... and not much in the way of solutions.
> 
> If there's a simple set-up that doesn't require encapsulation, NAT,
> or running the interface in promiscuous mode... I'd like to hear
> about it.
> 
> Thanks,
> 
> -Philip
> 
> 

I use Qemu and it goes real well.
You are best off with the CVS version

easiest way is as root, cd to /opt/ then... 
#cvs -z3 -d:pserver:anonymous at cvs.sv.gnu.org:/sources/qemu co qemu
#cd qemu
#make clean
#./configure --cc=gcc32
(if on x86_64 edit config-host.mak and remove sparc-user sparc-softmmu)
#make && make install

you will also need kqemu-1.3.0pre5.tar.gz
If you are on x86_64 there is a trick to compiling this one.
I have found if you edit kqemu-linux.c and remove / comment the
following lines... 

// #ifndef page_to_pfn 
// #define page_to_pfn(page) ((page) - mem_map) 
// #define pfn_to_page(pfn) (mem_map + (pfn)) 
// #endif 

kqemu will compile and load properly. Gets rid of mem_map errors.

don't forget to modprobe kqemu


Here is my qemu network start script...

cat /etc/qemu-ifup ...

<.........................
#!/bin/bash

#!/bin/sh
# You need "youruser ALL=(root) NOPASSWD: /etc/qemu-ifup"
in /etc/sudoers
# You also need enough rights on /dev/tun

# Get root if we are not yet
if [ $UID -ne 0 ]
then
        sudo $0 $1
        exit
fi
sudo /sbin/ifconfig $1 promisc 0.0.0.0
sudo /sbin/ifconfig eth0 promisc 0.0.0.0
sudo /usr/sbin/brctl addbr br0
sudo /sbin/ifconfig br0 "eth0 original ip..." ip.ip.ip.ip netmask
255.255.255.0 up
sudo /usr/sbin/brctl addif br0 eth0
sudo /usr/sbin/brctl addif br0 $1
.................................>

Thus $1 (tap0 - tapxxx) and eth0 get promsc, br0 is created with eth0s
ip etc. Using this I can have 4 instances of qemu going at once using
same script.

You may need to mod the script to get eth0 DHCP assigned address, I'm on
fixed IP.

I start XP with...

cat startxp64.sh...
#!/bin/bash
cd ~/vm
sudo /sbin/modprobe tun
sudo /bin/chmod 666 /dev/net/tun
sudo /bin/chmod 666 /dev/ttyS0
qemu-system-x86_64 -m 256 -kernel-kqemu -hda xppro -net
nic,macaddr=00:09:5B:E0:5E:11 -net tap -usb -localtime -soundhw es1370
-serial /dev/ttyS0

This makes sure tun module is loaded (even though qemu uses tap) and
sets perms. 
I also use the RS232 serial interface from Qemu so need to set perms on
that.

OK I know you said NO promiscuous interfaces but... 
This works for me.  
HTH








More information about the fedora-list mailing list