I am doing WEB development on Windows 10 operating system. For that purpose, I am running Debian Linux on QEMU. I want to use SSH to connect to the virtual machine, possibly with putty and in the same time testing my server by putting an URL like http://192.168.1.1/index.html in the Internet Browser.
My virtual machine is configured as follow:
nginxon port 80 and 443:HTTPandHTTPSSSHfor file transfer between my laptop and the virtual machine
I am not very familiar with QEMU or networking, I read a lot of things on that topic I don't understand the technical details. I just need to do basic WEB development, I tried the following configurations:
> *Attempt 1*
qemu-system-x86_64 -m 512 -drive format=qcow2,file=hard-drive-4G.qcow2 -accel hax -nic tap,ifname=TAP-WIN32
Here, I previously installed a TAP device on Windows and created a Network Bridge. With this solution, I believe that QEMU is used as a Bridged Networking. This solution seems to work at the beginning, but it's actually unstable. I shutdown my virtual machine every day when I leave the office and restart it the next morning. In a very weird fashion, after a few days of usage, the networking is not working anymore, SSH broken and HTTP also broken.
I haven't been able to figure out what is going wrong here (the IP address seems correct), but I assume they might be a conflict, maybe the DHCP is messing up with MAC addresses, I have absolutely no clue.
I observed 2 things:
Observation-1: when it's not working, I try from Debian to ping a website, I get a unable to resolve host error and the DHCP gives me the same IPv4 address on my virtual machine as as my Windows computer.
Observation-2: when it's working, ifup requested DHCP for a new IP, the virtual machine got an IP address which is different from the local IP address of my laptop. I just have no idea how long this working state is going to last.
> *Attempt 2*
qemu-system-x86_64 -m 512 -drive format=qcow2,file=hard-drive-4G.qcow2 -accel hax -device e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp::5555-:22
Here, SSH is available through putty (port 5555) but if I type http://10.0.2.15/index.html in my Internet browser, I get a connection timeout.
What is the simple way to get SSH and HTTP available from my QEMU virtual machine on Windows?
QEMUis preferred. ActuallyVirtualBoxused to be much easier you are very correct. I just tried the last version, thebridgednetworking is not working at all on my computer. It used to work flawless, but it suddenly break on a recent VirtualBox update. – Robert Feb 22 '22 at 07:25