Skip to content

Instantly share code, notes, and snippets.

@th0rex
Last active October 11, 2018 12:35
Show Gist options
  • Save th0rex/eae7a50ee5a450ee9a2e690e0bf3cc2a to your computer and use it in GitHub Desktop.
Save th0rex/eae7a50ee5a450ee9a2e690e0bf3cc2a to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
# Start:
# sudo ./vm.sh
# Connect:
# sudo spicy --uri="spice+unix:///tmp/vm_spice.socket"
NET_OPTIONS="-net none" && [[ $1 == "--enable-net" ]] && NET_OPTIONS="-netdev user,id=default,net=10.0.2.0/24,dhcpstart=10.0.2.9 -device virtio-net-pci,netdev=default,mac=00:16:3e:00:01:01 -net nic -net user,smb=/vm/"
qemu-system-x86_64 \
-name guest=win7 \
-machine type=pc-i440fx-2.11,accel=kvm \
-cpu Opteron_G4,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff,kvm=off \
-smp 4,sockets=1,cores=4,threads=1 \
-enable-kvm \
-m 8192 \
-vga qxl \
-device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 \
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 \
-device usb-tablet,id=input2,bus=usb.0,port=1 \
-device virtio-serial-pci \
-device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
-chardev spicevmc,id=spicechannel0,name=vdagent \
-spice unix,addr=/tmp/vm_spice.socket,disable-ticketing,gl=on,seamless-migration=on \
-boot strict=on \
-drive if=none,file=/vm/win7.qcow2,format=qcow2,id=drive-ide0-0-0 \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
$NET_OPTIONS
#-netdev user,id=default,net=10.0.2.0/24,dhcpstart=10.0.2.9 \
#-device virtio-net-pci,netdev=default,mac=00:16:3e:00:01:01 \
#-net nic \
#-net user,smb=/vm/
#-net none
#-soundhw hda \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment