QEMU-KVM KVM Command Line Practical Guide

I am going to build this based on a series of small posts I've made as I feel much of the information is actually hard to find and piece together from the rest of the web.

What I'm going to focus on is how to use virtio as the NIC because if you don't you get very slow NIC speeds but with the virtio NIC model you basically get host speeds.

/usr/libexec/qemu-kvm -enable-kvm -smp 8 -m 16000 -net user -net nic,model=virtio -drive file=ubuntu-gpt2large.img,if=virtio
 

How do I specify local NAT network only? 

By default if you don't specify "-net" as network type it defaults to user mode networking.  Basically you get a standard NAT IP that allows the VM to surf the net, download etc.. but it's not possible to remotely access the VM.

How do specify my NIC as being virtio?

-net nic,model=virtio

How do you start in bridged mode and use the virtio accelerated network card/driver?

-netdev bridge,id=hn1 -device virtio-net-pci,netdev=hn1

You can also specify the mac, which is necessary as if you start multiple VMs they will default to the same MAC which breaks things of course

 -netdev bridge,id=hn1 -device virtio-net-pci,netdev=hn1,mac="DE:AD:BE:EF:06:02"


Tags:

qemu, kvm, guidei, posts, ve, virtio, nic, speeds, usr, libexec, enable, smp, user, ubuntu, gpt, img, specify, nat, default, quot, defaults, mode, networking, ip, allows, vm, surf, download, etc, remotely,

Latest Articles

  • How to allow SSH root user access in Linux/Debian/Mint/RHEL/Ubuntu/CentOS
  • Ansible Tutorial - Playbook How To Install From Scratch and Deploy LAMP + Wordpress on Remote Server
  • Ceph Install Errors on Proxmox / How To Fix Solution
  • Proxmox Update Error https://enterprise.proxmox.com/debian/pve bullseye InRelease 401 Unauthorized [IP: 144.217.225.162 443]
  • QEMU/KVM How to Hot-add A Virtual Disk .raw/.qcow2 via QEMU Monitor Commands
  • Proxmox How To Enable Ceph Distributed Storage Cluster with OSD and Pools
  • pulseaudio issue on QEMU/KVM guest VM when microphone is replugged/unplugged pulseaudio: pa_threaded_mainloop_lock failed pulseaudio: Reason: Invalid argument
  • Ubuntu Linux Mint - Volume Control Stopped Working
  • Proxmox Services Won't Start Failed to start The Proxmox VE cluster filesystem. Proxmox VE firewall. PVE Status Daemon. Proxmox VE scheduler. PVE Cluster HA Resource Manager Daemon. PVE Local HA Resource Manager Daemon.
  • Proxmox Guide FAQ / Errors / Howto
  • Virtualbox Vbox Issue Cannot Enable Nested Virtualization Button is Grayed/Greyed Out and Unclickable HowTo Solution
  • Virtualbox VBOX Howto Port Forward To Guests
  • Linux Ubuntu Debian Centos Mint - How To Check if Intel VT-x or AMD-V Hardware Virtualization is Enabled?
  • Linux Howto Zip Multiple Files and Directories
  • Windows Cannot Format USB drive Device Media is Write Protected Error Solution
  • Linux Mint 20 cannot install snapd missing solution
  • Virtualbox VBOX How To Install Guest-Utils/GuestUtils so drag and drop and clipboard works Ubuntu Mint Debian Linux
  • How to install Kubernetes with microk8s and deploy apps on Debian/Mint/Ubuntu Linux
  • vi how to delete everything to the end of the line or the rest of the line from the cursor
  • Cisco Howto Configure Console Port/Terminal/Comm Server with Async Cable Setup