<div dir="ltr"><div dir="ltr"><div>Hi Antony,<br></div><div><br></div><div>Thank you for your time.   <br></div><div><br></div><div>I have been referring to this page (<a href="https://libreswan.org/wiki/XFRM_pCPU" target="_blank">https://libreswan.org/wiki/XFRM_pCPU</a>) and it doesn't say that XFRM is only supported for ikev2. I am setting up a shared VTI for 500 Remote Clients IPSec (xAUTH using PAM, IKEv1) tunnels. I have attached my ipsec.conf at the bottom of this email.</div><div><br></div><div><b>What I understand from your response: Please correct me</b></div><div>1. Lbreswan experimental versions only support pCPU with IKEv2. (Lod balancing one big IPSec flow over multiple vCPUs.)</div><div><br></div><div><b>Question: </b>For my use case (500 Clients, 

xAUTH using PAM, IKEv1

) the SAs per client will be created per vCPU.</div><div><ul><li>The vCPU will be picked randomly (How will the 500 SAs be distributed?) 500/6 = 82 SAs per CPU. </li><li>There shall be no duplicate SAs for a single connection over multiple vCPU because there is no pCPU XFRM. Correct?</li><li>Is there a way fro me to check how any SAs got allocated to a vCPU on my system?</li></ul><div><b>My Observation: </b>When I start pushing traffic across all the 500 SAs </div><div><ul><li>Some times the load isn't distributed evenly and I see some vCPUs geting overutilized and start slowing down the Libreswan packet processing rate. </li><li>The Libreswan server itn't able to process packets fast enough and the TAP interface (tx queue) on the KVM virtulization host starts dropping packets.</li></ul></div></div><div>Currently, my ipsec clients are using: (

Any advice?) vCPU is Intel(R) Xeon(R) Gold 6126 CPU @ 2.60GHz passthrough Host VM</div><div>ike=3des-sha1-modp1024<br>esp=aes256-md5-modp1024</div><div><br></div><div>###########################  ipsec.conf  ###########################</div><div>config setup<br>        uniqueids=no<br><br>conn %default<br>        dpdaction=clear<br>        dpddelay=30s<br>        dpdtimeout=90s<br>        ikev2=no<br>        rekey=no<br>        ikelifetime=24h<br>        lifetime=24h<br>        authby=secret<br>        leftxauthserver=yes<br>        rightxauthclient=yes<br>        xauthby=pam<br>        left=10.11.251.251<br>        leftsubnet=<a href="http://0.0.0.0/0" target="_blank">0.0.0.0/0</a><br>        leftid=@libreswan<br>        right=%any<br>        vti-interface=vti01<br>        vti-routing=yes<br>        vti-shared=yes<br>        mark=5/0xffffffff<br>        replay-window=0<br>        nic-offload=auto<br>        type=tunnel<br>        auto=add<br></div><div><br></div><div>conn strswan1<br>        rightid=STRSWANAT1<br>        rightsubnet=<a href="http://10.15.0.0/30" target="_blank">10.15.0.0/30</a></div><div><br></div><div>...... 1 through N</div><div> </div><div>  conn strswan500<br>        rightid=STRSWANAT500<br>        rightsubnet=<a href="http://10.16.0.0/30" target="_blank">10.16.0.0/30</a>  <br></div><div><br></div><div><div><br></div><div>###########################  ipsec.conf  ###########################</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 17, 2020 at 12:40 PM Antony Antony <<a href="mailto:antony@phenome.org" target="_blank">antony@phenome.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Sep 15, 2020 at 11:11:30AM -0400, Rav Ya wrote:<br>
> Hello Everyone,<br>
> <br>
> Please advice. Any help will be highly appreciated. Thank you in advance.<br>
> <br>
> *Test Setup: *Libreswan Server (Virtual Machine: KVM)<br>
> 500 IPSec Clients (xAuth using PAM-Auth)<br>
<br>
can you share your libreswan config? Where did you get libreswan with xauth <br>
and pCPU support? <br>
<br>
The libreswan expirimental versions only support pCPU with IKEv2, without <br>
CP(or xauth) payload, INTERNAL_IP options. It is meant for data center like <br>
envirment without NAT and without xauth. Just one fat IPsec flow, using AES <br>
GCM, with multiple CPU cores (not hyper threads).<br>
<br>
> I am running a Libreswan server in a virtual environment (VM hosted on<br>
> KVM/oVIRT). The logical network i.e. virtio-net virtual NIC drivers<br>
> supports Multiqueue. I have 6 vCPUs configured with 6 RX/TX Queue (1 queue<br>
> per vCPU).<br>
<br>
vCPU and XFRM bottlenecks are hard to debug. What is the host CPU? look at <br>
cache miss(using kernel perf) and IRQ distributions using mpstat.<br>
<br>
> The traffic load balancing over XFRM pCPU is flaky. Initially, the load<br>
> gets evenly distributed and after a while, only 1 (at most 2) vCPUs get<br>
> utilized with soft IRQs and the rest go underutilized. <br>
<br>
> I read an article that said XFRM pCPU only supports RSS NIC and<br>
> recently support for vmxnet3 (VMWare) got added. The KVM and virtio<br>
> Multiqueue was listed under future ideas and worklist.<br>
<br>
you are likely mixing up too many things. xauth and RSS can work on its own.  <br>
As far as I see you don"t need pCPU for with 500 clients. The idea behind <br>
pCPU work is traffic for one SA, or a few SAs, split across multiple CPUs.  <br>
and pCPU only work upto number CPUs. We were focused on on Intel CPUs only, <br>
with AESNI acceleration. As I see it, it will not work very well vCPU 6 CPUs <br>
and 500 clients use case.<br>
<br>
> Is there a way to work around this limitation? Is this support available <br>
> on  the Latest version of Kernel and Libreswan? please advise.<br>
<br>
Which crypto cypher is used?  One tip, if it is AES GCM with AESNI <br>
accelartion aovid hyper threading.<br>
CPU threads may share AESNI engine, hence lowering performance on vCPU.  <br>
Check your specific CPU model.<br>
<br>
<br>
</blockquote></div>
</div>