2

My network interfaces never shows up in my guest computer.

I'm compiling a linux kernel (3.3 I think) from scratch with default settings +

Symbol: NE2K_PCI [=y]
Type  : tristate
Prompt: PCI NE2000 and clones support (see help) 

since I read somewhere that this is the default driver that qemu uses.

I'll then boot with: qemu-system-x86_64 -kernel repo/linux/arch/x86/boot/bzImage -boot d -initrd rootfs.img.gz -append "root=/dev/ram rdinit=/sbin/init"

qemu-system-x86_64 -nographic -kernel repo/linux/arch/x86/boot/bzImage -boot d -initrd rootfs.img -append "root=/dev/ram rdinit=/sbin/init console=ttyS0"

The rootfs is simply busybox's _install dir + /proc /dev and such and etc/init.d/rcS

#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
/sbin/mdev -s

But I can't find the interface after boot. ifconfig -a simply shows the loopback interface.

From http://www.tldp.org/HOWTO/Ethernet-HOWTO-2.html I understood that I should look at ??System.map file for names like ne_probe. But can't find anything about that really.

My boot output is: http://pastebin.com/C2SmKjQA

And cat /proc/ioports doesn't show anything about ne2k-pci, as it's expected to, according to http://www.h7.dion.ne.jp/~qemu-win/HowToNetwork-en.html.

  • I was trying to search for "freebsd qemu network interfaces missing" and didn't get her from google, the on-site search worked though. Thank your for the details! Using interface type e1000 worked right away. – ThorSummoner Nov 24 '17 at 20:58
2

By default, you should have user mode networking as explained in the docs:

By default QEMU will create a SLiRP user network backend and an appropriate virtual network device for the guest (eg an E1000 PCI card for most x86 PC guests)

If you want something better, consider tap networking:

Add something like the following to your qemu command:

-netdev tap,id=tap0 -device e1000,netdev=tap0

or for older versions of qemu:

-net nic -net tap,ifname=tap0,script=no,downscript=no

Be aware that they need you to start qemu as root and also may require configuration of the host networking.

More info available on Wikibooks and in the QEMU Networking docs.

  • I've used "-net nic -net tap,ifname=tap0,script=no,downscript=no" to not use user mode network. But I guess device is the important parameter Im missing? – netigger Dec 6 '14 at 21:50
  • netdev=network0 is that so I can identify it with id=network0 in -netdev? – netigger Dec 6 '14 at 21:54
  • The -device and -netdev method is the newer way of configuring devices. It replaces -net. Correct: network0 is the identifier that ties the two together. – garethTheRed Dec 6 '14 at 21:56
  • I now have my eth0! Though those parameters didnt have any effect... I added e1000 to the kernel and got the interface, both with and without those parameters. Any hints on why? – netigger Dec 6 '14 at 22:43
  • @DavidEverlöf - Just found this in the QEMU docs, which probably explains it: By default QEMU will create a SLiRP user network backend and an appropriate virtual network device for the guest (eg an E1000 PCI card for most x86 PC guests). – garethTheRed Dec 7 '14 at 8:17

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.