Subject: Re: cloning tap device (was : qemu networking under -current)
To: Thierry Lacoste <netbsd-help@NetBSD.org, th.lacoste@wanadoo.fr>
From: Hubert Feyrer <hubertf@gmx.de>
List: netbsd-help
Date: 03/25/2005 13:17:04
In article <200503190041.24145.th.lacoste@wanadoo.fr> you wrote:
> Could someone please send me something to test my /dev/tap ?

Here is a Makefile(extract) that I'm using with "make netbsd1" and 
"make netbsd2" to start two qemu instances networked via a bridge(4) and 
connected to the local machine's rtk0 ethernet:

--- snip ---
#NETBSD_NOGFX=
NETBSD_NOGFX=           -nographic


all: netbsd1 netbsd2

netbsd1: bridge 
        ifconfig tap1 create up      || echo tap1: already there
        brconfig bridge0 add tap1 up || echo tap1: already on bridge0
        brconfig bridge0 -learn tap1 # real hub mode, step 1b
        brconfig bridge0 flush  # real hub more, step 2
        qemu \  
                -m 32 \
                ${NETBSD_NOGFX} \
                -boot c \
                -tun-fd 3 3<>/dev/tap1 \
                -macaddr de:ad:be:ef:00:01 \
                harddisk.netbsd1
        brconfig bridge0 delete tap1 
        ifconfig tap1 destroy

netbsd2: bridge
        ifconfig tap2 create up      || echo tap2: already there
        brconfig bridge0 add tap2 up || echo tap2: already on bridge0
        brconfig bridge0 -learn tap2 # real hub mode, step 1c
        brconfig bridge0 flush       # real hub mode, step 2
        qemu \
                -m 32 \
                ${NETBSD_NOGFX} \
                -boot c \
                -tun-fd 3 3<>/dev/tap2 \
                -macaddr de:ad:be:ef:00:02 \
                harddisk.netbsd2
        brconfig bridge0 delete tap2
        ifconfig tap2 destroy
        
bridge:
        ifconfig bridge0 create   || echo bridge0: already there
        brconfig bridge0 add rtk0 || echo bridge0: rtk already there
        brconfig bridge0 -learn rtk0 # real hub mode, step 1a
--- snip ---

Many thanks to Quentin for helping me to get that far. :)


 - Hubert       

-- 
  ___ _ _  _   _        * Harddisk Image Cloning * 
 / __| | || | | |           www.feyrer.de/g4u/
| (_ |_  _| |_| |         
 \___| |_| \___/          Version 2.0 out now!