From owner-freebsd-net@FreeBSD.ORG Mon Aug 13 09:20:07 2007 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 933CA16A41B for ; Mon, 13 Aug 2007 09:20:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 4F06313C46E for ; Mon, 13 Aug 2007 09:20:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 9B04F41C691; Mon, 13 Aug 2007 11:20:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id LbHgR7Nf1yuh; Mon, 13 Aug 2007 11:20:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 484D041C690; Mon, 13 Aug 2007 11:20:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id E3EAD444885; Mon, 13 Aug 2007 09:17:33 +0000 (UTC) Date: Mon, 13 Aug 2007 09:17:33 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Eric Masson In-Reply-To: <867inzn945.fsf@srvbsdnanssv.interne.kisoft-services.com> Message-ID: <20070813091634.C87821@maildrop.int.zabbadoz.net> References: <867inzn945.fsf@srvbsdnanssv.interne.kisoft-services.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Mailing List FreeBSD Network Subject: Re: pf rdr statement & ipsec processing interaction X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2007 09:20:07 -0000 On Mon, 13 Aug 2007, Eric Masson wrote: > Hello, > > I'm trying to setup a FreeBSD 6.2 box as l2tp/ipsec server for MS > workstations (FAST_IPSEC + Yvan's NAT-T patch) > > Thanks to mpd4, the l2tp part works fine, as the box could in fine have > only a dynamic ip address, I've made mpd listen on a loopback interface > on the box and then redirected incoming l2tp traffic to this loopback > interface : > > $ ifconfig lo1 > lo1: flags=8049 mtu 16384 > inet 10.127.0.1 netmask 0xff000000 > > $ cat /usr/local/etc/mpd4/mpd.links > l2tp1: > set link type l2tp > set l2tp self 10.127.0.1 > set l2tp enable incoming > set l2tp disable originate > > $ cat /etc/pf.conf > ext_if="vxn0" > rdr on $ext_if proto udp from any to ($ext_if) port 1701 -> 10.127.0.1 port 1701 > > If ipsec isn't enabled (no spd & no racoon running on the freebsd side, > ipsec disabled on the xp box), this setup works fine. > > If ipsec is enabled on the box and on the xp box, phase I & phase II > succeed but mpd4 doesn't get any l2tp packet. > > If I setup mpd4 to listen on the external interface address and disable > pf rdr rule, everything works fine (ipsec enabled or disabled) > >> From this, it seems that pf rdr rule isn't applied to the incoming l2tp > packets once they've been ipsec processed. > > Is this an expected behaviour or a bug ? this is expected behavior. You want to read about the IPSEC_FILTERTUNNEL (fka. IPSEC_FILTERGIF) kernel option and enc(4). -- Bjoern A. Zeeb bzeeb at Zabbadoz dot NeT Software is harder than hardware so better get it right the first time.