[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] question about connection between vms in two physical hosts



On 12/26/2016 11:05 PM, 无敌浪子 wrote:
Hi there,

I have some vms in two different physical hosts, the hosts are connected directly instead of a switcher, I'd like to make all these vms connected. the condition right now is that vm network type is nat, vm behind nat cannot get the new connection inbound, I suppose if I can make the inbound connection acceptable or if there is any other solution ? Thank you


Sure. Two possibilities:

1) create a libvirt network on each host that uses "<forward mode='route'/>". The two networks should have different subnets. Then add a route on host A that points to host B's external IP for the hostB-subnet, and on host B that points to host A's external IP for the hostA subnet. Finally, attach the guests' network interfaces to these new networks.

2) setup a bridge device in both hosts' system network configuration (outside of libvirt) that is attached to the hosts' ethernet cards, and connect the guests on each host to that host's bridge rather than a libvirt network. (if the ethernets of the two hosts are directly connected to each other and nothing else, then you will either need to configure the guest network interfaces with static IP addresses, or you will need to run a dhcp server and DNS server (e.g. dnsmasq) on one of the two hosts).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]