qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Nehren <apeiron@comcast.net>
To: Bakul Shah <bakul@BitBlocks.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Anyone have functioning networking with a FreeBSD host?
Date: Sun, 13 Jun 2004 18:12:36 -0400	[thread overview]
Message-ID: <20040613221236.GA2844@prophecy.dyndns.org> (raw)
In-Reply-To: <200406131859.i5DIxQOK098661@gate.bitblocks.com>

[-- Attachment #1: Type: text/plain, Size: 4261 bytes --]

On Sun, Jun 13, 2004 at 14:59:26 EDT, Bakul Shah scribbled these
curious markings:
> I am using /dev/tap based networking, not the usermode one.
> It all works fine (thanks to some help from Juergen Lock).
> BTW, I am using the latest FreeBSD port &
> Freebsd-5.2-current.

Okay, I got mine working. :)

> - when using the tap device you need to ifconfig the interface.
>   You can do this manually or via a script.  Either copy this
>   script to /etc/qemu-ifup or run it from the command line.
>   Something like
> 
> 	echo ifconfig $1 192.168.0.1	> /etc/qemu-ifup
> 	chmod +x /etc/qemu-ifup
> 
>   This needs to be done on the *host*.

Right, got that.

> - make sure you are using -pci option (I needed this for
>   a FreeBSD guest -- do not know why).

This option (the undocumented one, sigh) was the one that I needed. With
it, I can get both tap and user-mode networking to function. :) For why 
it's needed, read Brat Watson's later message to this thread,
message ID <20040613201706.25684.qmail@web51809.mail.yahoo.com>.

> - You may wish to use the linux-test image from the qemu
>   site, for debugging all this.  Give the *guest OS* an
>   address like 192.168.0.2 or something in the same subnet as
>   the tap interface.  Once the OS is up and its interface
>   configured, you should be able to ping the this address
>   from the host FreeBSD.  If this step works, you have a
>   working connection between the guest and the host; the
>   remaining work is all networking related, nothing to do
>   with qemu per se.

I already had NetBSD 1.6.2 fully installed using the i386cd.iso image,
so I tested with that.

> - Networking related changes: you will have to enable
>   forwarding on the host.  You will likely need to add static
>   routes or update your NAT rules or both.  You may have to
>   run dhcp proxy on the host....  Someone should come up with
>   a script that figures out the right thing to do based on
>   your setup.

Right; I have PF set up to do that. I love PF. With user-mode
networking, though, you don't need this.

> Some random thoughts:
> 
> * When qemu opens the tap device, it always returns a new
>   device.  You can change this behavior by patching vl.c.  On
>   line 1104 change the `for' loop to start at 0 instead of -1
>   -- line # as per the patched sources in the FreeBSD port.
>   This loop first tries /dev/tap and then /dev/tap0,
>   /dev/tap1 and so on.  The change skips /dev/tap.

Actually, I didn't see this. It kept using /dev/tap, but it was showing
up in ifconfig as tap0. Weird.

> * I am not sure if removing suser() test in if_tap.c is the
>   right thing to do from a security perspective so I left this
>   alone.

My _guess_ is that it would prevent any old user from creating 52k tap
devices, and the consequential resource starvation. I'm going to see if
I can't add a sysctl to control this; watch hackers@ and security@ for a
post by me in the near future.

> * I don't see why /dev/tap is an exclusive open device.  If
>   multiple opens were allowed, a number of VMs can be on the
>   same simulated network.  That is, qemu for each guest can
>   open the same device and they will all *see* each other as
>   well as the host!

Do you mean each /dev/tap interface being exclusive? Well, it _is_ bound
to the individual process, which may have something to do with it.
 
> * I first thought qemu should also have a qemu-ifdown script
>   but may be it is better to wrap qemu in a shell script that
>   does the initial setup and final cleanup.

Perhaps a good idea. It's more configurable that way, too.
 
> * It would be nice if qemu exited only on a power down
>   event instead of a reboot.  May be as an option.

Again, a good idea, at least IMO.
 
> Overall this is a very impressive emulator!  So far I have
> brought up Linux, FreeBSD-5.2.1 and a trial version of Window
> 2003.  Kudos to Fabrice Bellard and the other wizardly
> programmers!

Indeed. 't is quite wonderful.

-- 
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated".  -- Ken Thompson
-
Unix is user friendly. However, it isn't idiot friendly.

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

  reply	other threads:[~2004-06-13 22:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-13  5:28 [Qemu-devel] Anyone have functioning networking with a FreeBSD host? Christopher Nehren
2004-06-13 10:46 ` Alexander E. Patrakov
2004-06-13 11:21 ` Antony T Curtis
2004-06-13 18:59   ` Bakul Shah
2004-06-13 22:12     ` Christopher Nehren [this message]
2004-06-14 20:49     ` port update (was: Re: [Qemu-devel] Anyone have functioning networking with a FreeBSD host?) Juergen Lock
2004-06-15  0:19       ` Juergen Lock
2004-06-13 13:05 ` [Qemu-devel] Anyone have functioning networking with a FreeBSD host? Bartosz Fabianowski
2004-06-13 20:17 ` Brad Watson
2004-06-13 20:42   ` Christopher Nehren
2004-06-13 20:55     ` Bartosz Fabianowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040613221236.GA2844@prophecy.dyndns.org \
    --to=apeiron@comcast.net \
    --cc=bakul@BitBlocks.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).