qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Setting up tun/tap network doesn't work
@ 2005-10-14 21:14 Alexander Skwar
  2005-10-14 22:28 ` Marco Matthies
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexander Skwar @ 2005-10-14 21:14 UTC (permalink / raw)
  To: qemu-devel

Hello.

I'm trying to get qemu 0.7.2 on Gentoo Linux to work with tun/tap
network - but fail to do so :/

I compiled the kernel (2.6.13-suspend2-r4) with tun/tap support
and copied the "qemu-ifup" script from linux-test-0.5.1 to
my /etc directory. I loaded the "tun" module.

alexander@blatt ~/var/qemu $ ls -la /dev/net/tun
crw-rw----  1 root root 10, 200 14. Okt 22:56 /dev/net/tun

When I start qemu (as root) with:

sudo qemu -nographic -hda linux.img -kernel bzImage-2.4.21 -append "console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe
ide5=noprobe"

I get as the first line of output:

Connected to host network interface: tun0

and later on:

QEMU Linux test distribution (based on Redhat 9)

Type 'exit' to halt the system

SIOCSIFADDR: No such device
eth0: unknown interface: No such device

sh-2.05b# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)


Thus, network isn't setup properly inside the qemu "guest".

Rather obviously, I seem to be missing something. But what
is it? Also, the documentation isn't that clear, as far as
the network part is concerned... Also, I'm sorry to bother
you on the devel list, but the "plain users" forum is down :(

Thanks a lot for any help you can provide,

Alexander Skwar

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Setting up tun/tap network doesn't work
  2005-10-14 21:14 [Qemu-devel] Setting up tun/tap network doesn't work Alexander Skwar
@ 2005-10-14 22:28 ` Marco Matthies
  2005-10-14 22:54 ` Jim C. Brown
  2005-10-16 21:10 ` Henrik Nordstrom
  2 siblings, 0 replies; 6+ messages in thread
From: Marco Matthies @ 2005-10-14 22:28 UTC (permalink / raw)
  To: qemu-devel

Hi Alexander,

as I also struggled hard to get qemu networking running, so i will post 
my notes that i made when i finally managed to get it going. But first a 
resource that might help you:

faq in the unofficial qemu wiki:
http://lilly.csoft.net/~jeffryj/cgi-bin/moin.cgi/FrequentlyAskedQuestions

My setup below might be braindamaged, i simply kept going till I had it 
running, there might be things that i did too complicated.. YMMV.

the info to get it running was scraped from various websites like the 
abovementioned one:
-------------------------
1) install vde (http://vde.sourceforge.net/)
2) compile kernel with tun/tap and ipv4 masquerading, forwarding, ... i 
don't remember anymore, i believe masquerading and forwarding was enough.

my network:
--------
host:                   192.168.2.189   [assigned via dhcp]
gateway host/guest:     192.168.254.254 [guest sees host as this ip]
guest:                  192.168.254.1
nameserver of isp       1.2.3.4

Host, as root:
------------------------------------------------
vde_switch -tap tap0 -daemon
ifconfig tap0 192.168.254.254 [netmask 255.255.255.0]
chmod 777 /tmp/vde.ctl # 755 is supposed to work as well
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

Host, as user (example):
------------------------
vdeq qemu-system-x86_64 -boot d -cdrom knoppix.iso

Guest, as root (this is for linux/bsd):
---------------------------------------
ifconfig eth0 192.168.254.1 [netmask 255.255.255.0]
route add default gw 192.168.254.254
echo "nameserver 1.2.3.4" >> /etc/resolv.conf

Obviously you'll have to replace the addresses with the appropriate ones 
on your network. This setup should then allow the guest to communicate 
with the host and the guest to also reach the internet.

Hope this helps,

Marco

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Setting up tun/tap network doesn't work
  2005-10-14 21:14 [Qemu-devel] Setting up tun/tap network doesn't work Alexander Skwar
  2005-10-14 22:28 ` Marco Matthies
@ 2005-10-14 22:54 ` Jim C. Brown
  2005-10-15  6:24   ` Alexander Skwar
  2005-10-16 21:10 ` Henrik Nordstrom
  2 siblings, 1 reply; 6+ messages in thread
From: Jim C. Brown @ 2005-10-14 22:54 UTC (permalink / raw)
  To: qemu-devel

On Fri, Oct 14, 2005 at 11:14:29PM +0200, Alexander Skwar wrote:
> Hello.
> 
> I'm trying to get qemu 0.7.2 on Gentoo Linux to work with tun/tap
> network - but fail to do so :/
> 
> Thus, network isn't setup properly inside the qemu "guest".
> 
> Rather obviously, I seem to be missing something. But what
> is it? Also, the documentation isn't that clear, as far as
> the network part is concerned... Also, I'm sorry to bother
> you on the devel list, but the "plain users" forum is down :(
> 
> Thanks a lot for any help you can provide,
> 
> Alexander Skwar
> 

Make sure the guest supports the ne2k-pci driver (either compiled in or loaded
as a module). from the output you provided, it appears that your guest kernel
lacks the right ethernet driver. Check the output of dmesg to see if ne2k
is mentioned.

-- 
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Setting up tun/tap network doesn't work
  2005-10-14 22:54 ` Jim C. Brown
@ 2005-10-15  6:24   ` Alexander Skwar
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Skwar @ 2005-10-15  6:24 UTC (permalink / raw)
  To: qemu-devel

Hi!

Jim C. Brown schrieb:

> Make sure the guest supports the ne2k-pci driver (either compiled in or loaded
> as a module). from the output you provided, it appears that your guest kernel
> lacks the right ethernet driver. Check the output of dmesg to see if ne2k
> is mentioned.

I used the linux-test guest, that's provided on the qemu
website and mentioned in the qemu documentation. I'd expect
that this has a ne2k-pci driver. If not, maybe the "maintainer"
of that package should be contacted? Who is maintaining that?

Thanks a lot,

Alexander Skwar
-- 
Ontogeny recapitulates phylogeny.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Setting up tun/tap network doesn't work
  2005-10-14 21:14 [Qemu-devel] Setting up tun/tap network doesn't work Alexander Skwar
  2005-10-14 22:28 ` Marco Matthies
  2005-10-14 22:54 ` Jim C. Brown
@ 2005-10-16 21:10 ` Henrik Nordstrom
  2005-10-17 14:13   ` Alexander Skwar
  2 siblings, 1 reply; 6+ messages in thread
From: Henrik Nordstrom @ 2005-10-16 21:10 UTC (permalink / raw)
  To: qemu-devel

On Fri, 14 Oct 2005, Alexander Skwar wrote:

> QEMU Linux test distribution (based on Redhat 9)
>
> Type 'exit' to halt the system
>
> SIOCSIFADDR: No such device
> eth0: unknown interface: No such device

You are missing the correct network driver for the emulated NIC provided 
by QEMU.

This is not related to TUN/TAP, but only the configuration of your guest 
to match the virtual hardware provided by QEMU. Your Linux guest should be 
configured to use the "ne2k-pci" network driver.

Regards
Henrik

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Setting up tun/tap network doesn't work
  2005-10-16 21:10 ` Henrik Nordstrom
@ 2005-10-17 14:13   ` Alexander Skwar
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Skwar @ 2005-10-17 14:13 UTC (permalink / raw)
  To: qemu-devel

Henrik Nordstrom schrieb:
> On Fri, 14 Oct 2005, Alexander Skwar wrote:
> 
>> QEMU Linux test distribution (based on Redhat 9)
>>
>> Type 'exit' to halt the system
>>
>> SIOCSIFADDR: No such device
>> eth0: unknown interface: No such device
> 
> You are missing the correct network driver for the emulated NIC provided 
> by QEMU.
> 
> This is not related to TUN/TAP, but only the configuration of your guest 
> to match the virtual hardware provided by QEMU. Your Linux guest should be 
> configured to use the "ne2k-pci" network driver.

Thanks. Do you know who is maintaining the linux-test image that's
referenced to in the documentation?

http://fabrice.bellard.free.fr/qemu/download.html
-> QEMU disk images
--> linux-test-0.5.1.tar.gz
    QEMU Linux demonstration
http://fabrice.bellard.free.fr/qemu/linux-test-0.5.1.tar.gz

Alexander Skwar
-- 
Predestination was doomed from the start.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-10-17 14:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-14 21:14 [Qemu-devel] Setting up tun/tap network doesn't work Alexander Skwar
2005-10-14 22:28 ` Marco Matthies
2005-10-14 22:54 ` Jim C. Brown
2005-10-15  6:24   ` Alexander Skwar
2005-10-16 21:10 ` Henrik Nordstrom
2005-10-17 14:13   ` Alexander Skwar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).