0

I recently installed KVM on Ubuntu 18.04 with requisite tools like virt-manager, libvirt, and qemu.

My problem is that the VMs I spin up are not connected to internet. Some give me an error message saying that my machine is not using DHCP, while other distributions just do not connect at all.

I set it up with the following article: https://linuxconfig.org/install-and-set-up-kvm-on-ubuntu-18-04-bionic-beaver-linux ...which says that I need to edit /etc/network/interfaces to create a bridge. If you read the comments on that same article, you will find that file is no longer being used and has been replaced with /etc/netplan/*

My current .yaml file in /etc/netplan looks like this:

network:
  version: 2
  renderer: NetworkManager

My network interfaces appear to be enp0s25 , wlp4s0 , and wwp0s20u4 .

How should I change my netplan configuration so that my virtual machines on KVM can have an internet connection?

  • *This is not a server, so I do not need (or want) to make a remote connection possible. I only need to access them on the laptop they are hosted on. – Justin Brunkow Jan 21 at 21:00
  • see here. – Doug Smythies Jan 21 at 21:33
  • You have to decide between using NetworkManager or Netplan. NetworkManager is GUI based. Netplan is cli based. If this is not a server, I'd recommend staying with NetworkManager (which is what your current /etc/netplan/*.yaml file is set for). Then just follow the instructions in the article link that you reference. – heynnema Jan 22 at 0:13
  • Thanks Doug! That did it. – Justin Brunkow Jan 22 at 15:25
0

I modified the default yaml file in /etc/netplan as follows:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp0s25:
      dhcp4: no
  bridges:
    br0:
      dhcp4: yes
      interfaces:
        - enp0s25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.