Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Jul 2006 19:51:29 +0200
From:      Fabian Keil <freebsd-listen@fabiankeil.de>
To:        "mal content" <artifact.one@googlemail.com>, freebsd-questions@freebsd.org
Subject:   Re: qemu with tap networking on FreeBSD 6.1
Message-ID:  <20060729195129.15feb19b@localhost>
In-Reply-To: <8e96a0b90607281232k216490d8l33e3261f6081124d@mail.gmail.com>
References:  <8e96a0b90607280942o7fb9d5e5s876ad7367379210@mail.gmail.com> <20060728212909.032e047c@localhost> <8e96a0b90607281232k216490d8l33e3261f6081124d@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_lk==40RPPismYJQTTvQezLr
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

"mal content" <artifact.one@googlemail.com> wrote:

> On 28/07/06, Fabian Keil <freebsd-listen@fabiankeil.de> wrote:

> > Personally I prefer to use NAT to connect qemu
> > (and jails) with the world outside. This way you can
> > use pfctl -ss -r to see which connections come
> > from the host system and which don't.
> >
>=20
> How does this work?

In my PF default configuration there are "anchor"
and "nat-anchor" lines for every device from tap0 to tap9.

My qemu configuration script is:=20

|#!/bin/sh -x
|tap_if=3D$1
|ext_if=3Diwi0
|number=3D`expr \`echo $tap_if | cut -c 4\` + 7`
|
|sudo ifconfig $tap_if 192.168.$number.49
|echo "nat pass on $ext_if from $tap_if:network to any -> $ext_if" | sudo p=
fctl -N -a $tap_if -f -  =20
|echo "pass quick on $tap_if flags S/SA keep state" | sudo pfctl -a $tap_if=
 -R -f -

I start qemu with:

sudo dd if=3D/dev/null of=3D/dev/tap0
sudo chown fk /dev/tap0
qemu -m 32 -net nic -net tap,script=3D/home/fk/scripts/qemu-config -hda ~/t=
est/netbsd.img

If I have to use other tap device I have to change the network settings
in the guest system, but usually I only need one qemu process.

if_tap is loaded on boot and net.link.tap.user_open is
enabled in /etc/sysctl.conf.

Fabian
--=20
http://www.fabiankeil.de/

--Sig_lk==40RPPismYJQTTvQezLr
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (FreeBSD)

iD8DBQFEy6AmjV8GA4rMKUQRAoujAJ9vc8cbij7FVwOHy5Osd8uAKYs89ACgiLPS
eGPhvL9iVyKMODqo/vTm97I=
=6UtX
-----END PGP SIGNATURE-----

--Sig_lk==40RPPismYJQTTvQezLr--



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