KVM: Difference between revisions

From 太極
Jump to navigation Jump to search
Line 122: Line 122:
<ul>
<ul>
<li>Host only (used by VirtualBox) = '''Isolated network''' (used by KVM). Step 1: Select a VM. Click Edit, choose "Connection Details" and add a new network (Isolated mode). This ''default'' network has IPv4 192.168.122.0/24 Step 2: Click Edit, choose "Virtual machine Details" and click the Information icon (circle shape). Click "Add Hardware" and choose "Isolated network" for the Network source. Leave the MAC address and Device model as defaults. This ''network'' network has IP4 192.168.100.0/24.
<li>Host only (used by VirtualBox) = '''Isolated network''' (used by KVM). Step 1: Select a VM. Click Edit, choose "Connection Details" and add a new network (Isolated mode). This ''default'' network has IPv4 192.168.122.0/24 Step 2: Click Edit, choose "Virtual machine Details" and click the Information icon (circle shape). Click "Add Hardware" and choose "Isolated network" for the Network source. Leave the MAC address and Device model as defaults. This ''network'' network has IP4 192.168.100.0/24.
<li>[https://www.tecmint.com/create-network-bridge-in-ubuntu/ How to Configure Network Bridge in Ubuntu*]. ''Excellent instruction!''
<li>[https://www.tecmint.com/create-network-bridge-in-ubuntu/ How to Configure Network Bridge in Ubuntu*]. Three methods. ''Excellent instruction!''
<ul>
<ul>
<li>[https://www.tecmint.com/set-static-ip-address-in-ubuntu/ How to Configure Static IP Address on Ubuntu 20.04]
<li>The new (slave-type) bridge network should tie to one of existing network adapters for this to work. </li>
<li>The new adapter will be ''br0'' only if we use the '''netplan''' method. </li>
<li>If we use the '''nmcli''' or the '''nm-connection-editor''' GUI method, we need to deactivate the Ethernet interface (if we use Ethernet). The final adapters will have ''br0'' and ''bridge-br0''. </li>
<li>To set a static IP on the host, see [[Ubuntu#Set_static_IP|Ubuntu -> Set static IP]], [https://www.tecmint.com/set-static-ip-address-in-ubuntu/ How to Configure Static IP Address on Ubuntu 20.04].
</li>
</li>
<li>[[Ubuntu#Set_static_IP|Ubuntu -> Set static IP]]
</ul>
</ul>
</li>
</li>

Revision as of 12:44, 26 November 2020

Resource

Install

Install on Ubuntu

Install on CentOS

snapshot

  • How to Create, Revert and Delete KVM Virtual machine (domain) snapshot with virsh command, How to create snapshot in Linux KVM VM/Domain
    $ sudo su
    # virsh list --all
    
    # virsh snapshot-create-as --domain win10 --name win10_snap --description "Windows 10 snapshot"    # Create a snapshot
    # virsh snapshot-list win10
    # virsh snapshot-info --domain win10 --snapshotname win10_snap
    
    # virsh snapshot-revert win10 win10_snap    # Restore
    
    # virsh snapshot-delete --domain win10 --snapshotname win10_snap
    
  • To create a snapshot using the GUI, open virtualization manager window. In the VM properties, click on the icon (two displays overlapped) which is on the right of the menu, which says Manage VM snapshots.

GUI manager

Network

Back and restore images

How to KVM Backup and Restore in Linux

# Backup 
virsh list --all
virsh dumpxml win10 > /MyBackup/win10.xml
sudo cp /var/lib/libvirt/images/win10.qcow2 /MyBackup/win10.qcow2
sudo chown $USER:$USER /MyBackup/*.qcow2

# Restore Making
sudo virsh undefine win10
ls -l /etc/libvirt/qemu
virsh list –all
sudo rm /var/lib/libvirt/images/win10.qcow2
sudo cp /MyBackup/win10.qcow2 /var/lib/libvirt/images/
sudo virsh define --file /MyBackup/win10.xml
# virsh start win10

Cheat sheet

KVM Cheatsheet

Run macOS on KVM / QEMU

How To run macOS on KVM / QEMU