linux系统网络优化

2年前 (2016-10-17) admin linux 0评论 已收录 373℃
#!/bin/sh

# socket queue
echo "net.ipv4.tcp_max_syn_backlog=262144">>/etc/sysctl.conf
echo "net.ipv4.tcp_syncookies=0">>/etc/sysctl.conf
echo "net.ipv4.tcp_fin_timeout=3">>/etc/sysctl.conf

#TIME_WAIT setting
echo "net.ipv4.tcp_keepalive_time=300">>/etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse=1">>/etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle=1">>/etc/sysctl.conf
echo "net.ipv4.tcp_no_metrics_save=1">>/etc/sysctl.conf
echo "net.core.somaxconn=262144">>/etc/sysctl.conf
echo "net.ipv4.tcp_max_orphans=262144">>/etc/sysctl.conf
echo "net.ipv4.tcp_synack_retries=2">>/etc/sysctl.conf
echo "net.ipv4.tcp_syn_retries=2">>/etc/sysctl.conf
echo "net.core.wmem_max=16777216">>/etc/sysctl.conf
echo "net.core.rmem_max=16777216">>/etc/sysctl.conf
echo "net.ipv4.tcp_wmem=4096 65536 16777216">>/etc/sysctl.conf
echo "net.ipv4.tcp_rmem=4096 87380 16777216">>/etc/sysctl.conf
echo "net.core.netdev_max_backlog=30000">>/etc/sysctl.conf
echo "net.ipv4.ip_local_port_range=5000 65536">>/etc/sysctl.conf

#redirects
# echo "net.ipv4.conf.all.send_redirects=0">>/etc/sysctl.conf
# echo "net.ipv4.conf.all.accept_redirects=0">>/etc/sysctl.conf

#Source routing
#Drop all source route packets.
# echo "net.ipv4.conf.all.accept_source_route=0">>/etc/sysctl.conf

#Do not forward source routed frames.
# echo "net.ipv4.conf.all.forwarding=0">>/etc/sysctl.conf
# echo "net.ipv4.conf.all.mc_forwarding=0">>/etc/sysctl.conf

#Broadcast ECHO response
# echo "net.ipv4.icmp_echo_ignore_broadcasts=1">>/etc/sysctl.conf
# echo "kernel.shmmax=67108864">>/etc/sysctl.conf
# echo "kernel.shmall=33554432">>/etc/sysctl.conf
# echo "kernel.shmmni=8388608">>/etc/sysctl.conf
博主

让学习成为习惯,坚持-共享-开源-自由! 成功者决不放弃,放弃者绝不成功!

相关推荐

嗨、骚年、快来消灭0回复。