This probably isn’t what the OP is looking for, however, I recently set this up on my Sway workstation using the following settings (I also use systemd-networkd for networking).
network config
[glb@localhost ~]$ cat /etc/systemd/network/00-vlan0.netdev
[NetDev]
Name=vlan0
Kind=macvlan
[MACVLAN]
Mode=bridge
[glb@localhost ~]$ cat /etc/systemd/network/00-vtap0.netdev
[NetDev]
Name=vtap0
Kind=macvtap
[MACVTAP]
Mode=bridge
[glb@localhost ~]$ cat /etc/systemd/network/50-link0.network
[Match]
PermanentMACAddress=aa:bb:cc:dd:ee:ff
[Link]
RequiredForOnline=carrier
ARP=no
[Network]
LinkLocalAddressing=false
MACVLAN=vlan0
MACVTAP=vtap0
[glb@localhost ~]$ cat /etc/systemd/network/90-vlan0.network
[Match]
Name=vlan0
[Network]
DHCP=yes
[glb@localhost ~]$ cat /etc/systemd/network/90-vtap0.network
[Match]
Name=vtap0
[Link]
ActivationPolicy=always-up
RequiredForOnline=carrier
[Network]
LinkLocalAddressing=false
ConfigureWithoutCarrier=true
udev config
[glb@localhost ~]$ cat /etc/udev/rules.d/90-macvtap.rules
SUBSYSTEM=="macvtap", OWNER="glb", GROUP="root", MODE="0660"
[glb@localhost ~]$ cat /etc/udev/rules.d/90-zvolume.rules
KERNEL=="zd0", OWNER="glb", GROUP="disk", MODE="0660"
script to launch windows
[glb@localhost ~]$ cat ~/bin/windows
#!/usr/bin/bash
# The $PORT, $OVMF, $DISK, and $VTAP variables
# should be unique for each VM.
# You can make duplicate copies of this script
# to run each VM.
# Or you could rewrite this script to take the
# four values as parameters.
# spice port for graphics
PORT="5634"
OVMF="$HOME/.local/opt/windows"
if ! [[ -e $OVMF ]]; then
mkdir -p "$OVMF"
for image in OVMF_{CODE,VARS}.fd; do
cp "/usr/share/edk2/ovmf/$image" "$OVMF"
done
fi
DISK="/dev/zd0"
VTAP="vtap0"
exec {fd}<>"/dev/tap$(</sys/class/net/$VTAP/ifindex)"
qemu-system-x86_64 \
-name windows \
-m 8g -cpu host -smp 4 \
-machine type=q35,accel=kvm,vmport=off \
-vga qxl \
-display spice-app \
-spice "disable-ticketing=on,addr=127.0.0.1,port=$PORT" \
-chardev spicevmc,id=c1,name=vdagent \
-netdev "tap,fd=$fd,id=$VTAP" \
-device virtio-rng-pci \
-device virtio-serial-pci \
-device virtserialport,id=c1,chardev=c1,name=com.redhat.spice.0 \
-device "virtio-net-pci,netdev=$VTAP,mac=$(</sys/class/net/$VTAP/address)" \
-drive "if=pflash,format=raw,unit=0,file=$OVMF/OVMF_CODE.fd,readonly=on" \
-drive "if=pflash,format=raw,unit=1,file=$OVMF/OVMF_VARS.fd" \
-drive "file=$DISK,format=raw"
sway config
[glb@localhost ~]$ cat ~/.config/sway/config | grep 'exec windows$\|remote-viewer\|pointer_constraint'
# release mouse pointer workaround: https://github.com/swaywm/sway/issues/8153#issuecomment-2104657092
bindsym --no-repeat --inhibited $mod+x seat * pointer_constraint escape
for_window [app_id="^(?i)remote-viewer$"] move container to workspace 6, workspace 6, fullscreen enable
bindsym $mod+Shift+w exec windows
Anyone wanting to replicate that configuration would need to tweak a few things for their PC. The OVMF_CODE.fd
and OVMF_VARS.fd
come with the edk2-ovmf
package. You’ll need to change the udev rules to grant your account access to the hard drive and network device. (/dev/zd0 is a ZFS volume that I created to contain my Windows image.)
[glb@localhost ~]$ zfs list -r root/windows
NAME USED AVAIL REFER MOUNTPOINT
root/windows 66.4G 48.9G 25.7G -
root/windows@000010 3.25G - 25.7G -
To install Windows, you need to add -drive file=<windows iso image>,media=cdrom -boot d
to the end of the qemu-system-x86_64 ...
line in the ~/bin/windows script. Remove those options after you’ve installed Windows so QEMU will boot from the hard drive.
You’ll need to install the qemu-system-x86-core
to get QEMU and the virt-viewer
package to get the Spice client (maybe spice-vdagent
, qemu-ui-spice-core
and qemu-ui-spice-app
as well). Also, there are some Spice guest tools for Windows that will allow copy-and-paste to work between your Windows image and your Fedora Linux host. I’ll see if I can find where I got those …
It looks like I got the spice guest tools for Windows from here: https://www.spice-space.org/download/binaries/spice-guest-tools/spice-guest-tools-latest.exe