Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BZaDo-0007yr-3n for qemu-devel@nongnu.org; Sun, 13 Jun 2004 15:00:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BZaDn-0007yK-FF for qemu-devel@nongnu.org; Sun, 13 Jun 2004 15:00:47 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BZaDn-0007y9-BE for qemu-devel@nongnu.org; Sun, 13 Jun 2004 15:00:47 -0400 Received: from [209.204.185.216] (helo=gate.bitblocks.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BZaCY-0001z4-L4 for qemu-devel@nongnu.org; Sun, 13 Jun 2004 14:59:31 -0400 Received: from bitblocks.com (localhost [127.0.0.1]) by gate.bitblocks.com (8.12.11/8.12.10) with ESMTP id i5DIxQOK098661 for ; Sun, 13 Jun 2004 11:59:27 -0700 (PDT) (envelope-from bakul@bitblocks.com) Message-Id: <200406131859.i5DIxQOK098661@gate.bitblocks.com> Subject: Re: [Qemu-devel] Anyone have functioning networking with a FreeBSD host? In-reply-to: Your message of "Sun, 13 Jun 2004 12:21:30 BST." <1087125690.597.27.camel@pcgem.rdg.cyberkinetica.com> Date: Sun, 13 Jun 2004 11:59:26 -0700 From: Bakul Shah Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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. - 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*. - make sure you are using -pci option (I needed this for a FreeBSD guest -- do not know why). - 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. - 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. 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. * 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. * 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! * 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. * It would be nice if qemu exited only on a power down event instead of a reboot. May be as an option. 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!