Skip to content

Instantly share code, notes, and snippets.

@lucioreyli
Created August 8, 2025 03:36
Show Gist options
  • Save lucioreyli/91f4dc797cb7fd433191b77400c00757 to your computer and use it in GitHub Desktop.
Save lucioreyli/91f4dc797cb7fd433191b77400c00757 to your computer and use it in GitHub Desktop.
QEMU/KVM Windows with bridge network
#!/bin/sh
# Preparing VM hard disk
mkdir -p ${HOME}/.qemu/windows_10
fallocate -l 38654705664 ${HOME}/.qemu/windows_10/windows_10.img
qemu-system-x86_64 \
-display gtk,window-close=off \
-machine type=q35,accel=kvm \
-enable-kvm \
-cpu Skylake-Client-v4,hv_relaxed,hv_vpindex,hv_time,hv_vapic,hv_runtime,hv_synic,hv_stimer,hv_tlbflush,hv_ipi,hv_frequencies \
-smp 2 \
-m 4096 -mem-prealloc \
-vga virtio \
-device ich9-intel-hda \
-device hda-duplex,audiodev=hda \
-audiodev pa,id=hda,server=unix:/run/user/1000/pulse/native,out.frequency=44100 \
-device virtio-net,netdev=vmnic \
-netdev user,id=vmnic \
-device qemu-xhci,id=xhci \
-device usb-tablet,bus=xhci.0 \
-chardev socket,path=/tmp/qga.sock,server=on,wait=off,id=qga0 \
-device virtio-serial \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
-object rng-random,id=rng0,filename=/dev/urandom \
-device virtio-rng-pci,max-bytes=1024,period=1000 \
-drive format=raw,file=$HOME/.qemu/windows_10/windows_10.img \
-drive file="$HOME/Downloads/Win10_22H2_English_x64v1.iso",media=cdrom \
-drive file="$HOME/Downloads/virtio-win-0.1.271.iso",media=cdrom \
-boot menu=on -netdev bridge,id=hn0,br=virbr0 -device virtio-net-pci,netdev=hn0,id=nic1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment