Score:1

How can I share the host's network interface with virtual machines so that they appear on the same subnet and use the same DHCP?

in flag

I am moving my virtual machines from Hyper-V on Windows Server 2012 R2 to KVM/libvirt/etc on Ubuntu 20.04, and I need to recreate the network configuration I had before. I have had no problems importing the VMs but a difference in the way networks for the virtual machines work has me stumped.

On Hyper-V, all of the virtual machines shared the host network interface, and got their IP addresses from the router on the network with DHCP. In this setup, the Hyper-V host machine had something like 192.168.1.200 (static), and each VM would get their own IPs from the DHCP on the router (not the host), like 192.168.1.20, etc., sharing the same subnet. This made it easy for Windows machines using SMB to talk to each other, whether they were VMs on Hyper-V or real machines directly connected to the router.

I have not been able to figure this out using libvirt. The default bridged setup has the host acting as NAT and the VMs are all on a different subnet, and the real Windows machines on the network will not discover the ones in the VM network. They can ping each other, etc.

What I am looking for is the same configuration I had on Hyper-V which was trivial to configure. What is the proper way to configure my Ubuntu server's network interfaces so that virtual machines get their IP addresses from the router, not the host?

Score:2
pe flag

You want to setup a bridged network instead of the default NAT setup of KVM/libvirt

-> https://help.ubuntu.com/community/KVM/Networking
-> https://linuxconfig.org/how-to-use-bridged-networking-with-libvirt-and-kvm

Christian Ehrhardt avatar
sl flag
And in the more modern way https://netplan.io/examples/#configuring-network-bridges which might be worth adding to your otherwise correct link list.
in flag
Thank you. This worked, but I seem to have a new problem now, which warrants a new question: https://askubuntu.com/questions/1391137/how-can-guest-vms-reach-the-host-vm-on-the-network-with-brdged-networking
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.