Qemu-kvm problem

Hi,

I have a small problem, wondering if someone had the same and could help me.

I use a PC for a router with a custom build of Openwrt (after a few weeks of trial and error and understanding what “make menuconfig” does, I can produce custom builds like an assembly line)

In that build I have qemu because I wanted a virtual machine. After a few trial and errors I came up with this:

qemu-system-x86_64 -machine usb=on -enable-kvm -cpu kvm64,+nx -smp 4 -m 8G -hda ubuntu20.qcow2 -net nic,model=virtio -net bridge,br=br-lan -daemonize

command line which I put in a bash script. Tat command is doing everything I want except for one thing and that is passing through USB, tried a few things but no go.

The usb is not my main problem, I am sure with trial and error I could solve this, the problem is with the network. That command does what it should, and I have a pass-through network with an Ip from the router without NAT. That is great but has a Problem, I can reboot the virtual machine, turn it off, turn it back on everything is OK. When I reboot the Router (meaning the host) it does not come back, it doesn’t boot at all, I have no screen attached so I cannot see where he hangs. No Ping on any IP address, no DHCP at all. I have to start over. Every time I start qemu with that line the same thing happens, if I change the line to get a NAT network everything works and I can reboot the host, but I need the pass through network and the pass through usb.

Is this an error in my command line or is this a bug?

I would like to use virtio because I could remotely connect to qemu with an interface but there is no chance to compile it within of Openwrt, to many missing dependencies. Including virtio and it’s dependencies into the toolchain is too much for me. Maybe someone else has the knowledge…

Thanks

LordRayden

It's usually less problematic if you install a general-purpose Linux distro on the host and run OpenWrt as a guest.

Hi,

Thanks for the suggestion. Tried that with windows 10 as host and Virtualbox. Did not go well…

I have a Intel PRO/1000 PT Quad Port Server Adapter which I use as switch, meaning I have to completely pass through the card. The same goes for the QNAP Dual-Band AC2600 Wireless card and the Alfa Network AWUS036NHA USB Wifi and for the LTE Stick. All of that just doesn’t work, it crashes the host, VirtualBox, guests, everything….

Still I didn’t try it with Linux…. Which distro would you recommend for something like that?

Would it make a difference? As I said windows was catastrophic…

Thank you

LordRayden

1 Like

I personally use libvirt+KVM/QEMU on Fedora, but CentOS should be preferable for newbies.
Also many people have a positive view of Proxmox, so I think it should be a good choice as well.

I know Fedora and I use Centos(WebServer LAN), since the Openwrt build environment is on Ubuntu 20 I am into ubuntu now, very wide community...

I looked at proxmox at version 5 but I usually prefer VMware ESXi, the problem is, that is an old AMD bulldozer with 16GB RAM, great as Openwrt router but a very slow bare metal host. I will still try proxmox, maybe it’s more "lightweight" then VMware ESXi....

Thank you, now I have something to do...

1 Like

By the way, setting up OpenWrt build environment shouldn't be a problem for any major Linux distro including CentOS/Fedora/Debian/Ubuntu:
https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem

why NAT is a question?