fixnetworkparams
#!/bin/bash
echo "=========================== /proc/sys/net/ipv4/tcp_mem"
cat /proc/sys/net/ipv4/tcp_mem
echo "=========================== /proc/sys/net/core/rmem_default"
cat /proc/sys/net/core/rmem_default
echo "=========================== /proc/sys/net/core/rmem_max"
cat /proc/sys/net/core/rmem_max
echo "=========================== /proc/sys/net/core/wmem_default"
cat /proc/sys/net/core/wmem_default
echo "=========================== /proc/sys/net/core/wmem_max"
cat /proc/sys/net/core/wmem_max
echo "=========================== /proc/sys/net/core/optmem_max"
cat /proc/sys/net/core/optmem_max
echo "Fixing network parameters (larger send/receive buffers)"
# Set the max OS send buffer size (wmem) and receive buffer size (rmem) to 12 MB for queues on all protocols
sudo bash -c "echo 'net.core.wmem_max=12582912' >> /etc/sysctl.conf"
sudo bash -c "echo 'net.core.rmem_max=12582912' >> /etc/sysctl.conf"
# set minimum size, initial size, and maximum size in bytes:
sudo bash -c "echo 'net.ipv4.tcp_rmem= 10240 87380 12582912' >> /etc/sysctl.conf"
sudo bash -c "echo 'net.ipv4.tcp_wmem= 10240 87380 12582912' >> /etc/sysctl.conf"
# Turn on window scaling which can be an option to enlarge the transfer window
# echo 'net.ipv4.tcp_window_scaling = 1' >> /etc/sysctl.conf
# Enable timestamps as defined in RFC1323:
# echo 'net.ipv4.tcp_timestamps = 1' >> /etc/sysctl.conf
# Enable select acknowledgments:
# echo 'net.ipv4.tcp_sack = 1' >> /etc/sysctl.conf
# By default, TCP saves various connection metrics in the route cache when the connection closes,
# so that connections established in the near future can use these to set initial conditions.
# Usually, this increases overall performance, but may sometimes cause performance degradation.
# If set, TCP will not cache metrics on closing connections.
# echo 'net.ipv4.tcp_no_metrics_save = 1' >> /etc/sysctl.conf
# Set maximum number of packets, queued on the INPUT side, when the interface receives packets
# faster than kernel can process them.
# echo 'net.core.netdev_max_backlog = 5000' >> /etc/sysctl.conf
# Now reload the changes:
sudo sysctl -p
# Use tcpdump to view changes for eth0:
# tcpdump -ni eth0