Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Jun 2007 12:50:49 -0700
From:      Bakul Shah <bakul@bitblocks.com>
To:        Per Hedeland <per@hedeland.org>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: Running "Windows Emulation" headless ... possible? 
Message-ID:  <20070601195049.F060B5B49@mail.bitblocks.com>
In-Reply-To: Your message of "Fri, 01 Jun 2007 21:07:45 %2B0200." <200706011907.l51J7jH2002189@pluto.hedeland.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> >> >> Can I run two or more QEMU instances on the same server with different 
> IPs
> >> ?
> >> >
> >> > Yes.  But you have to make sure each machine gets its own mac
> >> > address.
> >> 
> >> Is that addressed using the tap interface, as Scott mentioned?
> >
> >Yes.
> 
> Hm, maybe I misunderstand the question or the answer, but I disagree.:-)

I interepreted "Is that addressed using the tap interface" to
mean "Is that done (by) using the tap interface".  So I was not
talking about mac address of the tap interface!

> The tap devices get their own MAC addresses, but they're basically
> irrelevant - what you *do* need to do is give the *qemu* instances their
> own MAC addresses, e.g. as '-net nic,macaddr=52:54:00:12:34:67' (the
> default is 52:54:00:12:34:56 - I have no idea if qemu has reserved the
> 52:54:00 prefix, but I'm sticking to it:-). This is the MAC address that
> shows up on the interface in the guest, and that everyone else on the
> same network uses to reach it.

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 ...

> - I never give an IP address to the bridge interface - this is wrong(tm)
>   IMHO, and in any case there should not be any need for it.

I do, to simulate this:

bridge0 --[       ]
	   | | | |
	   0 1 2 3 <- tap interfaces

In effect tap0 .. tapN are to individual VMs and the host
uses just bridge0 to talk to them all.  Also see below.

> 
> - I don't have anything about tap in devfs.conf - but I have the
>   corresponding thing set up via devfs.rules, which I believe is the
>   right place for it to work "dynamically":

Good idea.

> cloned_interfaces="bridge0"
> ifconfig_bridge0="addm bge0 up"

Bridging with the phys device won't work if your VMs are on a
wifi connected laptop.  For this reason I use NAT (and it is
good enough for what I want).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070601195049.F060B5B49>