diff --git a/StartVM.sh b/StartVM.sh index 4e3fddf..28ba2b7 100755 --- a/StartVM.sh +++ b/StartVM.sh @@ -29,11 +29,11 @@ if [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then use=$(echo "scale=4; $MemTotal / 3" | bc) if [[ `arch` == "x86_64" ]]; then echo X86 架构,使用 kvm 加速 - kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb + kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 exit fi echo 非 X86 架构,不使用 kvm 加速 - qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb + qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 exit fi zenity --question --no-wrap --text="检查到您未创建所指定的虚拟机,是否创建虚拟机并继续?\n如果不创建将无法使用" @@ -42,4 +42,4 @@ if [[ 1 == $? ]]; then exit fi cd `dirname $0` -./VM/VirtualMachine \ No newline at end of file +./VM/VirtualMachine diff --git a/VM-source/VirtualMachine.pro.user b/VM-source/VirtualMachine.pro.user index 5b21731..324f593 100644 --- a/VM-source/VirtualMachine.pro.user +++ b/VM-source/VirtualMachine.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/VM-source/qemu.cpp b/VM-source/qemu.cpp index 3fa118e..1811f8d 100644 --- a/VM-source/qemu.cpp +++ b/VM-source/qemu.cpp @@ -72,7 +72,7 @@ int qemu::Start(bool unShown){ if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "x86_64"){ return system(("kvm " + commandOption + " &").toLatin1()); } - return system(("qemu-system-x86_64 " + commandOption + " &").toLatin1()); + return system(("qemu-system-x86_64 -nic model=rtl8139 " + commandOption + " &").toLatin1()); } int qemu::Stop(){ system("killall qemu-system-x86_64 -9"); diff --git a/VM/StartQemu.py b/VM/StartQemu.py index 732fd0e..a6a2d81 100644 --- a/VM/StartQemu.py +++ b/VM/StartQemu.py @@ -21,7 +21,7 @@ except: print("无法读取配置") traceback.print_exc() sys.exit(1) -option = f"--hda \"$HOME/Qemu/Windows/Windows.qcow2\" -usb -m {setting['Memory']}M -smp {setting['CPU']} " +option = f"-nic model=rtl8139 --hda \"$HOME/Qemu/Windows/Windows.qcow2\" -usb -m {setting['Memory']}M -smp {setting['CPU']} " if setting["EnableKVM"]: command = "kvm" if setting["EnableRDP"]: @@ -30,4 +30,4 @@ if setting["EnableVNC"]: option += f"-display gtk -display vnc=:{setting['VNC']} " if setting["EnableSound"]: option += "-soundhw all " -os.system(f"{command} {option}") \ No newline at end of file +os.system(f"{command} {option}")