From owner-freebsd-net@freebsd.org Tue Jul 25 08:42:54 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2EC4DBDEFC for ; Tue, 25 Jul 2017 08:42:54 +0000 (UTC) (envelope-from m.muenz@spam-fetish.org) Received: from mailout-02.maxonline.de (mailout-02.maxonline.de [81.24.66.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BB046DC52 for ; Tue, 25 Jul 2017 08:42:54 +0000 (UTC) (envelope-from m.muenz@spam-fetish.org) Received: from web03-01.max-it.de (web03-01.max-it.de [81.24.64.215]) by mailout-02.maxonline.de (Postfix) with ESMTPS id 3D9D34A for ; Tue, 25 Jul 2017 10:42:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by web03-01.max-it.de (Postfix) with ESMTP id 2A05228B849 for ; Tue, 25 Jul 2017 10:42:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at web03-01.max-it.de Received: from web03-01.max-it.de ([127.0.0.1]) by localhost (web03-01.max-it.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id K0CNwK8J5pvF for ; Tue, 25 Jul 2017 10:42:51 +0200 (CEST) Received: from [81.24.66.132] (unknown [81.24.66.132]) (Authenticated sender: m.muenz@spam-fetish.org) by web03-01.max-it.de (Postfix) with ESMTPA id EF36328B847 for ; Tue, 25 Jul 2017 10:42:51 +0200 (CEST) Subject: Re: NAT before IPSEC - reply packets stuck at enc0 To: freebsd-net@freebsd.org References: <459d59f7-2895-8aed-d547-be46a0fbb918@spam-fetish.org> <1c0de616-91ff-a6f9-d946-f098bc1a709f@spam-fetish.org> <911903d1-f353-d5d6-d400-d86150f88136@yandex.ru> <2d607e1a-a2c0-0f85-1530-c478962a76cd@spam-fetish.org> <3344e189-cdf0-a2c9-3a2a-645460866f2d@yandex.ru> <1279753e-9ad1-2c02-304e-5001e2bbc82f@spam-fetish.org> <15e6eb38-ef0c-7bfd-5f2c-d2acc8ea1af4@yandex.ru> <63e80fcf-915e-2dd5-d8c9-1904c8261c6f@yandex.ru> <1c91cd8f-105d-e886-3126-67505c6c3900@spam-fetish.org> <1e889acf-49d1-b70f-7097-82e6e4dfabb6@spam-fetish.org> <454ed1b7-a80f-b096-cfa1-3c32d1e60f7d@yandex.ru> <5dfdfbb3-1046-5abe-b23a-b62c215b5d08@yandex.ru> From: "Muenz, Michael" Message-ID: Date: Tue, 25 Jul 2017 10:43:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <5dfdfbb3-1046-5abe-b23a-b62c215b5d08@yandex.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jul 2017 08:42:54 -0000 Am 25.07.2017 um 10:22 schrieb Andrey V. Elsukov: > > ICMP request should be matched by outbound IPsec policy. Looking to your > tcpdump, you use tunnel IPsec mode. So, how this should work: > > * 10.26.2.N sends ICMP request to 10.24.66.25 > > * 10.26.1.1 handles it by tunnel mode IPsec security policy, something like: > spdadd -4 10.26.2.0/24 10.24.66.0/24 any -P out ipsec \ > esp/tunnel/213.244.192.191-81.24.74.3/require; > * IPsec code does lookup for IPsec SA and uses something like: > add 213.244.192.191 81.24.74.3 esp 0x2478d746 -m tunnel -E ...; Thanks for the detailed explaination! I only know the insights with Linux, but what I try to achieve is, not to build a SA fpr 10.26.2.0 to 10.24.66.0. So IMHO the address rewriting from 10.26.2 to 10.26.1 should be done before getting to the IPSEC process. In Linux a packet not matching a SA would simply be dropped by kernel or throw a "NO PROPOSAL CHOSEN" since there's no known SA for 10.26.2.0 to 10.24.66.0. I'll try to reach out the OPNsense guys if they are willing to patch a new kernel for me. Thanks! Michael