qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] how configure network into backing file without using


From: Jakob Bohm
Subject: Re: [Qemu-discuss] how configure network into backing file without using vnc
Date: Thu, 19 Jul 2012 12:35:16 +0200
User-agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1

On 7/19/2012 12:17 PM, Simon Poulleau wrote:
Hello,

I am currently developing a Bash script which aims to provide users several virtual machines. These machines must be reachable through the network.

After preparing and installing a first virtual machine, I create several backing files in order to start several identical virtual machines.

The problem: I want my virtual machines to be reachable on the network. But when they have completed their boot, no network interface is configured with the exception of the loopback.

There are 4 things you can do:

A) configure the base image to use DHCP and to not insist on having the same MAC address each time

B) loop mount each image (if the image is not in raw format, there are qemu tools to mount it anyway), change appropriate config files and unmount it. This can be done from a bash script running as root

C) mount each image as the "second hard disk" of an "automatic editing" virtual machine, which mounts it, changes appropriate config files, unmounts it and shuts itself down. This can be done with bash scripts without being root on the host machine, only on the virtual "automatic editing" virtual machine.

D) In the base image install a private bash script in /etc/init.d which configures the virtual machine on first boot. Clear/Set whatever flags your script uses to determine if this is the first boot just before saving the base image, thus ensuring it is run once in each copied image.

I tried to start my virtual machines using the user network, but I succeed in configuring only one virtual machine based on backing file. Others have only the loopback interface configured.

Hence my questions:
Is it possible to assign IP address to virtual machine based on backing file ? (Having conducted tests through vnc I would say yes)

The important thing to remember is to use qemu options to give each virtual machine a different MAC address for its virtual network card. If you set that MAC address based on the name/location of the virtual hard drive in a systematic manner, you can then configure your DHCP server to hand out specific IP address, computer name etc. corresponding to what you want for each virtual machine.

Is it possible to mount a backing file image to create a file enabling to configure the network via dhcp when virtual machine is booting (eg: ifcfg-eth0) ? Are there any other way from a Bash script to configure the network of a virtual machine run from a backing file.

I hope I was clear on the problem I have, do not hesitate to ask me for details.


Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded




reply via email to

[Prev in Thread] Current Thread [Next in Thread]