Skip to content

Instantly share code, notes, and snippets.

@kekyo
Last active June 22, 2021 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kekyo/0bc92b53b2cf336df2c7a09896ffdd12 to your computer and use it in GitHub Desktop.
Save kekyo/0bc92b53b2cf336df2c7a09896ffdd12 to your computer and use it in GitHub Desktop.
Configure cockpit virtual machines on Ubuntu 20.04
# /etc/netplan/00-installer-config.yaml
network:
ethernets:
enp0s1:
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [ enp0s1 ]
addresses: [192.168.0.104/24]
gateway4: 192.168.0.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
dhcp4: no
dhcp6: no
version: 2
<network>
<name>host-bridge</name>
<forward mode="bridge"/>
<bridge name="br0"/>
</network>
#!/bin/sh
# The cockpit virtual machine pages on Ubuntu 20.04 may have many bugs,
# we'll receive un-understandable troubles...
# Configure network bridge dodges failure connections:
# https://levelup.gitconnected.com/how-to-setup-bridge-networking-with-kvm-on-ubuntu-20-04-9c560b3e3991
virsh net-destroy default
virsh net-undefine default
virsh net-define host-bridge.xml
virsh net-start host-bridge
virsh net-autostart host-bridge
# Build virtual machine disk dodges a bug for cockpit VM pages on Ubuntu 20.04.
# Damn it causes unattachable storage configuration over storage pool/volume.
# The example makes with FILE reference configuraton manually...
qemu-img create -f qcow2 windows-server-2019.qcow2 128G
virsh attach-device windows-server-2019 windows-server-2019.qcow2.xml --config
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/storage/vms/windows-server-2019.qcow2'/>
<target dev='vdc' bus='sata'/>
</disk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment