Slow speed from WAN, but fast with VPN or LAN

Hi everybody.
I setup DietPI (Linux DietPi 5.10.123-meson64) on my ODROID HC4

  • CPU: Quad-Core Cortex-A55 (1.800GHz)
  • Memory: DDR4 4GiB
  • Storage: SATA6 Toshiba HDD 12TB

The device is behind my router. I install nextcloud, proftpd on it.
My benchmark HDD:

My speedtest on this DietPI device:

   Speedtest by Ookla

      Server: UACITY LLC - Kyiv (id: 40505)
         ISP: Kyivstar
Idle Latency:     7.90 ms   (jitter: 0.06ms, low: 7.82ms, high: 8.00ms)
    Download:    93.41 Mbps (data used: 86.1 MB)                                                   
                 37.92 ms   (jitter: 7.52ms, low: 7.66ms, high: 288.20ms)
      Upload:    94.01 Mbps (data used: 42.3 MB)                                                   
                 18.16 ms   (jitter: 2.67ms, low: 8.58ms, high: 31.08ms)
 Packet Loss:     0.0%
  Result URL: https://www.speedtest.net/result/c/06b85b80-14da-4562-9882-dea5ee3f14e8
root@DietPi:~# 

When I try to upload/download via Nextcloud or FTP in LAN - speed is about 110 MiB/s (max 1gbit eth).
I try to access from internet(WAN) throught my router - speed is about 2.8 MiB/s. But i use VPN client to my LAN from internet - speed is about 7.5 MiB/s.

I think - my router is cutting speed WAN-DietPI, but no. I install FTP server on my PC in LAN and create port forward in my router (the same i did for DietPI). And checked FTP speed from internet(WAN) throught my router to LAN PC. Is was about 8 MiB/s.

What is the problem, could you tell me?

Could be some throttle from your ISP. If I understood correctly the problem occurs when you download directly from the internet. But when you download through a VPN connection to the home network, it works as expected.

@trendy it’s the other way around. He is connecting from internet back to the home network.

That’s what I understood too.

If is it throttle from ISP - then speed FTP server on PC also will be slow, but it is about 60+.
Slowdown is only with dietpi linux device access from internet.

Yes.

Inet → router(ftp port forward) → lan DietPi: speed about 20 download or upload

Inet → vpn via router → lan DietPi: speed max (60+)

Inet → router(ftp port forward) → lan PC (FTP): speed max(60+)

Iperf3 test between DietPi and Android from inet (VPN disabled, only port forward):

Server listening on 5201
-----------------------------------------------------------
Accepted connection from 89.209.64.145, port 54555
[  5] local 192.168.1.116 port 5201 connected to 89.209.64.145 port 54556
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  3.88 MBytes  32.6 Mbits/sec                  
[  5]   1.00-2.00   sec  5.63 MBytes  47.2 Mbits/sec                  
[  5]   2.00-3.00   sec  5.29 MBytes  44.3 Mbits/sec                  
[  5]   3.00-4.00   sec  5.90 MBytes  49.5 Mbits/sec                  
[  5]   4.00-5.00   sec  5.01 MBytes  42.1 Mbits/sec                  
[  5]   5.00-6.00   sec  5.75 MBytes  48.2 Mbits/sec                  
[  5]   6.00-7.00   sec  7.54 MBytes  63.3 Mbits/sec                  
[  5]   7.00-8.00   sec  7.64 MBytes  64.1 Mbits/sec                  
[  5]   8.00-9.00   sec  7.12 MBytes  59.7 Mbits/sec                  
[  5]   9.00-10.00  sec  6.65 MBytes  55.8 Mbits/sec                  
[  5]  10.00-10.09  sec   675 KBytes  64.8 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.09  sec  61.1 MBytes  50.8 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

But FTP or Nextcloud speed only 2.7 MiB/s (21.6 Mbits/sec) at the same device, isp, time.

Where does the VPN terminates? Means where is the VPN server running your mobile clients are connecting to?

I setup VPN server on router.
When VPN connected - i can use LAN IP of DietPi to connect (192.168.1.116)

This is getting really strange. In your case, the connection between router and DietPi are always same. The only thing changing is the way on how to connect to your router and the router doing port forwarding. Correct?

Yes.
Only lan client IP changing from LAN VPN DHCP to router IP when port forwarding.

Example:
VPN IP: 172.20.8.2        mob_IP -> Router_public_ip -> 172.20.8.2 -> 192.168.1.116
Router IP: 192.168.1.1    mob_IP -> Router_public_ip -> 192.168.1.1 -> 192.168.1.116
DietPI IP: 192.168.1.116  

Unless you have applied some throttling to the ftp server or the router, there is no explanation why the ftp would perform worse in the case of being directly accessed from the internet compared to VPN. However check the cpu utilization of dietpi just in case. I would also test with another router only the non-VPN solution.