[CentOS-virt] bridged kvm guest and ever changing MAC address

Tue Feb 16 10:35:13 UTC 2010
Veiko Kukk <veiko at ekp.ee>

compdoc wrote:
> The mac address shouldn't change. Are you setting the mac
> address of the guest to be the same as the host?

I'm not sure what you are asking, but I'm trying to give all relevant
information.

Host interfaces:
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
qlen 100
     link/ether f4:ce:46:b3:87:14 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
     link/ether f4:ce:46:b3:87:15 brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
     link/ether 96:8d:9e:09:0e:6a brd ff:ff:ff:ff:ff:ff
     inet 172.21.1.233/24 brd 172.21.1.255 scope global br0
6: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
qlen 500
     link/ether 96:8d:9e:09:0e:6a brd ff:ff:ff:ff:ff:ff

guest interfaces:
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
qlen 1000
     link/ether 00:16:3e:51:9b:2a brd ff:ff:ff:ff:ff:ff

*before* guest is booted there is no vnet0, when vnet0 goes up, br0 mac
changes from f4:ce:46:b3:87:14 to 96:8d:9e:09:0e:6a

when guest is not running, host's interfaces are:
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
qlen 100
     link/ether f4:ce:46:b3:87:14 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
     link/ether f4:ce:46:b3:87:15 brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
     link/ether f4:ce:46:b3:87:14 brd ff:ff:ff:ff:ff:ff
     inet 172.21.1.233/24 brd 172.21.1.255 scope global br0

guests config file includes:
<interface type='bridge'>
    <mac address='00:16:3e:51:9b:2a'/>
    <source bridge='br0'/>
    <model type='virtio'/>
</interface>

guest's /etc/sysconfig/network-scripts/ifcfg-eth0 includes
HWADDR=00:16:3e:51:9b:2a

host /etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=F4:CE:46:B3:87:14
host /etc/sysconfig/network-scripts/ifcfg-eth1
HWADDR=F4:CE:46:B3:87:15
host /etc/sysconfig/network-scripts/ifcfg-br0
does not have HWADDRESS specified

 From where does come that 96:8d:9e:09:0e:6a ? It seems random.
Forcing HWADDR to br0 has no effect, vnet0 still gets random mac every 
time the guest is started and changes br0 mac to whatever mac vnet0 has 
and when vnet0 goes down, br0 gets eth0's mac address back.

--
Veiko