On 2/27/24 6:52 AM, Michal Prívozník wrote:
On 2/25/24 10:34, Jeffrey Walton wrote:
Hi Everyone,
I'm having trouble understanding what I need to do so my VM guests use
the DHCP server on my LAN. I've read
<https://wiki.libvirt.org/VirtualNetworking.html#virtual-networking>,
but I don't see the use case covered. There is a section on dns-dhcp,
but it looks like some sort of libvirt-internal setup so guests get
their networking params from libvirt, and not my DHCP server.
(I am looking for something similar to VirtualBox and Bridged
networking. VBox does what I want when I select a bridged adapter).
How do I set up networking so the VM Guest uses LAN DHCP?
You have basically two options:
1) create a linux bridge (brctl addbr ...) or an OpenVSwitch bridge,
plug your eth0 into it and then configure VMs to have their vNICs
plugged into the bridge (<interface type='bridge'> <source
bridge='...'/> ..).
2) Use macvtap (<interface type='direct'> <source dev='eth0'/> ...).
There is a caveat though. While 2) is less labor intensive, it won't
allow VMs to talk to each other. For that you'd need a switch with so
called hairpin turned on.
This depends on the mode set for the macvtap/direct interface. There are
4 modes - vepa (the default), bridge, private, and passthrough. In vepa
mode and private mode, you are correct that the guests can't communicate
directly with each other (unless they host is connected to a switch that
has a hairpin mode), but if mode is set to "bridge", then the guests
*can* communicate directly (that traffic will never leave the host, so
it won't be limited by the physical network's speed, but also can't be
examined/managed by the switch, which may or may not be important).
The more important limitation of all macvtap modes is that the guests
can't communicate directly with the *host* in any of the modes.
I'll avoid a more thorough description of the different modes since this
is already getting kind of off-topic for the original question, but you
can find this info by searching for "macvtap modes" (older links won't
describe passthrough mode, as that was added at a later date).
_______________________________________________
Users mailing list -- users@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxx