# IPsec performance issue

**URL:** <https://forum.openwrt.org/t/ipsec-performance-issue/39690>\
**Category:** Installing and Using OpenWrt\
**Created:** [June 28, 2019, 10:29am UTC](https://forum.openwrt.org/t/ipsec-performance-issue/39690 "2019-06-28T10:29:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwbsw](https://forum.openwrt.org/user_avatar/forum.openwrt.org/cwbsw/32/4609_2.png) [@cwbsw](https://forum.openwrt.org/u/cwbsw)\
**Post date:** [June 28, 2019, 10:29am UTC](https://forum.openwrt.org/t/ipsec-performance-issue/39690/1 "2019-06-28T10:29:36Z")

</div>

My device is gl-inet b1300, an ipq4029 router, flashed with OpenWrt latest snapshot firmware, it is my home lan's gateway, and I set up an IPsec server with strongswan on it. Everything looks good, no error message, but I encounter some strange performance issues. I tested following scenarios:

Youtube App → IPsec → b1300 → ISP's PPPoE link → [youtube.com](http://youtube.com)(udp protocol), seems good, I can playback 1080p video smoothly.

Browser → IPsec → b1300 → ISP‘s PPPoE link → websites(tcp protocol), I can browser sites, but feels laggy. And Speedtest App showed very low speed, under 1Mbps.

nPlayer App → IPsec → b1300 → ethernet → NAS(smb and DLNA protocol), I can browser playlist, but can't playback videos, very very laggy.

File Manager App → IPsec → b1300 → ethernet → http server, very low speed, ~30KBps.

I tested iPhone, Android phone, and Windows 10 notebook, almost the same results.

I also set up strongswan server on a MT7621 router, an x86 machine, with the same minimal configuration, both of them works well, reached 40Mbps and 100Mbps.

I tried b1300's factory firmware too. It's a qsdk compiled firmware, based on OpenWrt 15, with 4.4 kernel and strongswan 5.3.3. I set up strongswan server with the same minimal configuration, and it works well too, reached about 40Mbps.

Because it seems a TCP related issue, I also tried to set TCP mss clamp or specified value on lan and wan interface, but no help. Indeed, There is no need to set MSS on my MT7621 and x86 testing server.

So this issue has been beyond my limited knowledge, I think it should be a low-level OpenWrt issue. I'm looking forward to help from experts. If any more information needed, please let me know.

---

<div class="post-metadata">

**Author:** ![simsasss](https://forum.openwrt.org/letter_avatar/simsasss/32/5_5575768a8748004e209b776fc1b2916d.png) [@simsasss](https://forum.openwrt.org/u/simsasss)\
**Post date:** [July 2, 2019, 6:19am UTC](https://forum.openwrt.org/t/ipsec-performance-issue/39690/2 "2019-07-02T06:19:05Z")

</div>

Same problem with Asus AC58U and IPQ4018 devices.  
If user space module (libipsec) is loaded speed is about 40Mbps with iperf.  
But without libipsec same speed probem exists.  
I'm looking for help too.

---

<div class="post-metadata">

**Author:** ![cwbsw](https://forum.openwrt.org/user_avatar/forum.openwrt.org/cwbsw/32/4609_2.png) [@cwbsw](https://forum.openwrt.org/u/cwbsw)\
**Post date:** [July 3, 2019, 7:46am UTC](https://forum.openwrt.org/t/ipsec-performance-issue/39690/3 "2019-07-03T07:46:19Z")

</div>

Thanks for providing more information.  
It seems that all ipq40xx devices are affected.

---

<div class="post-metadata">

**Author:** ![ckz](https://forum.openwrt.org/letter_avatar/ckz/32/5_5575768a8748004e209b776fc1b2916d.png) [@ckz](https://forum.openwrt.org/u/ckz)\
**Post date:** [July 15, 2019, 8:01am UTC](https://forum.openwrt.org/t/ipsec-performance-issue/39690/4 "2019-07-15T08:01:21Z")

</div>

Same here with Asus AC58U, strongswan ipsec speed never go beyond 40kB

---

<div class="post-metadata">

**Author:** ![simsasss](https://forum.openwrt.org/letter_avatar/simsasss/32/5_5575768a8748004e209b776fc1b2916d.png) [@simsasss](https://forum.openwrt.org/u/simsasss)\
**Post date:** [August 9, 2019, 11:25am UTC](https://forum.openwrt.org/t/ipsec-performance-issue/39690/5 "2019-08-09T11:25:32Z")

</div>

Hello,  
I have found fix for IPsec.  
CRYPTO\_HW is enabled by default in kernel config.  
If I disable it IPSec speed goes up to 50Mbits/s

---

<div class="post-metadata">

**Author:** ![cwbsw](https://forum.openwrt.org/user_avatar/forum.openwrt.org/cwbsw/32/4609_2.png) [@cwbsw](https://forum.openwrt.org/u/cwbsw)\
**Post date:** [August 12, 2019, 2:43am UTC](https://forum.openwrt.org/t/ipsec-performance-issue/39690/6 "2019-08-12T02:43:59Z")

</div>

Thanks. It works on my device too. Could you commit a Pull Request to the official repository?

---

<div class="post-metadata">

**Author:** ![system](https://forum.openwrt.org/uploads/default/original/3X/7/4/740520c71f00039bbf001045c682f0ecb25e905a.png) [@system](https://forum.openwrt.org/u/system)\
**Post date:** [August 22, 2019, 2:44am UTC](https://forum.openwrt.org/t/ipsec-performance-issue/39690/7 "2019-08-22T02:44:01Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
