Linux – Two Node Libvirt Cluster with vxlan

kvm-virtualizationlinuxnetworking

I have two physical Ubuntu nodes, NodeA and NodeB.

On each node, I would like host libvirt guests within their own dedicated subnet. NodeA's guest network is 192.168.1.0/24, and NodeB's guest network is 192.168.2.0/24.

I need guests in NodeA be able to ping/reach guests in NodeB, and viceversa.

I have a vxlan interface on each node, 172.16.1.1/24 is assigned to the vxlan interface on NodeA, and 172.16.1.2/24 is assigned to the vxlan interface on NodeB. NodeA's vxlan address is pingable from NodeB, and vicesersa.

How would I configure routes so that guests from each node can ping eachother?
Would it be possible to use libvirt's built-in dhcp feature on each guest network?

Best Answer

A simple configuration looks possible using a 'routed' virtual network on both sides to hold guest interfaces. (In case they are currently in a NATed one, you would have to add some port forwarding, which is usually possible but may be complex if many ports are used).

Assuming the network interfaces are on 'routed' network, you just need to add the routes on both sides:

NodeA:

  • ip route add 192.168.2.0/24 via 172.16.1.2/24 dev eth0

    (replacing eth0 with your interface name in nodeA)

NodeB:

  • ip route add 192.168.1.0/24 via 172.16.1.1/24 dev eth0

    (replacing eth0 with your interface name in nodeA)

Related Topic