|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Qemu: bridging on FreeBSD 7.0-STABLEHi,
I am afraid I need some help to set up networking for qemu-0.9.1 on FreeBSD 7.0-STABLE amd64 . The only hint for FreeBSD 7.0 I found was http://people.freebsd.org/~maho/qemu/qemu.html It seems I don't need to kldload bridge, and don't need to set any sysctl variables anymore (right?). I just did (all as root) # ifconfig tap create # ifconfig bridge create # ifconfig bridge0 addm tap0 addm nfe0 up and get # ifconfig -a [...] tap0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 ether 00:bd:63:44:71:00 bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 ether 9e:2e:9a:d5:cf:09 id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0 member: nfe0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> As /etc/qemu-ifup (Permissions 755) I use #!bin/sh ifconfig ${1} 0.0.0.0 Then I try to # qemu Win2k.img -net nic -net tap /etc/qemu-ifup: could not launch network script Could not initialize device 'tap' Next thing I tried was # qemu Win2k.img -net nic -net tap,fd=0 Now qemu will start (and a lot of strange symbols are running across my terminal) but I can't ping anything. >From Qemu Monitor I get: (qemu) info network vlan0 devices: tap: fd=0 ne2000 pci macaddr=52:54:00:12:34:56 Big thanks for your help, Uli. ------------------------------------- Peter Ulrich Kruppa Wuppertal Germany _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEOn 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.) > > 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. Anyway, take a look at the howto and see if it helps. Work these days takes me away from FreeBSD, so I reiterate, it hasn't been tested for some time, but I believe it's more current than the link you mention. -- Scott Robbins PGP keyID EB3467D6 ( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 EB34 67D6 ) gpg --keyserver pgp.mit.edu --recv-keys EB3467D6 Buffy: You read my diary? That is not OK. A diary is like a person's most private possession. You don't even know what I was writing about. Hunk can mean a lot of things, bad things. And, and when I said his eyes were penetrating, I meant bulging. Angel: Buffy... Buffy: A doesn't even stand for Angel for that matter. It stand for Achmed, a charming foreign exchange student. And that whole fantasy part has nothing to even do with you, at all... Angel: Your mother moved your diary when she came in to straighten up. I watched her from the closet. I didn't read it, I swear. Buffy: Oh. _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEOn 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.) 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. Greetings, Uli. ------------------------------------- Peter Ulrich Kruppa Wuppertal Germany _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEIn article <20080308143231.U2007@...> 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 _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEPeter Ulrich Kruppa <ulrich@...> wrote:
> >I am afraid I need some help to set up networking for > qemu-0.9.1 on FreeBSD 7.0-STABLE amd64 . Last week I carried my qemu setup unchanged over from FreeBSD 6.2 / qemu-0.9.0_3 to FreeBSD 7.0-RELEASE / qemu-0.9.1_1 - worked like a charm. Most of my setup is in Scott's howto I think, though it's kind of sprinkled about.:-) >It seems I don't need to kldload bridge, and don't need to set >any sysctl variables anymore (right?). Whether there's a change in that respect depends on where you're coming from - there was no *need* to set sysctl variables in 6.x either, but some of them are very useful (not the bridge ones though). My setup is a bit more dynamic/flexible/complex than what you describe, allowing for multiple qemu instances getting started/stopped and/or running simultaneously - you may not want to copy it if you're only ever going to run one instance. >As /etc/qemu-ifup (Permissions 755) I use > #!bin/sh > ifconfig ${1} 0.0.0.0 > >Then I try to > # qemu Win2k.img -net nic -net tap > /etc/qemu-ifup: could not launch network script > Could not initialize device 'tap' AFAIR, that basically means that your qemu-ifup script exited with a non-zero exit code. I don't know why it would, but you can start by making sure that it doesn't by putting 'exit 0' at the end. This may of course mask an actual problem, but at least it should allow qemu to start, so you can check if there *is* an actual problem. I would also recommend that you do just 'ifconfig ${1} up' instead of 'ifconfig ${1} 0.0.0.0' - shouldn't be much difference, but I have some vague memory of the all-zero address causing problems in some case, and there's certainly nothing good that can come out of it. >Next thing I tried was > # qemu Win2k.img -net nic -net tap,fd=0 >Now qemu will start (and a lot of strange symbols are running >across my terminal) but I can't ping anything. Well, you just need to copy those symbols and paste them into your ethernet interface.:-) Seriously, I believe that command tells qemu to use stdin/stdout for networking - don't do that. And of course, before you can ping anything, networking must be properly set up (whether manually or via DHCP) in the guest OS, as described in other posts. --Per Hedeland _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEGreat thanks to Juergen, Per and Scott (ordered alphabetically)! For the records: On Sat, 8 Mar 2008, Juergen Lock wrote: > 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 That's it: I need -net tap,script=/usr/bin/true I never had thought about that. I have tried script=/etc/qemu-ifup but to set it to true ... !?! Again thank you, Uli. ------------------------------------- Peter Ulrich Kruppa Wuppertal Germany _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEI am confused a bit,
so what would I have to put in /etc/sysctl.conf so that qemu would have bridging for a user, automatically on bootup would I have to have a shell script of some sort? and would it not have to test if there already is a tap0? I have been trying to get this to work for awhile, if anyone has config files they could post I would very much appreciate it. esp if you could get multiple qemu's to bridge at once Sam Fourman Jr. _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEPeter Ulrich Kruppa <ulrich@...> wrote:
>> >> 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 > ^^^^^^^^^^^^^^^^^^^^ >That's it: I need > -net tap,script=/usr/bin/true > >I never had thought about that. I have tried > script=/etc/qemu-ifup >but to set it to true ... !?! Well, 'exit 0' in the script would then have worked too:-) (you do realize that the above runs /usr/bin/true *instead* of /etc/qemu-ifup, I hope). It would have been somewhat interesting to know why the (redundant, in your case) ifconfig in the script failed though - maybe it was just that /sbin wasn't in $PATH at that point. --Per _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEOn Sun, 9 Mar 2008, Per Hedeland wrote:
> Peter Ulrich Kruppa <ulrich@...> wrote: >>> >>> 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 >> ^^^^^^^^^^^^^^^^^^^^ >> That's it: I need >> -net tap,script=/usr/bin/true >> >> I never had thought about that. I have tried >> script=/etc/qemu-ifup >> but to set it to true ... !?! > > Well, 'exit 0' in the script would then have worked too:-) > (you do > realize that the above runs /usr/bin/true *instead* of /etc/qemu-ifup, I > hope). Actually: no (since I am no big shell script hacker). Old simple that I am, I believed it said, "Yes there is a script at the default place /etc/qemu-ifup. Do use it." > It would have been somewhat interesting to know why the > (redundant, in your case) ifconfig in the script failed though - maybe > it was just that /sbin wasn't in $PATH at that point. > > --Per > Greetings, Uli. ------------------------------------- Peter Ulrich Kruppa Wuppertal Germany _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLE"Sam Fourman Jr." <sfourman@...> wrote:
> >I am confused a bit, > >so what would I have to put in /etc/sysctl.conf so that qemu would >have bridging for a user, automatically on bootup > >would I have to have a shell script of some sort? and would it not >have to test if there already is a tap0? > >I have been trying to get this to work for awhile, if anyone has >config files they could post I would very much appreciate it. > >esp if you could get multiple qemu's to bridge at once Here's the setup I use: 0. In /boot/loader.conf: if_tap_load="YES" This may actually be redundant though, I haven't tried w/o it. 1. In /etc/sysctl.conf: # Allow user open of tap device for qemu networking net.link.tap.user_open=1 2. In /etc/devfs.rules: [localrules=10] # devfs starts before NIS, so need numerical uid here (if you use NIS) add path 'tap*' user 1016 3. In /etc/rc.conf: devfs_system_ruleset="localrules" cloned_interfaces="bridge0" ifconfig_bridge0="addm bge0 up" I.e. this is one-time stuff, you can of course do it manually instead when testing: ifconfig bridge0 create ifconfig bridge0 addm bge0 up Use the name of your physical ethernet interface instead of "bge0", of course. 4. /etc/qemu-ifup: #!/bin/sh sudo /sbin/ifconfig $1 up case "`ifconfig bridge0`" in *" $1 "*) ;; # already in the bridge *) sudo /sbin/ifconfig bridge0 addm $1 ;; esac Finally, to run multiple qemus with bridged networking you *must* assign them different MAC addresses via -net nic,macaddr=52:54:00:XX:XX:XX (well, one of them can have the default of course). I just hardwire them, but in an earlier discussion here, Bakul Shah posted a nice trick to auto-generate the MAC address: Right. I use a shell function to create a macaddress based on directory of the image file. Something like: macaddr() { echo 52:54:0:$(echo $1|md5 |cut -c1-6|sed 's/\(..\)\(..\)/\1:\2:/') } qemu -net nic,macaddr=$(macaddr $(dirname $(realpath $1))) -hda $* And invoke it as, for example, my-qemu /usr/oszoo/plan9 ... Incidentally that post can *not* be found by searching the freebsd-emulation archives at freebsd.org, but there's always google... --Per _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEPeter Ulrich Kruppa <ulrich@...> wrote:
> >On Sun, 9 Mar 2008, Per Hedeland wrote: >> >> Well, 'exit 0' in the script would then have worked too:-) >Actually: no :-( Hm, well, at least it should have gotten rid of the /etc/qemu-ifup: could not launch network script Could not initialize device 'tap' that you got, since the only thing qemu knows about the script is the exit code when it tries to run it. Though "could not *launch*" does sound like it wasn't able to run it at all, but I think that's just unfortunate wording - or else you don't actually have the permissions that you think on the script. If it got rid of the message but networking still didn't work, I would suspect the "0.0.0.0" instead of "up". But in any case, if you do the ifconfig manually and are happy with that, there's no need to run a script, as your result with /usr/bin/true shows. Finally, it's worth noting that testing this stuff and drawing the correct conclusions is pretty hard, since you keep leaving "state bits" around - e.g. once you've 'ifconfig up'ed an interface, it remains up even if you think you're "starting over", and you might incorrectly conclude that you don't need that ifconfig thingie. >> (you do >> realize that the above runs /usr/bin/true *instead* of /etc/qemu-ifup, I >> hope). >Actually: no (since I am no big shell script hacker). Old simple >that I am, I believed it said, "Yes there is a script at the >default place /etc/qemu-ifup. Do use it." Well, there is a man page for qemu, and it's quite clear about what the argument to 'script=' means.:-) --Per _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
|
|
Re: Qemu: bridging on FreeBSD 7.0-STABLEOn Sat, 8 Mar 2008, Juergen Lock wrote:
> 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 FYI, script=no (from the man page) tells it to not execute any script. Sean -- scf@... _______________________________________________ freebsd-emulation@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@..." |
| Free embeddable forum powered by Nabble | Forum Help |