Locating the the Parameters

All TCP/IP tunning parameters are located under /proc/sys/net/...  For
example, here is a list of the most important tunning parameters, along
with short description of their meaning:

/proc/sys/net/core/rmem_max - Maximum TCP Receive Window
/proc/sys/net/core/wmem_max - Maximum TCP Send Window
/proc/sys/net/ipv4/tcp_timestamps - timestamps (RFC 1323) add 12 bytes
to the TCP header...
/proc/sys/net/ipv4/tcp_sack - tcp selective acknowledgements.
/proc/sys/net/ipv4/tcp_window_scaling - support for large TCP Windows
(RFC 1323). Needs to be set to 1 if the Max TCP Window is over 65535.

Keep in mind everything under /proc is volatile, so any changes you make
are lost after reboot
<http://www.speedguide.net/read_articles.php?id=121#> .



There are some additional internal memory
<http://www.speedguide.net/read_articles.php?id=121#>  buffers for the
TCP Window, allocated for each connection, those should generally be
left at defaults:
/proc/sys/net/ipv4/tcp_rmem - memory reserved for TCP rcv buffers
(reserved memory per connection default)
/proc/sys/net/ipv4/tcp_wmem  - memory reserved for TCP snd buffers
(reserved memory per connection default)

The tcp_rmem and tcp_wmem contain arrays of three parameter values: the
3 numbers represent minimum, default and maximum memory values. Those 3
values are used to bound autotunning and balance memory usage while
under global memory stress.



Applying TCP/IP Parameters at System Boot

You can place the following code
<http://www.speedguide.net/read_articles.php?id=121#>  in /etc/rc.local
or /etc/boot.local, depending on your distribution (so it gets
automatically reapplied at startup). The TCP/IP parameters should be
self-explanatory: we're basically setting the TCP Window to 256960,
disabling timestamps (to avoid 12 byte header overhead), enabling tcp
window scaling, and selective acknowledgements:
echo 256960 > /proc/sys/net/core/rmem_default
echo 256960 > /proc/sys/net/core/rmem_max
echo 256960 > /proc/sys/net/core/wmem_default
echo 256960 > /proc/sys/net/core/wmem_max

echo 0 > /proc/sys/net/ipv4/tcp_timestamps
echo 1 > /proc/sys/net/ipv4/tcp_sack
echo 1 > /proc/sys/net/ipv4/tcp_window_scaling
Change the values above as desired, depending on your internet
connection <http://www.speedguide.net/read_articles.php?id=121#>  and
maximum bandwidth/latency. There are other parameters you can change
from the default if you're confident in what you're doing - just find
the correct syntax of the values in /proc/sys/net/... and add a line in
the above code analogous to the others. To revert to the default
parameters, you can just comment or delete the above code from
/etc/rc.local and restart.

Another method to reapply the values upon boot is to include the
following in your /etc/sysctl.conf (adjust RWIN values as needed):
net.core.rmem_default = 256960
net.core.rmem_max = 256960
net.core.wmem_default = 256960
net.core.wmem_max = 256960

net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_sack =1
net.ipv4.tcp_window_scaling = 1

Note: To manually set the MTU value under Linux, use the command:
ifconfig eth0 mtu 1500   (where 1500 is the desired MTU size)



Changing Current Values without rebooting

The current TCP/IP parameters can be edited without the need for reboot
in the following locations:

/proc/sys/net/core/
rmem_default = Default Receive Window
rmem_max = Maximum Receive Window
wmem_default = Default Send Window
wmem_max = Maximum Send Window

/proc/sys/net/ipv4/
You'll find timestamps, window scalling, selective acknowledgements,
etc.

Keep in mind the values in /proc will be reset upon reboot. You still
need to add the code in /etc/rc.local or /etc/boot.local in order to
have the changes applied at boot time as described above.

Reply via email to