I have a KVM/QEMU
setup with both host & guest (VM) running Ubuntu 18.04 LTS
with bridged networking
. VMs are configured with static IP loose network connectivity randomly (there is no pattern). VMs which are configured with DHCP works fine.
Here is my host network config,
network:
version: 2
ethernets:
eno1:
dhcp4: no
dhcp6: no
eno4:
dhcp4: true
eno5np0:
dhcp4: true
eno6np1:
dhcp4: true
ens2f0np0:
dhcp4: true
ens2f1np1:
dhcp4: true
bridges:
br0:
interfaces: [eno1]
dhcp4: no
addresses:
- 10.2.0.92/24
gateway4: 10.2.1.252
nameservers:
addresses:
- 8.8.8.8
Here is my vm (guest) network config with static IP,
network:
version: 2
ethernets:
ens3:
dhcp4: no
addresses:
- 10.2.0.210/23
gateway4: 10.2.1.252
nameservers:
addresses:
- 8.8.8.8
Here is my vm (guest) network config with DHCP,
network:
version: 2
ethernets:
ens3:
dhcp4: true
VMs with static IP goes into kind of idle state. So when ever trying to SSH or access the services in that, it takes time then it connects,
$ nc -z -v -w5 10.2.0.210 22
nc: connect to 10.2.0.210 port 22 (tcp) timed out: Operation now in progress
Try again, it will work, because the VM moved from idle to working state because of the first try,
$nc -z -v -w5 10.2.0.210 22
Connection to 10.2.0.210 22 port [tcp/ssh] succeeded!
There is no issue with VMs which has DHCP. It connects just fine any time,
$ nc -z -v -w5 10.2.0.184 22
Connection to 10.2.0.184 22 port [tcp/ssh] succeeded!
I have checked the following links,
- KVM images lose connectivity with bridged network
- KVM QEMU Guest VMs randomly lose network connection
but it didn't help.
Any issue in the KVM configuration? Not only SSH, but any services exposed in the VMs are also not accessible. I have verified that VMs are in running state
when I query virsh
.