I am using qemu to emulate a custom linux system (generated with buildroot) and I would like to export display of my application on my host machine.

This seems pretty simple but I have been stuck for a few days reading documentation and post on stack exchange and I haven't been able to find a solution.

I do not need the guest to access external network, I just want the host and guest to communicate with each other.

Following the qemu documentation, I tried SLIRP and tun/tap networking but I wasn't able tomake anything work.

I also tried the '-redir' option for port forwarding for ssh, but no result either.

For more information : - the host machine is a ubuntu 16.04 - ifconfig -a, on the guest shows me the lo and tunl0 interfaces but no eth0 interface. I haven't been able to understand what tunl0 is, as it shows all the time even with the '-net none' option. - I have added as modules the virtio drivers for the guest.

right now, I am using the following line to launch qemu :

qemu-system-x86_system -kernel bzImage -initrd initrd.gz -drive id=disk,file=image.img,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -m 2048 -net nic -net tap,ifname=tap0,script=no,downscript=no

I tried setting the tap interface manually :

tunctl -u $USER
ifconfig tap0 <gateway ip> up

EDIT : I also tried to follow step by step the arch linux tutorials : https://wiki.archlinux.org/index.php/Network_bridge and https://wiki.archlinux.org/index.php/QEMU

But still, no ethernet interface...


Ok, so I finally found out the what the problem was. If any one is interested, here is the answer.

As stated, I generate my linux image using Buildroot and I misconfigured the kernel. I needed to add some drivers for ethernet, in order to be able to have the eth0 interface. Now, that I know it it, it actually seems pretty obvious. More details here: https://stackoverflow.com/questions/33337062/buildroot-ip-cant-find-device-eth0

Also, that solved another problem I had with /etc/resolv.conf that was missing on VM.

Hope that helps someone... one day. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.