-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limited download speed on MacOS Mojave #428
Comments
Does the native Fortinet client use IPsec or SSL VPN? |
Hey @DimitriPapadopoulos. Both the openfortivpn and the native Fortinet client as using SSL VPN for these connections. |
Ah right, I came across IPsec VPN with the native Mac OS client but it probably refers to the default VPN client built into the Mac OS, not the Fortinet client. |
Maybe it's better optimization, usage of hardware-supported encryption/decryption? If that's the explanation, a follow-up question would be how can we improve the compiler flags that autoconf finds out? Maybe we can suggest a few options that it would try if they are supported... Thread parallelization could be an issue, but openfortivpn is already multithreaded. Doing more than one read thread and one write thread would make things very complicated, especially one would have to know what the remote side does ;) Maybe locking is a problem. There are a few hacks about semaphores in the MacOSX code. Maybe those are not quite optimal. Maybe we have packet fragmentation. Does the native client on MacOS use a different MTU? |
@mrbaseman Wouldn't hardware-supported encryption/decryption depend on the underlying SSL library? About MTU, see for example: |
@DimitriPapadopoulos Oh, yes, you are right. If it's an optimization issue of that kind, one would have to put some effort into the ssl library. But I would be astonished if the openssl from Macports or Homebrew didn't use the hardware acceleration when it's available. |
How to test if OpenSSL is hardware-accelerated on macOS: |
I have also this problem. There isn't any CPU pike, so could it be a lack of hardware support? @jeduardo By curiosity, what is the version of the Fortinet agent you're using, and do you have alike routing tables with both clients? edit : My ratio is poorer. |
I've tried to check it on my Macbook but Forticlient doesn't want to connect :-/ So I can not compare the MTU and MRU settings. But maybe I have found another hint: I stumbled over the speed value that we pass to The |
I have merged #444 on the current master. Maybe this helps? |
Sorry guys, I'm unable to test it anymore as I no longer have access to a fortinet VPN. |
@mrbaseman Could you give me an advice on what I could put in this script?
I tried also openfortivpn --pppd-ipparam='speed 115200' but I saw no difference in speed. I wanted to avoid compilation. :-) |
@JPlanche now that I have merged the pull request you can simply download the current master and compile that one. the ipparam is something that pppd takes and hands over to the ip-up/ip-down scripts which are executed when the tunnel interface is brought up or down. With But as mentioned before, comparing openfortivpn <= 1.9.0 with the current master should already do the job (if this change has any effect at all) |
@mrbaseman I have these brew formulaes installed: automake autoconf [email protected] pkg-config. Sorry, I'm not very used to compilation. :-) I did a search but didn't find any clue... |
Adrien has tagged the 1.10.0 release on the weekend and it has already been picked up by Homebrew. About the configure error that you see: the configure script uses pkg-config to check if openssl is installed in a reasonably new version (some enterprise distributions still backport fixes for 0.9.8). But somehow pkg-config fails to find the openssl package. You may need to set |
So, a simple `brew update` should install the new release.
Well, that's simplier indeed (for me).
I did a quick test with 1.10.0.
Downloading a 38MB file via HTTPS to /dev/null:
- without VPN: 3.15 MB/s
- with forticlientsslvpn: 2.95MB/s
- with openfortivpn 1.10.0: 177KB/s
|
hmm... this is still a factor of more than ten slower with openfortivpn, whereas the forticlient nearly reaches the speed that you see without vpn. So we still have an issue here. Unfortunately, my forticlient doesn't want to connect for some reason, so I can't compare, but I can see the limit of about 2.5 MB/s that was reported by the original author of this issue. |
on my linux laptop I can reach around 40 MB/s so it's either related to old hardware (which hasn't yet encryption support in the cpu) or to the OS type. BTW I have tested with scp of a 130 MB file over Gigabit Ethernet. Without VPN (however routed through a small Fortigate) the file is transferred in 1 second, so a speed of 130 MB/s has to be taken with a grain of salt. Anyhow, it all performs much better than on the old mac that I have. |
We have gathered some experience about the download speed through an SSL VPN connection the last days here at work. We have a Fortigate 90D and there we see around 2.5 MB/s for scp through SSL VPN on Linux. So, we have studied data sheets and forum posts and had a look at the configuration.
In our speed tests I have seen a high CPU load on the Fortigate every time when I have started a transfer through the SSL VPN. |
I'm experiencing this too and by a similar factor of slowdown. Let me know if there's any info I can collect to help. ~80KB/s download with openfortivpn, ~1.8MB/s on commerical client |
Hi @earltedly Another topic that might impact the performance could be the proper choice of the ciphers. Currently, we use the following default:
The insecure ones which we exclude probably provide a better performance, but that would be a bad choice. Maybe we should exclude some others for performance reasons. Openssl has different settings depending on the version of the library, e.g. for 1.0.2 it is
or maybe replacing
could be a good choice. The bottleneck can be on both sides. It may be the Mac (where we could test with So, some performance numbers for different ciphers would be good input.
|
I have done some testing myself. On Linux (when connecting to a big Fortigate) I can reach good throughput rates (measured with scp), and indeed I see a dependence on the ciphers:
On OS X El Capitan I must admit that I see very poor rates, too, by default 2.2 MB/s, |
I just needed to say that SHA1, CAMELLIA and RSA should not be used cuz they are not safe anymore. |
Well, Openssl classifies the ciphers, and some really bad ones are not activated anymore at compile time. The ones mentioned above currently are in MEDIUM I think (but it also depends on the version you take, the 1.0.2 LTS release is approaching EOL now). Thanks for your offer of financial support for the DTLS implementation. Unfortunately, we are a very small team of volunteers here in the project, so time for looking into new topics is a quite rare resource. Anyhow, if any volunteer comes up and provides a pull request we are happy to review and test it. And well... maybe it's even not that much work to implement it, because as mentioned here Openssl already supports DTLS, so it's maybe just a question of finding out if the server supports it, too and switching it on if possible. |
|
Hi ! Just as a quick note (I have the same problem). I replaced the OpenSSL code with Apple macOS Security framework (Secure Transport, I also played a bit with |
I have noticed this part of the code: Lines 613 to 627 in cfcc420
Please bear in mind I know close to nothing on network performance, I've just read a couple online articles:
|
I have also read this online article: I know openfortivpn links with the OpenSSL library from Homebrew, not the LibreSSL library from Apple. I also do understand the above article refers to the LibreSSL library from Apple. Therefore the speed bump between macOS 10.14.4 and 10.14.5 is probably not relevant in our case. Nevertheless it would be worth:
|
It took me some time to gather this but here it is: I always used iperf with different run times 10, 20, 40 seconds and chose the max speed. I performed the tests a few times at different hours during the course of 3 days On linux I monitored the /etc/pppd directory and see who is using it and it seems that the FCT does not use pppd. Most probably they wrote their own pppd/hdlc flavor. The same goes for on Mac. on linux they use libgcrypt:
Speed tests: vpn Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 with openfortivpn 1.3.0 So half the speed difference with the old openssl and old openfortivpn. Next on Debian Kali-roling with openfortivpn 1.13.3 ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1354 root@kali:~# iperf -c myserv -P 10 -m | tail -n 2 with official Linux FCT 6.2.4 I got again vpn: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1400 root@kali:~# iperf -c myserv -P 10 -m | tail -n 2 I also did some tests on an Scientific Linux release 7.8 (redhat based distro) All my test VMs had 4 CPUs assigned and the nic in bridge mode running on the same host machine. On my physical iMac model 2013 I get pretty much the same speed on both VPN clients FCT 6.2.6.737
Let's try to see the version:
ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1354 index 14 imac:$ iperf -c myserv -P 10 -m -t 20 | tail -n 2 openfortivpn 1.13.2 using openssl 1.0.1t 3 May 2016 $ iperf -c 130.92.9.40 -P 10 -t 40 -m | tail -n 2 openfortivpn_xcode_instruments.txt From my observations there is not big difference here on my Catalina. Perhaps it was the case with the older versions like @DimitriPapadopoulos said here #428 (comment) |
This issue affects me and bunch of my colleagues who use openfortivpn. Speeds are extremely slow, like 200 kb/s. |
What you could try is to run some tests directly from the FGT |
That's a difficult task, since I'm just a user and have no access to forti hw at all. Approving running iperf there would be a nontrivial task, also it won't solve anything, just prove the issue. There are some serious issues with openforti which are not present in official client. |
Indeed these are know issues. We just need someone with a Mac to address them - or at least find a possible explanation for these speed issues. |
Please check in the file tunnel.c in lines 233 to 247. I have noticed that the official Forticlient while connected in macos catalina with After the change i get a rate of 20.00 Mbps with ifconfig and the response of the remote system is much better. static const char *const v[] = {
ppp_path,
//"115200", // speed
"20000000",
":192.0.2.1", // <local_IP_address>:<remote_IP_address>
"noipdefault",
"noaccomp",
"noauth",
"default-asyncmap",
"nopcomp",
"receive-all",
"nodefaultroute",
"nodetach",
"lcp-max-configure", "40",
"mru", "1354"
}; Testing was done with Macos Catalina ver 10.15.7 with 50Mbps DSL line. |
Update for the previous post with results from a download of a 600Mb file from a remote system with sftp via openfortivpn: Using speed 115200 sftp download has a rate around 642.2KB/s Testing was done between the same local and remote system and the same vpn gateway. |
Strange, I'm certain @mrbaseman had already tried changing the speed option in the past without effect. By the way, we cannot change this speed option on Linux in the same way because as written in the man page:
Therefore, we will guard this change with |
If i remove the speed option, the tunnel cannot be established. I have run some more tests today with different speeds. Today tests results with different speeds: ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1354 index 13 openfortivpn 3072000 -> 5.1MB/s to 5.5MB/s sftp download ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1354 index 13 openfortivpn 460800 -> 5.1MB/s to 5.5MB/s sftp download ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1354 index 13 openfortivpn 230400 -> 5.1MB/s to 5.5MB/s sftp download ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1354 index 13 openfortivpn 115200 -> 622.5KB/s to 640KB/s sftp download |
OK, I do seem to recall the speed option isn't really optional. It has to be there. On Linux I thought the highest available baud-rate for consoles is 115200, but higher baud-rates for other serial devices, listed in
The baud-rate passed to Depending on acceptable values of speed on Linux, we could use |
It looks like not only But then, if it works, who cares? Perhaps the above code is not in the execution path in the absence of a real serial port. |
I suggest we use |
Was testing out openfortivpn today on my MacOS 10.14.6 (Mojave) system and encountered this issue with v1.15.0 installed via Brew. With a 40mbps (down) DSL connection, was only getting about 600kB/sec on an SCP over the VPN compared to nearly 4MB/sec with Fortinet's client. I cloned the git repo for openfortivpn, switched to the Note, used the |
Thank you guys for fixing this! Much appreciated. May I ask, when the next release will be published containing this fix? |
@Haarolean Not certain yet about the release. I'd like to see #826 fixed first, which will probably require a few days of work. Have you been able to test this change (you need to build openfortivpn for that)? If so would you be able to test whether baud rates of |
Hi, I ran tests on macOS 10.15.7, no too sure about the fortigate but it is on a 10G pipe. Changing baud rates didn't yield any change to the results. |
@DimitriPapadopoulos I haven't tested the changes because I wanted to get it on brew first. Being not very familiar with C/CPP I'm not quite sure how do I compile it to make it present only in brew directory. P.S. I could just wait for the release if Meroje's tests are enough for you. |
@Meroje Thank you so much for all these tests. Since changing baud rates doesn't yield any change to the results, and since Would you be able to test VPN SSL in addition to VPN IPSec with FortiClient? It has been reported elsewhere that openfortivpn has been in par with FortiClient in VPN SSL mode after this change. Hopefully that will be the case for you too. |
The traffic that can be offloaded, maximum throughput, and number of network interfaces supported by each varies by processor model:
If your FGT has NP7 it should be able to offload SSL This could be the reason behind the speed problem. IPsec traffic might be processed by the CPU for the following reasons:
Or could have it disabled for whatever reason. As it seems the SSL VPN traffic is never offloaded or accelerated. It all goes through the CPU and depending on the crypto suites used in the VPN configuration they could or not be accelerated by the CPUs AES-NI instructions. |
@zez3 Thank you for the above thorough research, next time a user complains I will ask the FortiGate model and the FortiOS version. That said, the question remains why only macOS users complained, not Linux users. Of course Linux users only have VPN SSL, whether they use openfortivpn or FortiClient, while macOS users have both VPN SSL and IPSec at their disposal. But then the initial report by @jeduardo states that both openfortivpn and FortiClient are using SSL VPN in his case. Perhaps macOS mistakenly believed both openfortivpn and FortiClient use VPN SSL in their case? |
Last version has fixed the issue for me, now there's stable 10 mb/s connection via HTTP and 5 mb/s via SSH. |
When I download files from a server behind the VPN using openfortivpn my download speeds are capped around 2.5mb/sec. When I perform the same download behind the official Fortinet client, I can maximize my connection speed (around 10mb/sec).
Any ideas what might be happening there? The problem is reproducible on different MacOS laptops when downloading the same files.
The text was updated successfully, but these errors were encountered: