Date: Mon, 24 Oct 2005 15:02:18 +0200 From: guru@Sisis.de To: dick hoogendijk <dick@nagual.st> Cc: fbsdq <questions@freebsd.org> Subject: Re: tun/tap and qemu Message-ID: <20051024130218.GB8020@rebelion.Sisis.de> In-Reply-To: <20051024144711.6dbc87b0.dick@nagual.st> References: <20051024144711.6dbc87b0.dick@nagual.st>
next in thread | previous in thread | raw e-mail | index | archive | help
El día Monday, October 24, 2005 a las 02:47:11PM +0200, dick hoogendijk escribió:
> Qemu uses user-net network stack if NO tun/tap network init script is
> found. The example on their website is about linux.
> 
> When I use user-net all works very fine, but my virtual machine is
> outside my intranet domain. It gets an 10.0.2.x IP As I understand,
> using tun/tap gives me the opportunity to use a virtual card that I can
> assign an ip like 192.168.11.x That way my virtual machine becomes a
> member of that 192.168.11 local network (more like vmware does).
> 
> What I did was put the tun0 device in devfs.conf (usr:root:xxx);
> perm:660) The device is created under /dev (shouldn't this
> be /dev/net ?) But where and how comes the initscript into being?
> If I ifconfig tun0 in rc.conf only one extra ip gets assigned.
> 
> Can someone shine some light on this matter?
> 
> If tun/tap is difficult or not adviced, how can I make my 10.0.0.x
> machines show themselves on my mail 192.168.11.xx network?
I have in /boot/loader.conf
#
# this is required my qemu
#
kqemu_load=YES
if_tap_load=YES
and qemu must be started as 'root' to bring up the interface
with a script /etc/qemu-ifup:
#!/bin/sh
/sbin/ifconfig $1 172.20.0.1
I'm launching the VM via an icon on the desktop which itself
launches a script /home/guru/qemu/w2k/qemu.sh to make it
easy to see if qemu could boot up from some saved state or
has to boot the guest OS from scratch (normaly I save the
VM into a file 'ram', which is of course a little bit dangerous
because you are 'root'; but I'm the only person on my laptop and
mostly I know what I do :-)):
#!/bin/sh
test `id -u` -ne 0 && {
    echo must be started by root ; exit
}
cd /home/guru/qemu/w2k
# we must decide to reboot from disk or loadvm from last saved ram
#
test -f .laststart || {
    logger -t $0 "no file .laststart -- can't start, exit"
    exit 1
    }
if [ .laststart -nt ram ]; then
    touch .laststart
    qemu -localtime disk
else
    touch .laststart
    qemu -localtime -loadvm ram disk
fi
my VM contacts the FreeBSD Samba share and printers via the
IP net 172.20.0.x and for having access to the rest of the world
I have NAT configured ... all works very nice and so I can run
our Windows applications on top of FreeBSD....
	matthias
-- 
Matthias Apitz / Sisis Informationssysteme GmbH
Gruenwalder Weg 28g / D-82041 Oberhaching
Fon: ++49 89 / 61308-351, Fax: -399, Mobile ++49 170 4527211
http://www.sisis.de/~guru/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051024130218.GB8020>
