I want to use the TAP network backend instead of the default SLIRP that Qemu provides. This is the batch file I use to create the VM (inspired by this):
@echo off
set "QEMUIMG=D:\user\VMs\Qemu\qemu\qemu-img.exe"
set "IMAGE=disk.img"
set "ISOFILE=D:\user\VMs\isos\isofile.iso"
set "QEMUBIN=D:\user\VMs\Qemu\qemu\qemu-system-x86_64.exe"
rem ==================================
rem Safety net
rem ==================================
if not exist %IMAGE% (
rem CREATE a virtual hard disk
%QEMUIMG% create -f qcow2 %IMAGE% 32G
) else (
echo file %IMAGE% already exist. Delete or move and try again.
goto:eof
)
rem ==================================
rem Run the virtual machine
rem ==================================>
start "QEMU" %QEMUBIN% -k us -usb -device usb-tablet -drive ^
file=%IMAGE%,index=0,media=disk,format=qcow2 -cdrom %ISOFILE% -m 2048M ^
-boot order=d -smp cpus=2 -rtc base=localtime,clock=host -parallel none ^
-serial none -name vm -no-acpi -no-hpet -no-reboot -show-cursor ^
-netdev tap,id=tap0,ifname=mytap,script=no,downscript=no -device netdev=tap0
Then:
- I download OpenVPN and install only the TAP-Win32 Virtual Ethernet Adapter.
- Now in Network Connections it appears a new interface: TAP-Windows Adapter V9 (which I rename to "mytap").
The next step is creating a bridge between the TAP adapter and the interface I use to connect to the Internet. But since I use Wi-Fi, it doesn't work, and bridging is less secure than NAT.
However, the instructions I've found to set up NAT are specific to OpenVPN or Hyper-V, and I don't know how to apply them to this case.
Any tips on how to proceed?