I am trying to get host (arch linux) and qemu guest (busybox initramfs linux) connect with each other. Wider LAN access on guest is not needed - just host-guest networking. Problem is, only loopback interface shows up inside qemu guest.
Following is the basic command I am using. I have tried its different variations.
qemu-system-x86_64 -enable-kvm -m 1024 -kernel ./vmlinuz -initrd ./initramfs.igz -append "console=ttyS0" -nographic -net nic,vlan=0 -net tap,ifname=tap0,script=no,downscript=no
Before running this, on host I created a tap interface tap0 and set its user to my logged in user (
whoami). Brought up the interface in promisc mode.
QEMU started with a warning about -net deprecated in favour of netdev. But only shows loopback interface. There might be issues around dhcp which is not set up, or some other problem. But I can't find a way to see what the problem is. There is -d switch for qemu logs but that has many options and I am not sure which one to use for the types of logs i want.
Also, I can set up a bridge interface br0 on host and enslave tap0 to br0 but that, to me, seems pointless because there is nothing else enslaved to br0. On my laptop, there is wlan0 but it won't be mastered to a bridge - it fails with Operation not supported. Plus I am not interested in wider LAN access anyway.