Linux: Changing Some TCP Parameters

Before changing these you should understand what they are doing.
See for example /usr/share/doc/kernel-doc-2.4.2/networking/ip-sysctl.txt. or this
online tutorial.


% cat /proc/sys/net/ipv4/ip_local_port_range
32768   61000
[For some reason many systems are now configured to prevent
one from using a large number of ports].

[To change this to try to use from port 1025 to 65535]
# echo "1025 65535" > /proc/sys/net/ipv4/ip_local_port_range

% cat /proc/sys/net/ipv4/tcp_tw_recycle
0

[To change this to on]
# echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle

% cat /proc/sys/net/ipv4/tcp_max_tw_buckets
180000

% cat /proc/sys/net/ipv4/tcp_fin_timeout
60

[To change this to 3 seconds]
# echo "3" > /proc/sys/net/ipv4/tcp_fin_timeout

[To have these new values take effect you may have to do (as root)]
# /etc/rc.d/init.d/network restart

If you want these new values to survive across reboots you can at them to /etc/sysctl.conf.

# Allowed local port range
net.ipv4.ip_local_port_range = 1025 65535
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 3



Created: Wed Jan 22 17:08:54 EST 2003
Last modified: Wed Jan 22 17:08:56 EST 2003