From owner-freebsd-net@freebsd.org Thu Aug 9 23:55:57 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08C4210774B8 for ; Thu, 9 Aug 2018 23:55:57 +0000 (UTC) (envelope-from jim@netgate.com) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 623488E02B for ; Thu, 9 Aug 2018 23:55:56 +0000 (UTC) (envelope-from jim@netgate.com) Received: by mail-lf1-x136.google.com with SMTP id a134-v6so5337522lfe.6 for ; Thu, 09 Aug 2018 16:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netgate.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=olYolsple+Xfki4V7lK5mRJmU7YgkFWFDNcu+ptbQ7s=; b=qwXKEWAIoTo5BE03XHhHtiSFU4zQwkWjUX1SBn9De5SS4/Ehmf8Ct6nnQoIDxbsUJh 2XZ8GFAeeE4s+YCFBhzaTU7IfSR9+hvtG20yX/SDW4DEWsLu8mBgrhFcw07AqmXgSZoG l8MG5cHEsluOozGkRuTycdHyBKjc0OyeKDhG4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=olYolsple+Xfki4V7lK5mRJmU7YgkFWFDNcu+ptbQ7s=; b=KOUk2GhM/o+zAGGkldASrlBHD8+CJqTWaGA3Lakfm/bJEg8IY1sn/B3vKA2goDqUxF LiGNQwzWtr2A8FAG6cwgdWt3jQQZBAjpTh5ZwiFnWBhuFyMjeIuqhMAxmZhDJWsEHFQu oaAGk+DOKBVrEDP/6AK7omc+5ozcpTwz06OjJ1cxOQd7l28eXUZLvDQVhZnhSFSFQX0G 9fD6vlwCXny1YWLJUCllvGdvPqRKw8vPpQdFNvotpluQ1HeAokCSTXGGAkNDNzgI9t9B pEKUDhKT8fv0nEYw5wVRXI+MdnX3If0I6MnqCnDTomisKgtEuMueD/IFnnvvqn/CEmFq Dsxg== X-Gm-Message-State: AOUpUlHQniwyhktL4mW3NSop+WSQdEIwGIrNpzG661QuDV+F3sp40fTp BAnPwBteYduyDZ/yZ9cbyCgF+tqbz8DChIOpphtZbg== X-Google-Smtp-Source: AA+uWPzz/akF2QBMKhVrQ1f+wtJqPOIUcSqRm7gIv+p3FEjKidVmRTdMwmAmlvOGwlFfBId/SpzTDPrrh3ufo9RDz5A= X-Received: by 2002:a19:e9d7:: with SMTP id j84-v6mr2900416lfk.115.1533858954719; Thu, 09 Aug 2018 16:55:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:5205:0:0:0:0:0 with HTTP; Thu, 9 Aug 2018 16:55:53 -0700 (PDT) In-Reply-To: <17acb9c4-f775-04be-4903-3d022a2fa1ac@yandex.ru> References: <62E0C365-AD64-4383-8BA4-298AA0E292F4@dpdtech.com> <17acb9c4-f775-04be-4903-3d022a2fa1ac@yandex.ru> From: Jim Thompson Date: Thu, 9 Aug 2018 18:55:53 -0500 Message-ID: Subject: Re: Is if_ipsec/ipsec - AESNI accelerated ? To: "Andrey V. Elsukov" Cc: "David P. Discher" , John-Mark Gurney , "freebsd-net@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2018 23:55:57 -0000 You're not running AES-GCM, you're running AES-CBC + HMAC-SHA256 > E: rijndael-cbc 221239cf e0ddedc5 88f1f711 5e744723 > A: hmac-sha2-256 bf214e0e 73b27e42 1090a067 eaed9e2a d36d3ae7 529a40a1 bf5ea2c9 0e3f5f27 Try running AES-GCM. Example (from the work that gnn@ and I did back in 2014/15): https://github.com/freebsd-net/netperf/blob/master/IPSEC/Configs/dut-aes-gc= m.conf https://github.com/freebsd-net/netperf/blob/master/IPSEC/Configs/source-aes= -gcm.conf Results on larger hardware, if you care: https://github.com/freebsd-net/netperf/blob/master/Documentation/Presentati= ons/BSDCan2015.pdf Once you have that running, see if setting net.inet.ipsec.async_crypto=3D1 helps Also, if PMTU doesn't work on your path, clamp TCP MSS to 1400 on both sides. # ipfw add # tcp-setmss 1400 or scrub on max-mss 1400 in your pf.conf That all said, I only get around 400Mbps using AES-GCM over a real 1gbps path between my house and work running a C2558 at home. I'm running pfSense (because... you know...), but you should be able to achieve similar results with a stock FreeBSD 11.2 system. If you want to go faster, we've seen 856 mbps over a pair of C3558s, using just AES-GCM w/AES-NI. This is with 'pf' on, and KPI mitigations running, btw. If anything, i'd expect routed ipsec to be a bit faster. Jim On Thu, Aug 9, 2018 at 3:55 PM, Andrey V. Elsukov wrote= : > On 09.08.2018 23:11, David P. Discher wrote: > > The documentation for using IPSec (especially if_ipsec) is really thin > > for freebsd, so I pieced some of this together from various posts and > > mailing lists threads. > > > > Is there no need for racoon ? How in this example is the IKE/ISAKMP > > setup done ? Is setkey doing this ? > > > This is 11.2-stable, shortly after release =E2=80=A6 I don=E2=80=99t ha= ve this sysctl. > > This is manually configured tunnel between two FreeBSD 12.0-CURRENT > hosts. I can suggest to try patch and config from this post: > > https://lists.freebsd.org/pipermail/freebsd-net/2018-May/050509.html > > >> Need to see your setkey.conf, or at least the output of setkey -D.. > > > > > > setkey.conf is : > > > > flush; > > spdflush; > > > > spdadd -4n 172.30.1.12/30 172.30.1.12/30 any -P out ipsec > > esp/tunnel/10.245.0.201-10.245.0.202/unique:12; > > spdadd -4n 172.30.1.12/30 172.30.1.12/30 any -P in ipsec > > esp/tunnel/10.245.0.202-10.245.0.201/unique:12; > > spdadd -4n 172.30.1.4/30 172.30.1.4/30 any -P out ipsec > > esp/tunnel/10.245.0.201-10.245.0.203/unique:4; > > spdadd -4n 172.30.1.4/30 172.30.1.4/30 any -P in ipsec > > esp/tunnel/10.245.0.203-10.245.0.201/unique:4; > > You don't need to create security policies for if_ipsec interfaces. They > are created by interface automatically. > > -- > WBR, Andrey V. Elsukov > >