0

I am trying to figure out how to setup a vm in Ubuntu Server 20.04 with kvm, but I am not having much luck.

The goal is to have the host on the 192.168.20.x network and the vm on the 192.168.10.x.

I have two physical nic's available, so I would think I could use nic1(enp4s0) for the host and nic2(enp8s0) for the vm, however I have not figured out a way to do that just yet.

I was able to achieve this with VirtualBox in Ubuntu 16.04 with ifupdown and a configuration of iface eth1 inet manual, but I don't know what the equivalent is in the netplan yaml file. I have tried the following for my yaml file and the second nic shows as up when I run the ip a command, but nothing is returned when running ping -I enp8s0 www.google.com and when trying to install the vm, it can't connect to the network.

00-installer-config.yaml contents:

network:
version: 2
renderer: networkd
ethernets:
    enp4s0:
    dhcp4: true
    dhcp6:  false
    enp8s0: {}

I believe my issue is with the configuration of the enp8s0 nic, but I could be wrong. I have to think there is some way to use nic2(enp8s0) for the vm, I'm just not sure how to do it with kvm and netplan. I've dabbled with setting nic2 as a pci passthrough, but I would like to avoid that if possible. If that is truly the only way to get this to work, then I will explore that option but I wanted to ask first. Any and all help is greatly appreciated. Thank you.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
Zach
  • 1

1 Answers1

0
network:
  version: 2
  renderer: networkd
  ethernets:
    enp8s0:
      dhcp4: no
      dhcp6: no
 
  bridges:
    br2:
      interfaces: [enp8s0]
      dhcp4: no
      addresses: [192.168.10.10/24]
      gateway4: 192.168.10.1
      nameservers:
        addresses: [192.168.10.1]

or try to use Linux bridge, for example:

brctl addbr br2
brctl addif br2 enp8s0
ip addr add dev br2 192.168.10.1/24
ip link set up dev br2

In this article for more KVM networking configuration examples.

kllaud
  • 1
  • 1