Freitag, 20. März 2009

Network tweaking with sysctl.conf

Here are few network settings that you might find interesting. I would sugest to read more about these settings here
Network tuning tutorial

The values below should be tested of course

MTU value
run YAST2
select "Network Devices" then below "Already configured devices:" press "change..." Next "Edit" followed by "Advanced.." button and select "Detailed settings"
Now enterthe value that is the best for your type of network connection (i.e. cable/dsl 1500)

run this to alter the number of transmit buffers
#/sbin/ifconfig eth0 txqueuelen 1000

useful commands:
#sysctl -a
above lists current settings in kernel
#sysctl -p
lists current settings from /etc/sysctl.conf and brings them up

obviously some are security related (*)
/etc/sysctl.conf example:
Quote:
# Turn off the tcp_window_scaling if you have networking
# with systems behind broken routers, otherwise keep it on (default)
net.ipv4.tcp_window_scaling = 1
# Turn off the tcp_sack
net.ipv4.tcp_sack = 0
# tcp_fack should be off because of sack
net.ipv4.tcp_fack = 0
# Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0
# Set TCP Re-Ordering value in kernel to 5
net.ipv4.tcp_reordering = 5
#Decrease SYN ACK retry attempts to 2
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 3
# Decrease the time default value for tcp_fin_timeout connection (*)
net.ipv4.tcp_fin_timeout = 25
# Increase the tcp-time-wait buckets pool size (*)
net.ipv4.tcp_max_tw_buckets = 360000
# Enable TCP SYN Cookie Protection (*)
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_forward = 0 (*)
# Set Max SYN Backlog (*)
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.core.netdev_max_backlog = 1024
# This will increase the amount of memory available for socket input/output queues.
#These numbers can be adjusted depending of the machine
net.core.optmem_max = 40960
net.ipv4.core.rmem_max = 8388608
net.ipv4.core.rmem_default = 65535
net.ipv4.core.wmem_max = 8388608
net.ipv4.core.wmem_default = 65535
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 87380 8388608
net.ipv4.tcp_mem = 8388608 8388608 8388608

## Controls source route verification (*)
net.ipv4.conf.default.rp_filter = 1

# Enable bad error message Protection (*)
net.ipv4.icmp_ignore_bogus_error_responses = 1

# Disable ICMP broadcasts request (*)
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Disables IP source routing (*)
net.ipv4.conf.all.default_source_route = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
#Enable log of spoofed packets
net.ipv4.conf.all.log_martians = 1
# Decrease time between keepalives (*)
net.ipv4.tcp_keepalive_time = 1200
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
Remember to restart network for changes.
happy networking