首页 > 代码库 > linux 内核优化

linux 内核优化

1、修改ulimit
vi /etc/security/limits.conf
增加
* soft nofile 65535
* hard nofile 65535
* - nofile 65535
 
修改 linux 内核文件 sysctl  -P 报错
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key 
解决方法如下:
modprobe bridge
lsmod|grep bridge
 
2、修改内核参数
vi /etc/sysctl.conf
增加
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
sysctl -p 生效
 
3、修改hostname
vi /etc/hosts

linux 内核优化