marcelotk15 / snake-os

Automatically exported from code.google.com/p/snake-os
0 stars 0 forks source link

Default TCP Buffer Settings are low #197

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Put the NAS behind a router
2. Put a file of about 3 MB in the FTP folder of the NAS
3. Download the file via internet

What is the expected output? What do you see instead?
I expect to download the file normally but the FTP download stalls
after a few kB. Wireshark at the host detects lost packets. VSFTPD logs an 
error 426 (Can't write network stream) if FTP logging is enabled. If you 
download the file internally, everything works just fine and quite fast.

What version of the product are you using? On what operating system?
I use the NS-K330 with Snake-OS V1.3.2 20101130 (2.6.16-gazineu).

Please provide any additional information below.
I figured out that this is because of a TCP buffer overflow. I increased the 
buffer sizes (tcp_wmem, tcp_rmem and wmem_max, rmem_max) from about 100kB to 
about 12 MB and everything works fine. The error did not occur locally because 
the network is fast enough there.
I suggest to change the default buffer sizes in the next build to prevent this 
error from happening again.

Original issue reported on code.google.com by masterst...@googlemail.com on 2 Sep 2011 at 8:05

GoogleCodeExporter commented 8 years ago
Good to know. How did you change the tcp parameters on the NAS? Sysctl does not 
work.

Original comment by pabl...@gmail.com on 6 Sep 2011 at 7:28

GoogleCodeExporter commented 8 years ago
The configuration files for the TCP settings can be found in /proc/sys/net. I 
inserted those four command into my /etc/init.d/ftpsvc:

echo 12582912 > /proc/sys/net/core/wmem_max
echo 12582912 > /proc/sys/net/core/rmem_max
echo "32768 256000 12582912" > /proc/sys/net/ipv4/tcp_wmem
echo "32768 256000 12582912" > /proc/sys/net/ipv4/tcp_rmem

I put them right under the "vsftpd &" to get them executed with every start of 
the FTP server. If you go into the web configurator now, you can save this 
config to preserve it from being lost during resets of the device.

Maybe only one or two of these files have to be changed to solve the problem 
and maybe 12MB is overkill but I did not try any other settings because it 
works very well this way.

Hope this help someone!

Original comment by masterst...@googlemail.com on 7 Sep 2011 at 5:55

GoogleCodeExporter commented 8 years ago
Fantastic. Very good. I'll try this later today and see how it works. Thanks

Original comment by pabl...@gmail.com on 7 Sep 2011 at 9:58

GoogleCodeExporter commented 8 years ago
Is possible do overclock with commands?

Original comment by robson__...@hotmail.com on 13 Oct 2011 at 2:19

GoogleCodeExporter commented 8 years ago

Original comment by dwmcqu...@gmail.com on 20 Oct 2011 at 12:28

GoogleCodeExporter commented 8 years ago
@masterst

Can you explain for a total Linux newbie how to use those commands over ssh ?

Original comment by octavian...@gmail.com on 18 Apr 2012 at 7:20

Attachments:

GoogleCodeExporter commented 8 years ago
You open the file /etc/init.d/ftpsvc with your favorite text editor (nano, vi, 
...) by entering "nano /etc/init.d/ftpsvc" at your command line. 

The editor will show up and you scroll down till you see the start command of 
the ftp server "vsftpd &". Then you enter the four commands I wrote down in the 
lines below this command. Then save the file and you're done.

Good Luck!

Original comment by masterst...@googlemail.com on 19 Apr 2012 at 6:19