Score:1

Configure NetPlan with KVM to share host LAN with guest

zw flag

I'm having a problem with NetPlan, where if I set renderer: networkd, then the guest VM connects to the local network, but the host cannot reach the public internet ping: google.com: Temporary failure in name resolution. Interestingly, I can still xRDP into the host, it just doesn't have a network device available to run apt update | upgrade | install. If I set renderer: NetworkManager, the host can access the internet, but the guest VM cannot connect to the local network.

Host /etc/netplan/config.yaml

network:
  version: 2
    renderer: networkd
    ethernets:
      eno1:
        dhcp4: false
        dhcp6: false
    bridges:
      virbr0:
        interfaces: [eno1]
        addresses: [192.168.0.2/24]
        routes:
          - to: default
            via: 192.168.0.1
        nameservers:
          search: [local]
          addresses: [8.8.8.8,8.8.4.4]
        macaddress: 00:1c:23:d5:c7:d4
        parameters:
          stp: true
          forward-delay: 4
        dhcp4: no
        dhcp6: no

Guest /etc/netplan/config.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      optional: true
      addresses: [192.168.0.3/24]
      nameservers:
        search: [local]
        addresses:[8.8.8.8,8.8.4.4]
      routes:
        - to: default
          via: 192.168.0.1

Context I recently upgraded the host from 20.04 to 22.04, and I made some mistakes but worked through them to get my system back up. The last hurdle is configuring networking to allow the host and guest to connect to the same LAN through my home router. Before the upgrade, both host and guest ran 20.04 and were on the local network. I've removed the ifupdown and migrated to netplan. It seems I can get either to work, but not together.

--UPDATE-- Contents /etc/libvirt/qemu/networks

  1. autostart (folder)/host-bridge.xml
  2. default.xml.dpkg-disappear (empty file)
  3. host-bridge.xml

host-bridge.xml (both files are identical)

    <network>
      <name>host-bridge</name>
      <uuid>437f7e39-9966-465a-912f-4d304736973b</uuid>
      <forward mode='bridge'/>
      <bridge name='virbr0'/>
    </network>
Doug Smythies avatar
gn flag
what files are in `/etc/libvirt/qemu/networks` and what are their contents?
Rick Mooney avatar
zw flag
@DougSmythies updated the question with this information
Doug Smythies avatar
gn flag
I can not see anything wrong. Have a look [here](https://askubuntu.com/questions/1412503/setting-up-a-bridge-for-host-and-vm/1412973#1412973), in particular at the `virsh edit` area and the `interface` section of your `.xml` file in `/etc/libvirt/qemu`.
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.