[SOLVED] Network bridging MAC conflicts in KVM after system rebuild

Issues related to configuring your network
mightytater
Posts: 6
Joined: 2011/03/24 20:51:02
Location: Denton, TX

[SOLVED] Network bridging MAC conflicts in KVM after system rebuild

Post by mightytater » 2011/03/24 21:22:39

Hey All,

After restoring from a hardware failure, I cannot get bridging to work again. I reinstalled the host version 5.5, and copied the .img file back onto the rebuilt machine. I also had the network scripts and iptables backed up. Through virt-manager I re-attached the virtual machine, and when I boot it, I get a MAC address conflict on the vm's eth0; "Device eth0 has a different MAC address than expected". The vm had a static ip address. Any help is greatly appreciated!

[code]
[root@trngvh ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HWADDR=00:24:81:E4:FC:02
ONBOOT=yes
BRIDGE=br1
BOOTPROTO=dhcp
TYPE=Ethernet

[root@trngvh ~]# cat /etc/sysconfig/network-scripts/ifcfg-br1
DEVICE=br1
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0

[root@trngvh ~]# brctl show
bridge name bridge id STP enabled interfaces
br1 8000.002481e4fc02 no eth1
br2 8000.002481e4fc04 no eth2
br3 8000.002481e4fc06 no eth3

[root@trngvh ~]# cat /etc/sysconfig/iptables | grep bridge
-A FORWARD -m physdev --physdev-is-bridged -j ACCEPT

[root@trngvh ~]# cat /etc/libvirt/qemu/trngvg-mail.xml
<domain type='kvm'>
<name>trngvg-mail</name>
<uuid>1dc79119-7741-5469-0f58-a7b3780dd62a</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='rhel5.4.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' cache='none'/>
<source file='/var/lib/libvirt/images/trngvg-mail.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='bridge'>
<mac address='54:52:00:48:2f:b1'/>
<source bridge='br1'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/5'/>
<target port='0'/>
</serial>
<console type='pty' tty='/dev/pts/5'>
<source path='/dev/pts/5'/>
<target port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
</devices>
</domain>
[/code]

[Moderator edited to insert [i]code[/i] tags to preserve the formatting.]

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Network bridging MAC conflicts in KVM after system rebuild

Post by pschaff » 2011/03/25 02:23:20

Welcome to the CentOS fora. Reading [url=https://www.centos.org/modules/newbb/viewforum.php?forum=47]FAQ & Readme First[/url] is recommended for new users.

[quote]
mightytater wrote:
...
HWADDR=00:24:81:E4:FC:02
...

...[/quote]
Not a KVM expert, but I'd change the 2nd MAC address to match the first, or possibly the other way around.

mightytater
Posts: 6
Joined: 2011/03/24 20:51:02
Location: Denton, TX

Re: Network bridging MAC conflicts in KVM after system rebuild

Post by mightytater » 2011/03/25 03:47:12

Thanks for the reply... you are right, they should be the same. Yet, I'm using virt-manager and changing the MAC of the vm to match that of the physical eth1 interface solicits "The MAC address you entered conflicts with a device on the physical host."

Through virsh:

virsh # attach-interface trngvg-mail bridge br1 --target eth0 --mac 00:24:81:E4:FC:02
error: this function is not supported by the hypervisor: device type 'interface' cannot be attached

mightytater
Posts: 6
Joined: 2011/03/24 20:51:02
Location: Denton, TX

Re: Network bridging MAC conflicts in KVM after system rebuild

Post by mightytater » 2011/03/25 14:03:18

I couldn't add the MAC address to the br1 interface using virt-manager.
I couldn't add it in using virsh

I was able to modify the .xml file to include:





and then run:
[root@trngvh ~]# virsh define .xml

User avatar
toracat
Forum Moderator
Posts: 7457
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

[SOLVED] Network bridging MAC conflicts in KVM after system

Post by toracat » 2011/03/25 14:50:34

The mac address of a kvm guest typically starts with a "54:52". You got the "The MAC address you entered conflicts with a device on the physical host" error because the mac address in the .xml file is the same as the host's. Can you [i]log on[/i] to the guest (through console or by using virt-viewer) and find out what mac address it is set to (look at ifcfg-eth0 on the guest)?

User avatar
jlehtone
Posts: 3354
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Network bridging MAC conflicts in KVM after system rebuild

Post by jlehtone » 2011/03/25 17:28:21

Yes. The MAC of a virtual NIC of the host must be set different from any
physical MAC on the host (and LAN). The KVM examples all do use
"54:52:00" for the vendor part. Some bits of that are actually meaningful
according to Wikipedia, so its better to stick to the example.

The virtual NIC is enslaved to the bridge. But your 'brctl show' does not
show it.

Is it really the guest that gives the error? Why would the MAC of guest have
changed? Why would there be a bridge in the guest?

Are all three interfaces of your host bridged intentionally?

You said "hardware failure". Motherboard/NICs? Did you change the "HWADDR"
of the host's interface scripts to match the current physical MAC?

mightytater
Posts: 6
Joined: 2011/03/24 20:51:02
Location: Denton, TX

Re: Network bridging MAC conflicts in KVM after system rebuild

Post by mightytater » 2011/03/25 19:53:02

Yes, the MAC address on the host's eth1 (and br1) is the same as what is defined for the guest's eth0. If, from virt-manager, I delete the br1 interface and then re-add it, the guest eth0 is given a new hwaddr in the "54:52" spectrum.

Also, the host shows the bridge is enslaved to vnet0 now:
[code]
[root@trngvh network-scripts]# brctl show
bridge name bridge id STP enabled interfaces
br1 8000.002481e4fc02 no vnet0
eth1
br2 8000.002481e4fc04 no eth2
br3 8000.002481e4fc06 no eth3
[/code]
But, with the new MAC, eth0 does not fire at boot time. It "has a different address than expected". And when I start it manually, it does not accept the IP address defined in ifcfg-eth0.

mightytater
Posts: 6
Joined: 2011/03/24 20:51:02
Location: Denton, TX

Re: Network bridging MAC conflicts in KVM after system rebuild

Post by mightytater » 2011/03/25 19:59:19

[quote]
....
Is it really the guest that gives the error? Why would the MAC of guest have
changed? Why would there be a bridge in the guest?
[/quote]
I'm not sure what's the root of the problem... To me, it seems most likely that the network config on the host hasn't been restored properly, or I haven't restored my virtual machine the correct way.
[quote]
Are all three interfaces of your host bridged intentionally?
[/quote]
They will be, eventually.
[quote]
You said "hardware failure". Motherboard/NICs? Did you change the "HWADDR"
of the host's interface scripts to match the current physical MAC?[/quote]
It was a drive failure, or more appropriately, repartitioning gone wrong.

User avatar
jlehtone
Posts: 3354
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Network bridging MAC conflicts in KVM after system rebuild

Post by jlehtone » 2011/03/26 17:25:15

[quote]mightytater wrote:
But, with the new MAC, eth0 does not fire at boot time. It "has a different address than expected". And when I start it manually, it does not accept the IP address defined in ifcfg-eth0.[/quote]
Ok, lets recap: Network on a (guest) machine with a NIC that has 54:52:* MAC.

Assuming that you have only one NIC in the guest, you should not need HWADDR.
If the NIC does not show up as 'eth0', then you do have something else, probably
a udev rule, renaming NICs in the guest. HWADDR is a RedHat way of renaming
NICs, but for example Fedora has moved on to udev rules for doing the same.

Note: MACADDR is a way to change MAC of a device for runtime.

Take out the HWADDR. See what device-name you do get. Configure for that
device.

I do get the impression that you do use a static IP in the guest. Could you resort
to external DHCP? After all, your guest is bridged to the LAN.

mightytater
Posts: 6
Joined: 2011/03/24 20:51:02
Location: Denton, TX

Re: Network bridging MAC conflicts in KVM after system rebuild

Post by mightytater » 2011/03/27 01:06:33

[quote]
jlehtone wrote:
...
Take out the HWADDR. See what device-name you do get. Configure for that
device.
...

[/quote]

Amazing. Works great. Thanks!

Post Reply

Return to “CentOS 5 - Networking Support”