DEV Community

ChungWei Wei
ChungWei Wei

Posted on • Originally published at kmp.tw on

[Linux] Ubuntu 22.04 Install KVM And Setting Bridge

Before Install

Update, Check CPU

apt update

egrep -c '(vmx|svm)' /proc/cpuinfo
Enter fullscreen mode Exit fullscreen mode

Install Package

apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils
Enter fullscreen mode Exit fullscreen mode

Add Network Bridge

cd /etc/netplan
vim 01-netcfg.yaml
Enter fullscreen mode Exit fullscreen mode

01-netcfg.yaml

network:
  ethernets:
    <nic_name>:
      dhcp4: false
      dhcp6: false
  # add configuration for bridge interface
  bridges:
    br0:
      interfaces: [<nic_name>]
      dhcp4: false
      addresses: [<server_ip_and_slash>]
      macaddress: <mac_address>
      routes:
        - to: default
          via: <gw_ip>
          metric: 100
      nameservers:
        addresses: [<dns_server_ip>]
      parameters:
        stp: false
      dhcp6: false
  version: 2
Enter fullscreen mode Exit fullscreen mode

Apply Conf

netplan apply
Enter fullscreen mode Exit fullscreen mode

Verify

ip a
Enter fullscreen mode Exit fullscreen mode

Top comments (0)