0

Is there a simple way to route network traffic between two VMs, one in virtualbox and the other in KVM/libvirt?

In the KVM World, I can see the virbr interfaces (Virtual Bridges?) and they have an IP assigned:

virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether fe:32:01:44:a9:c5 brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 valid_lft forever preferred_lft forever

But the Virtualbox interfaces doesn't have an IP assigned

vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff

The IPs of the VMs:

  • KVM_VM: 192.168.122.101
  • VBox_VM: 192.168.56.101

What do you think are the options?

1 Answers1

0

Yeah the virbr interfaces are bridges in KVM parlance. If you didn't know, you can view details about the bridge with the brctl utility (eg: # brctl show vibr0)

The first thing I see is vboxet0 is in the DOWN state so you may just need to assign an IP to it and bring it UP. If vboxet0 (I don't know much about Virtualbox) is a bridge interface, make sure the VM which should be on that bridge's network is a member of the bridge.

Also, assuming 192.168.122.101 and 192.168.56.101 both have a netmask of /24 then you'll need a router in there somewhere which has one interface in the 192.168.122.0/24 network, and a second interface in the 192.168.56.0/24 network. Then you can either set a static route to either network via the router, or make the router the default gateway for each subnet.

You might be able to accomplish the same thing with some DNAT shenanigans on hypervisor but then it wouldn't make much sense to use a bridge. I would just assign a NAT'd interface to the VMs and let the hypervisor deal with the rest.

Server Fault
  • 3,714
  • 12
  • 54
  • 89