Problems in nextcloud

Hi everyone I have an annoying and strange problem

System Information
FreeNAS 11.1 U4
Nextcloud 13.0.2
PHP version 7.0.30
Storage: SMB
This is not the first time I have had this problem

The problem is that I try to download files so the download gets stuck and after a minute - 30 seconds it fails
And the strange thing is that in my local network it can download most of the file (eg the file weighs 16GB so it downloads about 12GB and it changes all the time when it gets stuck)
And outside the network it can be stuck at the beginning in the middle or immediately (eg the file weighs 1GB so it can hang at 20 MB and it’s also here changes all the time)
I have no idea where to start checking and how to fix it and I do not think it is timeout because the time of PHP is high

PHP information
Version: 7.0.30
Memory limit: 512 MB
Maximum operating time: 3600
Maximum upload size: 16 GB

And upload files

I checked twice and managed to upload all 16 GB on the local network
And out of the network I was able to upload 4GB (I did not have time yet to check more than that)

And I thought maybe it would be better to mention it too
On the local network I download files on average at a value of 3.4Mb / s
And outside the network at 370 Kb / s

I also used my domain on both the local and outside the network

Thanks Itay