Didier Wiroth wrote:
> 1) Even if it was pretty obvious (yesterday I was bit lazy ... ;-))
> you have to replace the ETHER variable "trunk0" with your own
> network card in /etc/qemu-ifup, for me it was: ETHER=em0
>
> 2) Here is how I'm starting my qemu (with working network):
> sudo qemu -m 1000 qemu-files/xp.hd -net tap -net nic &
>
> 3) If you fail to start qemu for whatever reason, you can't reuse the
> /etc/qemu-ifup until you destroy the bridge0 interface it had
> previously created: "sudo ifconfig bridge0 destroy" and now retry:
> sudo qemu -m 1000 qemu-files/xp.hd -net tap -net nic

Didier, I tried using your /etc/qemu-ifup (after changing the ETHER to
sis0) but qemu doesn't seem to be invoking that script at all with your
command line.  I added the -x option to the #!/bin/sh line, but it
prints nothing.  Are you sure that you're not doing anything else?

Here's what happens on my machine (obsd39 GENERIC, qemu-0.8.0p3), after
always making sure that bridge0 and tun0 are destroyed:

$ sudo qemu -m 64 /home/qemu/debian-31r1a-i386.img -net tap -net nic
warning: could not open v
,^@
: no virtual network emulation
Could not initialize device 'tap'

And so qemu exits immediately...

The /etc/qemu-ifup script is invoked only if I give qemu more options:

$ sudo qemu -m 64 -net tap,vlan=0,ifname=/dev/tun0 -net nic,vlan=0 \
        /home/qemu/debian-31r1a-i386.img
+ ETHER=sis0
+ BRIDGE=bridge0
+ id -u
+ test 0 -ne 0
+ echo Initializing tun0..
Initializing tun0..
+ ifconfig tun0 link0 up
+ ifconfig bridge0 create
+ brconfig bridge0 add sis0 up
+ brconfig bridge0 add tun0 up

But this still doesn't work correctly, because the guest OS gets the IP
172.20.0.2 and can't reach any other hosts on the LAN (including the
obsd box that's running qemu).

And if I give qemu even more options, then it no longer tries to execute
/etc/qemu-ifup.  But manually setting up the bridge beforehand doesn't
help either:

$ sudo ifconfig tun0 link0 up
$ sudo ifconfig bridge0 create
$ sudo brconfig bridge0 add sis0 up
$ sudo brconfig bridge0 add tun0 up
$ ifconfig tun0
tun0: flags=9943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,LINK0,MULTICAST> mtu 1500
        lladdr 00:bd:0f:df:e9:01
        inet6 fe80::2bd:fff:fedf:e901%tun0 prefixlen 64 scopeid 0x45
$ brconfig bridge0
bridge0: flags=41<UP,RUNNING>
        Configuration:
                priority 32768 hellotime 2 fwddelay 15 maxage 20
        Interfaces:
                tun0 flags=3<LEARNING,DISCOVER>
                        port 69 ifpriority 128 ifcost 55
                sis0 flags=3<LEARNING,DISCOVER>
                        port 1 ifpriority 128 ifcost 55
        Addresses (max cache: 100, timeout: 240):
                00:0f:db:9b:ce:c9 sis0 1 flags=0<>
$ sudo sh -c "qemu -m 64 -net tap,vlan=0,fd=3,ifname=/dev/tun0 \
        3<>/dev/tun0 -net nic,vlan=0,macaddr=de:ad:be:ef:00:00 \
        /home/qemu/debian-31r1a-i386.img"

This gives the exact same result as my previous attempt, except that
now the guest's eth0 has hw addr deadbeef00.

BTW, pf is disabled and net.inet.ip.forwarding=1

Adding 172.20.0.1 as an alias of sis0 makes it possible for the guest to
connect to the host, but no further.  And without that alias, it can't
even connect to the host (neither at 172.20.0.1 or the real IP for
sis0).

Got any more bright ideas Spiderman? :-)

-- 
Stephen Takacs   <[EMAIL PROTECTED]>   http://perlguru.net/
    4149 FD56 D078 C988 9027  1EB4 04CC F80F 72CB 09DA

Reply via email to