Optimise Basic Linux Networking
So, you've sucessfully installed RHEL/Centos/Ubuntu. Well done. You want to make sure you're getting the most out of it, right? For starters, do this:
1. Open a terminal and type: vi /etc/sysctl.conf
2. Set these values:
# Use TCP syncookies when needed net.ipv4.tcp_syncookies = 1 # Enable TCP window scaling net.ipv4.tcp_window_scaling = 1 # Increase TCP max buffer size net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 # Increase Linux autotuning TCP buffer limits net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 # Increase number of ports available net.ipv4.ip_local_port_range = 1024 65535
#reduce the number of time_wait connections #these lines can reduce your time_wait count
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_max_syn_backlog = 4096
3. Exit vi (':x') and type: sysctl -p to apply the new settings. The above should improve network response times and, in our experience, is certainly worth doing.