Skip to contentSkip to conversation

Certain Mac Address doesn't work in KVM virtual NICs.

DISCUSSION Yueyu Lin 4 participants 7 messages Dec 21, 2010 KVM

lore
Share & tools
lore

Yueyu Lin

author
#0 lore raw

Hello, everyone
I just encountered a very strange issue in Ubuntu 10.10 server edition X86 64bits. I just start up my kvm like :
kvm -net nic,macaddr=B3:C0:64:AF:73:28,model=virtio -net tap,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,ifname=tap2 -enable-kvm -drive file=cassandra.raw,format=raw,aio=native -vnc :2
This Mac address doesn't work at all. No working means the virtual machine just thinks the eth0 is not plugged in. After I changed the MAC address, it works as I expected.
Are there any restrictions that I can't use certain MAC addresses?

#1 lore raw
Quoted 11 lines · Yueyu Lin

Hello, everyone
I just encountered a very strange issue in Ubuntu 10.10 server
edition X86 64bits. I just start up my kvm like :
kvm -net nic,macaddr=B3:C0:64:AF:73:28,model=virtio -net tap,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,ifname=tap2 -enable-kvm -drive file=cassandra.raw,format=raw,aio=native -vnc :2
This Mac address doesn't work at all. No working means the
virtual machine just thinks the eth0 is not plugged in. After I changed the MAC address, it works as I expected.
Are there any restrictions that I can't use certain MAC
addresses?--

Sure

First byte must be even.

B3 is odd, so its not valid.

low order bit is a marker for 'multicast'

#2 lore raw
Quoted 14 lines · Eric Dumazet
Quoted 11 lines · Yueyu Lin

Hello, everyone
      I just encountered a very strange issue in Ubuntu 10.10 server edition X86 64bits.  I just start up my kvm like :
kvm -net nic,macaddr=B3:C0:64:AF:73:28,model=virtio -net tap,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,ifname=tap2 -enable-kvm -drive file=cassandra.raw,format=raw,aio=native -vnc :2 This Mac address doesn't work at all. No working means the virtual machine just thinks the eth0 is not plugged in. After I changed the MAC address, it works as I expected.
      Are there any restrictions that I  can't use certain MAC addresses?--

Quoted 7 lines

Sure

First byte must be even.

B3 is odd, so its not valid.

low order bit is a marker for 'multicast'

See here for reference: http://en.wikipedia.org/wiki/MAC_address

Typically also makes sense to set the locally administered bit to avoid collisions with real devices too.

Alex

#3 lore raw
Quoted 19 lines · Alex Williamson
Quoted 18 lines · Eric Dumazet
Quoted 11 lines · Yueyu Lin

Hello, everyone
I just encountered a very strange issue in Ubuntu 10.10 server
edition X86 64bits. I just start up my kvm like :
kvm -net nic,macaddr=B3:C0:64:AF:73:28,model=virtio -net tap,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,ifname=tap2 -enable-kvm -drive file=cassandra.raw,format=raw,aio=native -vnc :2
This Mac address doesn't work at all. No working means the
virtual machine just thinks the eth0 is not plugged in. After I changed the MAC address, it works as I expected.
Are there any restrictions that I can't use certain MAC
addresses?--

Sure

First byte must be even.

Quoted 8 lines
Quoted 3 lines

B3 is odd, so its not valid.

low order bit is a marker for 'multicast'

See here for reference: http://en.wikipedia.org/wiki/MAC_address

Typically also makes sense to set the locally administered bit to avoid collisions with real devices too.

KVM should warn the user the given MAC address is wrong. ifconfig does :

# ifconfig eth3 hw ether F4:CE:46:87:96:CF
# ifconfig eth3 hw ether F5:CE:46:87:96:CF
SIOCSIFHWADDR: Invalid argument
author
#4 lore raw

Thanks a lot. I got the point and I got the exact warning in the virtual machine indeed.

Besides the least significant bit should be 0 for the first byte, should I set the second least significant bit to 1 to enforce it as local administrated instead of OUI enforced?

Quoted 40 lines · Eric Dumazet
Quoted 19 lines · Alex Williamson
Quoted 18 lines · Eric Dumazet
Quoted 11 lines · Yueyu Lin

Hello, everyone
I just encountered a very strange issue in Ubuntu 10.10 server
edition X86 64bits. I just start up my kvm like :
kvm -net nic,macaddr=B3:C0:64:AF:73:28,model=virtio -net tap,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,ifname=tap2 -enable-kvm -drive file=cassandra.raw,format=raw,aio=native -vnc :2
This Mac address doesn't work at all. No working means the
virtual machine just thinks the eth0 is not plugged in. After I changed the MAC address, it works as I expected.
Are there any restrictions that I can't use certain MAC
addresses?--

Sure

First byte must be even.

Quoted 8 lines
Quoted 3 lines

B3 is odd, so its not valid.

low order bit is a marker for 'multicast'

See here for reference: http://en.wikipedia.org/wiki/MAC_address

Typically also makes sense to set the locally administered bit to avoid collisions with real devices too.

KVM should warn the user the given MAC address is wrong. ifconfig does :

# ifconfig eth3 hw ether F4:CE:46:87:96:CF
# ifconfig eth3 hw ether F5:CE:46:87:96:CF
SIOCSIFHWADDR: Invalid argument
#5 lore raw
Quoted 3 lines · Yueyu Lin

Thanks a lot. I got the point and I got the exact warning in the virtual machine indeed.

Besides the least significant bit should be 0 for the first byte,  should I set the second least significant bit to 1 to enforce it as local administrated instead of OUI enforced?

Anytime you change the MAC address of a physical or virtual device away from the (hopefully) globally unique address in the factory settings
it is a good idea to set the locally administrated bit as well. It makes it easier when analyzing network traces to see what are from physical and what are from virtual devices.

So I say yes, set that bit.

regards
ronnie sahlberg

author
#6 lore raw

Thanks a lot for your advice!
A lot of appreciations.

Quoted 17 lines · ronnie sahlberg
Quoted 3 lines · Yueyu Lin

Thanks a lot. I got the point and I got the exact warning in the virtual machine indeed.

Besides the least significant bit should be 0 for the first byte, should I set the second least significant bit to 1 to enforce it as local administrated instead of OUI enforced?

Anytime you change the MAC address of a physical or virtual device away from the (hopefully) globally unique address in the factory settings
it is a good idea to set the locally administrated bit as well. It makes it easier when analyzing network traces to see what are from physical and what are from virtual devices.

So I say yes, set that bit.

regards
ronnie sahlberg