I compiled a kernel from source :
make defconfig
make kvmconfig
make -j 4
After this , i use the resulting bzImage for my qemu command:
qemu-system-x86_64 -hda debian.img -kernel bzImage -append "root=/dev/sda console=ttyS0" -nographic -m 4096 -smp 2 --enable-kvm -net user,hostfwd=tcp::10021-:22 -net nic
It mounts, and I get a shell and everything, but it loses connectivity. In qemu, it logs :
[FAILED] Failed to start Raise network interfaces.
See 'systemctl status networking.service' for details.
Can someone guide me on this ? I already consulted Linux vanilla kernel on QEMU and networking with eth0 but it does not solve my issue. Also, Im not looking for hardcore qemu-bridge-solutions. Im pretty sure some network drivers are not getting loaded , but I can’t figure out how to resolve it. Or maybe Im missing some kernel .config options.
Advertisement
Answer
You are using a user socket. For this qemu creates a regular socket in its host process and forwards the packets for specific ports in your guest machine to the host socket. It is doable but I find it annoying.
I always prefer creating a tap device and bridging it to my physical interface with these QEMU switches:
-netdev tap,ifname=tap0,script=no,downscript=no,id=my_net_id -device driver=virtio-net,netdev=my_net_id
This way you have full network capabilities and you don’t need to use some weird port redirection.