public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Mac-Address uniqueness
@ 2007-05-31  9:43 Axel Kittenberger
       [not found] ` <465E98B7.5050402-4JhlDu4IDl0juwv8T7myQQ@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Axel Kittenberger @ 2007-05-31  9:43 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hello List!

Im not sure if this better kvm or qemu code that is responsible, but 
since my binary is called "kvm" I'll try this list first, tell me if its 
wrong.

I now have 3 virtual machines on my host (Windows 2003 server, Ubuntu 
etch, an old Suse) and have bridged networking setup.
I used -nic,model=rtl8139 on all machines, maybe because Windows needed 
it, and then I just kept my script...

Unfortunally all machines detect the same ethernet address 
'52:54:00:12:34:56'. Which you can guess what i means, networking comes 
and goes whatever machine last the ethernet address got hold of from the 
gateway. I tried specifing an ethernet-adress with "-net 
nic,macaddr=$MAC" but this also didn't work through.

For now I just hardseted the mac in all machines to 52:54:00:12:34:57, 
52:54:00:12:34:58 and so on.

Greetings, Axel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Mac-Address uniqueness
       [not found] ` <465E98B7.5050402-4JhlDu4IDl0juwv8T7myQQ@public.gmane.org>
@ 2007-05-31 10:42   ` Dor Laor
       [not found]     ` <64F9B87B6B770947A9F8391472E032160C0EFE07-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
  2007-06-01  1:14   ` H. Peter Anvin
  1 sibling, 1 reply; 8+ messages in thread
From: Dor Laor @ 2007-05-31 10:42 UTC (permalink / raw)
  To: Axel Kittenberger, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

>Im not sure if this better kvm or qemu code that is responsible, but
>since my binary is called "kvm" I'll try this list first, tell me if
its
>wrong.
>
>I now have 3 virtual machines on my host (Windows 2003 server, Ubuntu
>etch, an old Suse) and have bridged networking setup.
>I used -nic,model=rtl8139 on all machines, maybe because Windows needed
>it, and then I just kept my script...
>
>Unfortunally all machines detect the same ethernet address
>'52:54:00:12:34:56'. Which you can guess what i means, networking comes
>and goes whatever machine last the ethernet address got hold of from
the
>gateway. I tried specifing an ethernet-adress with "-net
>nic,macaddr=$MAC" but this also didn't work through.
>
>For now I just hardseted the mac in all machines to 52:54:00:12:34:57,
>52:54:00:12:34:58 and so on.

It works for me.
You should have all the -nic parameters in the same option, for example:
"-net nic,macaddr=$MAC,model=rtl8139" otherwise qemu sets the nic for
another vlan object.

>
>Greetings, Axel
>
>-----------------------------------------------------------------------
--
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>_______________________________________________
>kvm-devel mailing list
>kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>https://lists.sourceforge.net/lists/listinfo/kvm-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Mac-Address uniqueness
       [not found]     ` <64F9B87B6B770947A9F8391472E032160C0EFE07-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
@ 2007-05-31 12:18       ` Axel Kittenberger
  0 siblings, 0 replies; 8+ messages in thread
From: Axel Kittenberger @ 2007-05-31 12:18 UTC (permalink / raw)
  To: Dor Laor; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Thanks for the quick answer.
> It works for me.
> You should have all the -nic parameters in the same option, for example:
> "-net nic,macaddr=$MAC,model=rtl8139" otherwise qemu sets the nic for
> another vlan object.
>   
Oh! This explains why lspci showed 3 network cards, stupid me :-)
Still specifing a macaddr, will make the interface not work for me in a 
debian-40r0-i386 host! :-(

So the whole commandline im using is:
/usr/local/bin/kvm-helios -hda /home/machines/helios.img -vnc :1 -boot 
c: -m 1024 -net nic,model=rtl8139,vlan=0,macaddr=52:54:00:12:34:59 -net 
tap,vlan=0,ifname=tap57,script=/etc/qemu-ifup-dmz -localtime -k de 
-pidfile /var/run/kvm-helios.pid

After bootup with macaddr set, the debian system does not autoload any 
modules for eth0.
Attached some response to shell commands:
---------------------------
helios# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE 
[Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Realtek Semiconductor Co., Ltd. 
RTL-8139/8139C/8139C+ (rev 20)
helios# modprobe 8139cp
May 31 16:03:43 helios kernel: 8139cp: 10/100 PCI Ethernet driver v1.2 
(Mar 22, 2004)
May 31 16:03:43 helios kernel: PCI: Enabling device 0000:00:03.0 (0000 
-> 0003)
May 31 16:03:43 helios kernel: ACPI: PCI Interrupt 0000:00:03.0[A] -> 
Link [LNKC] -> GSI 10 (level, low) -> IRQ 10
May 31 16:03:43 helios kernel: eth0: RTL-8139C+ at 0xf883c000, 
52:54:00:12:34:59, IRQ 10
helios# ifconfig eth0
eth0: error fetching interface information: Device not found
---------------------------
While same kvm-parameters but without setting maccdr  with setting the 
macaddr debian autoloads it: (excerpt from /var/log/messages)
---------------------------
May 31 16:06:01 helios kernel: 8139too 0000:00:03.0: This (id 10ec:8139 
rev 20) is an enhanced 8139C+ chip
May 31 16:06:01 helios kernel: 8139too 0000:00:03.0: Use the "8139cp" 
driver for improved performance and stability.
May 31 16:06:01 helios kernel: ACPI: PCI Interrupt Link [LNKC] enabled 
at IRQ 10
May 31 16:06:01 helios kernel: ACPI: PCI Interrupt 0000:00:03.0[A] -> 
Link [LNKC] -> GSI 10 (level, low) -> IRQ 10
May 31 16:06:01 helios kernel: eth0: RealTek RTL8139 at 0xc100, 
52:54:00:12:34:56, IRQ 10
May 31 16:06:01 helios kernel: 8139cp: 10/100 PCI Ethernet driver v1.2 
(Mar 22, 2004)
---------------------------

PS: Beside I actually would be supposed to know it, and suppose setting 
macaddr would work for me, can or can't I use the macaddr linux assigns 
to the 'tap' device?

Kind Regards, Axel



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Mac-Address uniqueness
       [not found] ` <465E98B7.5050402-4JhlDu4IDl0juwv8T7myQQ@public.gmane.org>
  2007-05-31 10:42   ` Dor Laor
@ 2007-06-01  1:14   ` H. Peter Anvin
       [not found]     ` <465F72EA.9080608-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2007-06-01  1:14 UTC (permalink / raw)
  To: Axel Kittenberger; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Axel Kittenberger wrote:
> 
> Unfortunally all machines detect the same ethernet address 
> '52:54:00:12:34:56'. Which you can guess what i means, networking comes 
> and goes whatever machine last the ethernet address got hold of from the 
> gateway. I tried specifing an ethernet-adress with "-net 
> nic,macaddr=$MAC" but this also didn't work through.
> 
> For now I just hardseted the mac in all machines to 52:54:00:12:34:57, 
> 52:54:00:12:34:58 and so on.
> 

This is a Qemuism.  I always thought it was dumb, but I guess Qemu
wanted reproducibility over everything.

IMNSHO it would have been much better to default to a random value
(meaning that all except the bottom 2 bits of the first octet are
random, those bits should be set to 10 binary.)

	-hpa

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Mac-Address uniqueness
       [not found]     ` <465F72EA.9080608-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
@ 2007-06-01  6:26       ` Avi Kivity
       [not found]         ` <465FBC08.7000102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Avi Kivity @ 2007-06-01  6:26 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Axel Kittenberger

H. Peter Anvin wrote:
> Axel Kittenberger wrote:
>   
>> Unfortunally all machines detect the same ethernet address 
>> '52:54:00:12:34:56'. Which you can guess what i means, networking comes 
>> and goes whatever machine last the ethernet address got hold of from the 
>> gateway. I tried specifing an ethernet-adress with "-net 
>> nic,macaddr=$MAC" but this also didn't work through.
>>
>> For now I just hardseted the mac in all machines to 52:54:00:12:34:57, 
>> 52:54:00:12:34:58 and so on.
>>
>>     
>
> This is a Qemuism.  I always thought it was dumb, but I guess Qemu
> wanted reproducibility over everything.
>
> IMNSHO it would have been much better to default to a random value
> (meaning that all except the bottom 2 bits of the first octet are
> random, those bits should be set to 10 binary.)
>
>   

That tends to consume dhcp leases quickly, if you start guests often (as
I do).  Also, some distributions use the mac address as a key for naming
interfaces; if it changes, the guest gets confused


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Mac-Address uniqueness
       [not found]         ` <465FBC08.7000102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-06-01  6:43           ` H. Peter Anvin
       [not found]             ` <465FC01F.4050105-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
  2007-06-01 10:19           ` Axel Kittenberger
  1 sibling, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2007-06-01  6:43 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Axel Kittenberger

Avi Kivity wrote:
> H. Peter Anvin wrote:
>> Axel Kittenberger wrote:
>>   
>>> Unfortunally all machines detect the same ethernet address 
>>> '52:54:00:12:34:56'. Which you can guess what i means, networking comes 
>>> and goes whatever machine last the ethernet address got hold of from the 
>>> gateway. I tried specifing an ethernet-adress with "-net 
>>> nic,macaddr=$MAC" but this also didn't work through.
>>>
>>> For now I just hardseted the mac in all machines to 52:54:00:12:34:57, 
>>> 52:54:00:12:34:58 and so on.
>>>
>>>     
>> This is a Qemuism.  I always thought it was dumb, but I guess Qemu
>> wanted reproducibility over everything.
>>
>> IMNSHO it would have been much better to default to a random value
>> (meaning that all except the bottom 2 bits of the first octet are
>> random, those bits should be set to 10 binary.)
>>
>>   
> 
> That tends to consume dhcp leases quickly, if you start guests often (as
> I do).  Also, some distributions use the mac address as a key for naming
> interfaces; if it changes, the guest gets confused
> 

The right solution to that, of course, is a VM definitions file, so the
random Ethernet address is only generated once.  For Qemu/KVM, that
could at least in theory simply be a shell script.

	-hpa

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Mac-Address uniqueness
       [not found]         ` <465FBC08.7000102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  2007-06-01  6:43           ` H. Peter Anvin
@ 2007-06-01 10:19           ` Axel Kittenberger
  1 sibling, 0 replies; 8+ messages in thread
From: Axel Kittenberger @ 2007-06-01 10:19 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, H. Peter Anvin


> That tends to consume dhcp leases quickly, if you start guests often (as
> I do).  Also, some distributions use the mac address as a key for naming
> interfaces; if it changes, the guest gets confused
>   

Couldn't we do some sort of hash on the image path+filename? So same 
image starts always with same MAC, different images -> different mac 
adresses. I guess I am supposed to post this suggestion on the qemu 
mailinglist. ;-)

- Axel

PS: Other topic, I still wonder how a guest can bevahe totally different 
on networking (unable to use network) when macaddr is set by kvm 
parameters? For me this sounds like a bug, not?

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Mac-Address uniqueness
       [not found]             ` <465FC01F.4050105-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
@ 2007-06-01 13:09               ` Daniel P. Berrange
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel P. Berrange @ 2007-06-01 13:09 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Axel Kittenberger

On Thu, May 31, 2007 at 11:43:43PM -0700, H. Peter Anvin wrote:
> Avi Kivity wrote:
> > H. Peter Anvin wrote:
> >> Axel Kittenberger wrote:
> >>   
> >>> Unfortunally all machines detect the same ethernet address 
> >>> '52:54:00:12:34:56'. Which you can guess what i means, networking comes 
> >>> and goes whatever machine last the ethernet address got hold of from the 
> >>> gateway. I tried specifing an ethernet-adress with "-net 
> >>> nic,macaddr=$MAC" but this also didn't work through.
> >>>
> >>> For now I just hardseted the mac in all machines to 52:54:00:12:34:57, 
> >>> 52:54:00:12:34:58 and so on.
> >>>
> >>>     
> >> This is a Qemuism.  I always thought it was dumb, but I guess Qemu
> >> wanted reproducibility over everything.
> >>
> >> IMNSHO it would have been much better to default to a random value
> >> (meaning that all except the bottom 2 bits of the first octet are
> >> random, those bits should be set to 10 binary.)
> >>
> >>   
> > 
> > That tends to consume dhcp leases quickly, if you start guests often (as
> > I do).  Also, some distributions use the mac address as a key for naming
> > interfaces; if it changes, the guest gets confused
> > 
> 
> The right solution to that, of course, is a VM definitions file, so the
> random Ethernet address is only generated once.  For Qemu/KVM, that
> could at least in theory simply be a shell script.

This is the approach we use in libvirt. If the user defines a guest and
does not provide a mac address, we generate one for each NIC and store
it in the config file, so every time it gets the same MAC. 

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-06-01 13:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-31  9:43 Mac-Address uniqueness Axel Kittenberger
     [not found] ` <465E98B7.5050402-4JhlDu4IDl0juwv8T7myQQ@public.gmane.org>
2007-05-31 10:42   ` Dor Laor
     [not found]     ` <64F9B87B6B770947A9F8391472E032160C0EFE07-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-05-31 12:18       ` Axel Kittenberger
2007-06-01  1:14   ` H. Peter Anvin
     [not found]     ` <465F72EA.9080608-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2007-06-01  6:26       ` Avi Kivity
     [not found]         ` <465FBC08.7000102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-01  6:43           ` H. Peter Anvin
     [not found]             ` <465FC01F.4050105-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2007-06-01 13:09               ` Daniel P. Berrange
2007-06-01 10:19           ` Axel Kittenberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox