Centos – KVM Isolated network between host and guest fails after few hours

centoskvm-virtualizationnetworking

I have a KVM CentOS host with several CentOS guests. All of the guests are using a bridge for network communication. The guests have been up and operational for several months and work properly. The guests can not communicate directly with the host due to the bridge based network configuration. As I understand this is normal. Source: Libvirt – macvtap

I now have a scenario where I want a guest to be able to communicate with the host for management purposes. Using the same article above from libvirt.org, I configured an "isolated" virtual network on the host:

<network connections='1'>
  <name>isolated</name>
  <uuid>xxxxx-xxxx-xxxxx-xxxxx-xxxxx</uuid>
  <bridge name='virbr1' stp='on' delay='0' />
  <mac address='xx:xx:xx:xx:xx:xx'/>
  <ip address='10.4.4.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='10.4.4.2' end='10.4.4.6' />
    </dhcp>
    </ip>
</network>

Then I added a new network interface on the guest:

<interface type='network'>
  <mac address='xx:xx:xx:xx:xx:xx'/>
  <source network='isolated'/>
  <target dev='vnet13'/>
  <model type='virtio'/>
  <alias name='net1'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</interface>

When I rebooted the guest, the guest received a new address from the host "isolated" network and everything seemed to be working great. Then a few hours later, the "isolated" network appeared to stop communicating. Restarting networking on the guest would not fix the problem. It appeared the dhcp clinet on the guest could not get an address, and I saw log records in /var/log/messages indicating such:

guest-host NetworkManager[684]: <warn> (eth1): DHCPv4 request timed out.

I reconfigured the isolated network on the host and the guest to be static. The host and guest still would not communicate.

I ended up shutting down the guest, deleting the guest "isolated" network interface, and adding a new interface on the guest for the "isolated" network. When I powered the guest back on, the network was working again. However, an hour later the network was not communicating again and it's failing to obtain a dhcp address. It would seem the issue is with the "isolated" network between the host and guest, and not a DHCP specific problem.

The bridge based network on all the hosts continues to work fine throughout this period.

Best Answer

Looks like I created this problem my self by restarting the firewall on my host, for other reasons. Libvirtd adds network filter rules to the firewall when libvirtd starts up. Restarting your firewall will remove these rules. You need to restart libvirtd if you restart your firewall.