Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2006 11:40:01 +0100
From:      "mal content" <artifact.one@googlemail.com>
To:        freebsd-questions@freebsd.org
Subject:   Once again lost in the woods with QEMU, pf, bridge.sh, tap...
Message-ID:  <8e96a0b90608110340o7f197a1dr2b23a414f8fe63bd@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello.

I'm trying to get qemu with tap networking happening under FreeBSD 6.1.
I did make some progress with the last solution given to me, but I still
couldn't get it to work. Doing things this way seems to be the only method
that works for me currently.

The main problem I'm having is that I can't seem to get pf to do any
packet filtering. My setup currently looks like this:

/etc/pf.conf:

nic0 = "fxp0"
host_ip = "192.168.2.5"

#----------------------------------------------------------------------#

pass in log all
pass out log all

--
if-up2:

#!/bin/sh -x

ext_if="fxp0"
tap_if="$1"

sudo ifconfig $tap_if 0.0.0.0 up
--

run-qemu2.sh:

#!/bin/sh -x

sudo sysctl net.link.tap.user_open=1
sudo ./bridge.sh start

qemu \
  -m 128 \
  -net nic \
  -net tap,script=if-up2 \
  -hda openbsd_39_hda.img

sudo ./bridge.sh stop
sudo sysctl net.link.tap.user_open=0
--

'bridge.sh' is the standard bridge.sh copied from /usr/src
and edited for my interfaces:

BRIDGE_NAME="bnet0"
BRIDGE_IFACES="fxp0 tap0"
LOCAL_IFACES="fxp0"

Now, the OpenBSD guest is set up to have the IP address '192.168.2.7',
and it does work. I can connect out from the guest and I can SSH in
with no problems. HOWEVER - pf doesn't log the packets, and this
is worrying. I seem to be somehow avoiding pf logging, despite the
fact that I've told pf to log everything coming in or out of the machine
(it also logs traffic on loopback, for now).

I fully admit that I don't understand everything going on here, particularly
the magic inside bridge.sh.

I basically just want to be able to tell pf to filter all packets coming from
the tap0 interface (doesn't seem to work) or all packets coming from
192.168.2.7 (unreliable, I would think, what if the guest OS spoofs the
source address?).

help, flames, etc, appreciated.
MC



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