netboot

Linux (various distributions) running under QEMU

netboot

Postby mcreel on Tue Feb 20, 2007 11:44 am

Hello, everyone,
I'm working on a new version of ParallelKnoppix (http://www.parallelknoppix.net). There's an alpha version at http://pareto.uab.es/mcreel/ParallelKnoppix/download/testing/parallelknoppix-2007-02-19.iso

This version has qemu/kqemu, as well as kvm compiled in for both Intel and AMD. The kqemu module is in /cdrom/KNOPPIX/modules, and needs to be inserted using insmod.

I would like to add the ability to netboot a virtual compute node using qemu and/or kvm. This way, PK would start as normal by booting from CD, but a demonstration cluster could be created using a virtual secondary compute node, with no need for a real second computer.

There is a rom-o-matic netboot ROM at /cdrom/kvm-pxe.iso, which is known to work.

I need help with getting bridged networking configured so that the virtual machine will netboot, taking an IP address like 192.168.0.2, supplied by the PK master node. Any help is appreciated.

Thanks, Michael
mcreel
 
Posts: 5
Joined: Tue Feb 20, 2007 11:35 am

Postby dignome on Tue Feb 20, 2007 1:11 pm

What is your host os? Normally I'd say read the wiki since it has a pretty good networking section, but that is down atm.

Also qemu 0.9.0 adds the -boot n option which does network boot using included etherboot roms as well.

On linux you would clear eth0's ip, put it into promiscuous mode, create bridge, and add eth0 into the bridge. Then you would do the same for tapX interface (usually in qemu-ifup script). So:

Create bridge interface:
Code: Select all
brctl addbr br0


Add eth0 into the bridge. This kills the host's connectivity until you configure br0 the same way you did eth0.
Code: Select all
ifconfig eth0 0.0.0.0 promisc up
brctl addif br0 eth0


If you used dhcp to configure eth0 then use dhcp with br0 instead:
Code: Select all
dhclient br0


Tip: could rename the br0 interface as eth0 after renaming eth0. That way system scripts won't become confused. On debian the bridge can be managed in /etc/network/interfaces:

Code: Select all
auto br0
iface br0 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
bridge_ports eth0
bridge_stp off
bridge_maxwait 5
# referenced from http://qemu-forum.ipi.fi/viewtopic.php?t=374


Edit your /etc/qemu-ifup script to look something like:
Code: Select all
#!/bin/sh
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
sudo /usr/sbin/brctl addif br0 $1


Invoke qemu:
Code: Select all
qemu -cdrom blah.iso -net nic -net tap -localtime -boot d


-localtime sets vm bios date to local time.
-boot d tells vm to boot from given cdrom

What happens:
qemu with -net tap sets persistent a tap interface for its own use. The qemu-ifup script in /etc/ is then called (can change this with -net tap,script=x). The script adds the tap interface into the bridge after the ip is cleared and appropriate mode set.

This may not work when host interface is wireless and you try to bridge with it. See:
http://linux-net.osdl.org/index.php/Bri ... ss_card.21
User avatar
dignome
helper
 
Posts: 786
Joined: Thu Jan 12, 2006 5:09 am

Postby mcreel on Tue Feb 20, 2007 4:00 pm

Thanks for the answer. Here's more information.

The host OS is Linux. ParallelKnoppix is a live CD that boots up into essentially Debian unstable.

The version of QEMU on PK is 0.90, with the newest kqemu installed from source. QEMU and kqemu work fine.

The PK master node, booted with the CD, becomes a dhcp and tftp server, from which the compute nodes boot up. I'm trying to use qemu and/or kvm to create a virtual compute node which should net boot in the same way real compute nodes do. This is just for demonstration purposes.

The last part of your message suggests something like
Code: Select all
qemu -cdrom blah.iso
. This part is working. What I need is something like
Code: Select all
qemu -boot n etcetera

or
Code: Select all
qemu -cdrom rom-o-matic_image.iso etcetera


Both of these work sort of, but the virtual compute node does not find the real dchp server, which is at 192.168.0.1.

I posted the location of the test ISO image in case someone would like to try to solve this. I've already tried, without success. Thanks, Michael
mcreel
 
Posts: 5
Joined: Tue Feb 20, 2007 11:35 am

Postby dignome on Tue Feb 20, 2007 4:06 pm

Right, qemu uses a user mode network by default. You'd have to use tap networking possibly with bridging to do network boot on local lan.
User avatar
dignome
helper
 
Posts: 786
Joined: Thu Jan 12, 2006 5:09 am

Postby mcreel on Tue Feb 20, 2007 7:21 pm

That's what I understand. The whole thing seems not too difficult, but I don't have the time to really learn about bridging, tap/tun and all that. So I'm hoping that someone will take the project on. If anyone does it, credit will be given on the next release announcement of PK. Ideally, I'm hoping that someone sends me a script to run from a booted PK instance that "just works". By the way, my thanks to Fabrice for the GPL release of kqemu. It works great, and it's a lot easier to install than a year ago. Also, thanks to Antonio L. (not sure of name) for the work on netboot with QEMU.
mcreel
 
Posts: 5
Joined: Tue Feb 20, 2007 11:35 am

Postby Tibors on Tue Feb 20, 2007 7:54 pm

Install http://packages.debian.org/unstable/net/vde2 inside PK. Use it to start a virtual switch every time PK is booted. (I'm not using Debian, so I can't help you with details on this.) If you want to access the cluster only from inside PK, then starting the switch is enough. If you want to access the virtual cluster from the real network, then you have to setup PK as a router. (Which is really simple on linux and there are a gazillion places where it is explained how to do this.)

Launch the PK compute nodes like:
vdeqemu -net nic,macaddr=... -net vde . . .

Implement the netboot inside the compute nodes in the same way you would do it on real computers.
Tibors
helper
 
Posts: 39
Joined: Sat Aug 12, 2006 1:01 pm
Location: Utrecht, The Netherlands

Postby mcreel on Wed Feb 21, 2007 11:30 am

OK, thanks for the suggestion. I'm going to install the package, release a new version, and hope that someone takes on the project of getting it to work.

Hmm, just checked, vde2 is already installed.
mcreel
 
Posts: 5
Joined: Tue Feb 20, 2007 11:35 am


Return to Linux under QEMU

Who is online

Users browsing this forum: No registered users and 0 guests