Linux bridge: MAC addresses and dynamic ports

Scenario: KVM virtualization host running several bridged guests. The host has a bridge interface br0 that starts out containing only eth0, and other interfaces are dynamically added and removed from the bridge as guests are started and stopped.
The problem is, the host seems to randomly suffer some loss of connectivity (from a few to 30-40 seconds) when some guest is started or stopped. Initially one might think of something related to STP, but it turns out that it is disabled (and even then, ports appearing or disappearing should not affect existing ports).

What happens here is that, when a new guest is started, a tap interface is created and enslaved to the bridge (the tap interface is usually connected to the guest’s own ethernet interface). This interface has a name like vnet5, for example. Minor but important detail, this tap interface has a more or less random MAC address. (Note that we’re talking of the host-side tap interface, not the guest-side virtual interface, whose MAC address is configurable in the guest’s configuration file or on the command line). It is theoretically possible to set the MAC address of this host-side tap interface, but it’s quite involved and basically nobody does that (and also virt-manager has no provision to do that).

Now, by default bridge interfaces in Linux use, for their MAC address, the lowest MAC address among the enslaved interfaces. So if the newly created interface has a lower MAC, the bridge changes its MAC address and uses that of the new interface. When the guest is stopped, the tap interface is removed from the bridge and destroyed, at which point the bridge’s MAC address has to change again. Depending on when and how often guests are started/stopped, the host’s bridge interface may be changing its MAC address quite often.

Of course, this may (and does) cause connectivity problems for traffic to/from the host (fortunately, traffic to/from the guests is not affected), because neighboring computers and network devices suddenly have to update their ARP caches with the new MAC address before they can talk to the host. Depending on the traffic patterns, this may take anything from a few seconds to several tens of seconds.

Читати далі

Vagrant: libvirt library not found in default locations (RuntimeError)

vagrant plugin install vagrant-libvirt Installing the ‘vagrant-libvirt’ plugin. This can take a few minutes… Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is: An error occurred while installing ruby-libvirt … Читати далі

Конвертация xva в KVM формат qcow2

Итак…имеем XenServer на котором крутятся виртуалки.
Задача: нужно перенести их в другое место. А под рукой есть только сервак с KVM

Заходим на Xenserver, делаем Snapshot и сохраняем его куда то.
Закидываем бекап на сервер с KVM
Наш файл имеет формат xva, это ни что иное как обычный архив

Распаковываем его

tar vxf vm1.xva
.....
tar: Ref:50/00008193: implausibly old time stamp 1970-01-01 01:00:00
tar: Ref:50/00008193.checksum: implausibly old time stamp 1970-01-01 01:00:00
...

Читати далі

Управляем KVM через браузер с помощью WebVirtMgr

При работе с системами виртуализации всегда хочеться получить доступ к хост-машине с любой точки мира и с любого устройства которое есть под рукой. Если пользоваться штатными инструментами KVM, XenServer, VMWare то там необходима установленая консоль управления на локальном ПК и если нужно сделать, что то удаленно и быстро то возникают проблемы… начинаеш ставить консоль, не хватает .Net… поставил его, не хватает чего то другого. В результате, иногда, чтоб перегрузить умершую виртуалку требуется 30-60мин пока все скачаеш и поставишь. Хотя все это можно проделать с консоли за 30сек 🙂
Но мы не об этом.

Тут будет актуально имет скорый доступ к управлению через браузер, что даст возможность подключится даже с телефона.
Приступим к настройке.
Исходные данные: Debian 7.7
Настраиваем все с нуля.

Читати далі