I'm running two guest machines under KVM. The host is running Arch Linux (kernel version 2.6.38.2), the guests are both CentOS 5.5 (kernel version 2.6.18). I have the networking set up as a bridge, more-or-less as follows (I'm not doing it by hand, of course -- it's scattered through the system startup scripts)

The configuration mostly works. What's odd is that I get frequent network "pauses". Most of my interactions with the virtual machines are through ssh or a web browser. Often, particularly after idle times, I'll go to type something in the session or access a web page, and nothing will happen. Eventually, after 10-15 seconds, normal activity will resume without error. ssh keystrokes from the dead time go through in a rush. Web requests seem to be lost, but a quick "reload page" gets the result without delay. The virtual machine as a whole continues to run the whole time, as I can see by watching the VNC session to the console. The two guests are independent in this way. Sometimes both will be frozen at the same time, but sometimes one will be working fine while the other is frozen. There are no errors in dmesg at the time of the freeze, on the host or guest.

2 Answers
2

Long answer: For each virtual machine, qemu creates a virtual network card. It assigns a MAC address to this virtual NIC. By default, it assigns a fixed address (52:54:00:12:34:56) to every NIC. If you start more than one guest on the same host, they all get this same fixed address. You can even see this in the ifconfig outputs in my original question. Naturally, this is a problem if you bridge the guests together, since it's the same as having two physical machines with the same MAC address on the same net. ARP does its best and flips back and forth between them, but with long timeouts, giving me the results I was seeing.

So, the solution is to add "macaddr=..." flags to the -net parameter for each guest, such that each one has a unique MAC address. Example:

In my opinion, qemu's default behavior should be smarter about this, but I suppose it's fairly important that each guest get the same MAC address every time it's started, regardless of the order they're started in. Perhaps the authors couldn't think of a way to ensure this.

Regardless, if you're running multiple guests on the same network (virtual or otherwise), make sure you set the MAC addresses explictly and uniquely. Otherwise, you'll run into the same problem.