qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] patch for allowing automated IP assignment based on MAC


From: jamal
Subject: [Qemu-devel] patch for allowing automated IP assignment based on MAC
Date: Sat, 23 Apr 2005 18:08:30 -0400

Folks,

Played a little bit with qemu 0.6.1; looks very interesting - still need
to discover more. 

I am trying to use the same image for multiple qemu guests but it was
kind of annoying to customize images... So what this patch allows is to
have something along the lines of:


-nics 2 -macaddr0 00:11:a:0:2:19 -macaddr1 00:11:a:0:1:19 -ID1 1 -ID2 2 
on the command line to create eth0 and eth1 on the booted qemu
with two interfaces:
       Eth0: MAC 00:11:a:0:2:19 - IP 10.0.2.25
       Eth1: MAC 00:11:a:0:1:19 - IP 10.0.1.25

This way if i pass different parameters for the next time i boot or if i
boot a second qemu i can use different IP addresses.

On the guest fs you will need a little utility i am attaching - code
could use some cleanup to look at the MAC addresses and convert them to
IP addresses. You pass the device name to it. I compiled it and put it
in /sbin/eth2ip; my scripts to bring up devices first call it
as /sbin/eth2ip ethx. It takes the device, ifconfigs it up then attaches
an IP address extracted from the MAC address to it.

Theres probably an easy way to do this - but i am just in the process of
discovering qemu - so please let me know. 
Else if it doesnt exist and you like this patch please apply it. 
I am not on the list so please CC me on any responses.

cheers,
jamal

Attachment: ethmac2ip.c
Description: Text Data

Attachment: qemu-p
Description: Text document


reply via email to

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