Date: Sat, 8 Mar 2008 20:47:45 +0100 (CET) From: Juergen Lock <nox@jelal.kn-bremen.de> To: ulrich@pukruppa.net Cc: freebsd-emulation@freebsd.org Subject: Re: Qemu: bridging on FreeBSD 7.0-STABLE Message-ID: <200803081947.m28JljAR041681@saturn.kn-bremen.de> In-Reply-To: <20080308143231.U2007@pukruppa.net> References: <20080308054515.V19713@pukruppa.net> <20080308113537.GA25773@mail.scottro.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <20080308143231.U2007@pukruppa.net> you write: >On Sat, 8 Mar 2008, Scott Robbins wrote: > >> On Sat, Mar 08, 2008 at 06:51:30AM +0100, Peter Ulrich Kruppa wrote: >> >>> >>> I am afraid I need some help to set up networking for >>> qemu-0.9.1 on FreeBSD 7.0-STABLE amd64 . >> >> I did a howto on this awhile back. However, these days, I don't use >> qemu too much, so I'm no longer sure how much of it is still applicable. >> >> Therefore, untested for months, but it's actually mentioned in the >> pkg-message for qemu. >> >> http://forums.bsdnexus.com/viewtopic.php?id=1563 >> >> It's untested for some time, but back when 7.0 was CURRENT, it worked >> like a charm, thanks to the help of some folks on this list (who are >> thanked in the howto.) >Thanks a lot, but I still have got the same problems - and you >are right, last summer, or so, everything worked like a charm, >but now it doesn't anymore. > >So I still need advice for (today's) 7.0-STABLE :( > > >> > >>> As /etc/qemu-ifup (Permissions 755) I use >>> #!bin/sh >>> ifconfig ${1} 0.0.0.0 >>> >> Even with 755 permissions, I don't know if it would work, since it's >> doing ifconfig which will require root privilege. Use sudo in the >> ifconfig part. >I am doing all this as root. Ok since I now also have a RELENG_7_0 box I just tested this, and ended up doing the following (a little different than in the howto since I didn't want to mess with sudo): 1. Preparation: I added perm tap0 0660 to /etc/devfs.conf (my user is in wheel, if yours isnt maybe do own tap0 john:john like in the howto) 2. after that, or later after reboot, as root: kldload aio kqemu if_bridge if_tap sysctl net.link.tap.up_on_open=1 sysctl net.link.tap.user_open=1 /etc/rc.d/devfs restart touch /dev/tap0 ifconfig bridge0 create ifconfig bridge0 addm em0 ifconfig bridge0 addm tap0 ifconfig bridge0 up (as you can see that box' physical nic is an em(4), use whatever yours is) 3. now start qemu as user: qemu-system-x86_64 -m 256 -cdrom 7.0-RELEASE-amd64-livefs.iso -net nic -net tap,ifname=tap0,script=/usr/bin/true -boot d (I also used -curses but thats only in the qemu-devel update atm that I posted about on -emulation. 32 bit qemu with a 32 bit guest should work as well of course, actually if you don't use the qemu-devel update 64 bit FreeBSD 7.0 guests probably won't work, they need the files/patch-cpu-exec.c in the update. Oh and I used an UP kernel on the host...) 4. now to test networking in the guest (as this is the FreeBSD livefs iso, enter fixit via fixit->cdrom in sysinstall after cancelling the keymap selection menu:) ifconfig ed0 <unused IP on the host em0's subnet> [if you want to use this for real you probably would use another one of the emulated nics, i.e. -net nic,model=i82557b or the new e1000 in the qemu-devel update since they should perform better, but for testing the default ne2kpci is enough] route add default <host em0's gateway IP> ln -s /dist/usr/bin /usr [the above is needed in fixit for scp to work, I never can remember my dns IPs...] scp nox@<host em0's IP>:/etc/resolv.conf /etc fetch http://freebsd.org and that leaves the guest with a html file called freebsd.org . Obviously, since I'm on a lan using private IPs here the fetch needs nat enabled (and not firewalled) for the IP I gave to the guest, the same is true if your host isn't on a lan but is using public IP(s) and has no unused public IP available that you could use for the guest. But that's basic networking 101 that I guess most ppl here already know, :) if you simply remember that the guest will act just like another host on the network you brigde tap0 with... HTH, Juergen
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803081947.m28JljAR041681>