I have two debian9.1-VMs running on one KVM host.
If they are both on VLAN1, I can ssh from one VM to the other.
If they are both on another VLAN, they can ping but can't ssh each other.
If there is a third VM in that VLAN on another KVM host, this VM can ssh the other two VMs and they can ssh that VM.
What is the reason, why ssh is not working, if the VMs are running on the same hypervisor?
And what do I have to change on the KVM host for letting the VMs on it connect to each other - without having the KVM host in that VLAN too?
As a test I did a fresh installation of debian9.1. Then:
apt-get install vlan modprobe 8021q echo "8021q" >>/etc/modules
After that, I modified
/etc/network/interfaces on the VMs like this:
allow-hotplug ens3 #iface ens3 inet dhcp auto ens3.23 iface ens3.23 inet static address 192.168.23.11 # .12 / .21 on the other ones netmask 255.255.255.0 vlan-raw-device ens3
Now the VMs are tagging all packets for VLAN23. I can see these tags on my switch, if there was communication between the VMs on the different KVM hosts.
And the result is: (VMs .11 and .12 are on KVM1, .21 is on KVM2)
.11 <-> .12 ==> no connect .11 <-> .21 ==> connect .12 <-> .21 ==> connect
EDIT: it's no longer important. I found a workaround.
The NICs were on
After setting them to
rtl8139 everything is fine ... and now it's possible to ssh from one VM to another - even if they are running on the same hypervisor.