Score:0

Public IP on KVM VMs and DNS setup on host machine

pt flag

I'm using KVM to create two VMs for hosting NMS servers for the company's devices. I want to manually assign a public ip to both VMs and the host machine (Ubuntu 22.04 desktop [although I mostly use CLI I'm not completely comfortable with it so I went for the desktop and not the server version]. I followed this suggestion: https://unix.stackexchange.com/questions/245628/configure-public-ip-addresses-in-kvm-vms and managed to get it to work (basically the virtual interfaces of the VMs and the physical interface are in the same bridge and the ip address that would normally be assigned to the physical interface is instead assigned to the virtual bridge interface). I've configured the KVM xml using virsh and let it create the virtual bridge on boot/reboot. I'm required to manually add the physical interface to the bridge after every boot/reboot (although I am planning to create a cron job to do this automatically upon boot). After that, the setup works as intended except the following:

ISSUE DESCRIPTION: I cannot find a way to specify DNS servers on the virtual bridge interface (I can only set ip address, default gateway and subnet mask) so I end up with a setup where the host machine cannot resolve domain names (libvirt documentation doesn't quite help me understand what I should be doing regarding DNS configurations). Keep in mind that both VMs running on KVM do have DNS configurations and can resolve names.

ATTEMPTS TO SOLVE: So far, I've tried:

  1. editing the KVM xml file with the following: a) and b) . When inputting (a) nothing happens but when inputting (b) DNS servers do appear in the GUI monitoring tool of Ubuntu however the VM interfaces (i.e., vnetX) do not bind themselves to the bridge (they do not appear in the bridge created by KVM) and nothing works.

and 2) manually adding DNS servers using nmcli tool (which would later go into the script for the cron job). I specifically used nmcli connection modify brxy ipv4.dns "1.1.1.1 8.8.8.8" which is accepted by the system but basically does nothing.

WHAT WORKS: The only thing that always works is setting the DNS from the advanced network settings GUI application. All interfaces are bound under the bridge, and DNS are set and working.

This is my first attempt at configuring servers and using KVM and I've spent many hours trying to troubleshoot this issue to no avail. Sure, I can add DNS servers manually whenever the server reboots (which is not going to be often) but I want connectivity to get right back on automatically without me having to physically be next to the server. Have you guys got any idea how I should move on from here? Is there a way to set DNS server entries in the kvm xml configuration file or is there some kind of workaround (like a command I could use to set DNS entries for the virtual bridge interface)? I appreciate your time :)

I sit in a Tesla and translated this thread with Ai:

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.