September 17, 2012

KVM in bridge mode networking and PXE boot issues

Today I encountered a quirky issue with running KVM guests in bridged networking mode on the host and I thought it might be useful to share it, as someone else might find it useful.

I run an entire testing and development environment based on KVM. All hosts are running CentOS 5 configured with a bridge interface which links the physical interface with all the virtual interfaces assigned to each virtual machine. I was trying to install a new KVM on a host which already had other guests running. Those guests didn’t have any networking issues. Every new server is installed via PXE (network) book in this environment, but these two new boxes I was trying to install just didn’t want to boot from the network. I went about the usual troubleshooting route but nothing seemed wrong - the packets just wouldn’t reach the DHCP / PXE server.

In the end I went back to our friendly neighbourhood search engine and found this bug: https://bugzilla.redhat.com/show_bug.cgi?id=586324

It seems that the bridge interfaces on CentOS / Redhat have a default (packet) forwarding delay of 15 seconds. I am not sure about Debian based distros but it just might be the same. This forwarding delay is too long, longer than the DHCP timeout. So the guests never received an IP address, hence could not boot. The solution is very simple - set the forwarding delay to 0:

# brctl setfd <bridge name> 0