Kernel
Kernel record
sysctl
/etc/sysctl.conf /etc/sysctl.d/*.conf /proc/sys/...
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# # Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments,in pages
kernel.shmall = 4294967296
# system open files
fs.file-max = 655350
#fs.nr_open = 655350
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
net.ipv4.ip_nonlocal_bind = 1
net.ipv4.ip_forward = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
# TCP kernel paramater
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1 # SACK 方法 = 默认为1,开启
net.ipv4.tcp_dsack = 1 # D-SACK 方法 = 默认为1,开启
# socket buffer
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_abort_on_overflow = 0 # 全连接队列满时内核行为 = 0为丢弃,1为reset
net.core.somaxconn = 65535 # 全连接队列 = min(backlog, somaxconn)
net.core.optmem_max = 81920
# TCP conn
net.ipv4.tcp_max_syn_backlog = 262144 # 半连接队列 = (backlog, tcp_max_syn_backlog, somaxconn)
net.ipv4.tcp_timestamps = 0 # 启用 RFC1323 中定义的时间戳,0为禁用,1为启用且随机偏移时间戳,2为启用但不使用随机偏移
net.ipv4.tcp_tw_reuse = 0 # 允许内核重用处理 TIME_WAIT 状态的 TCP 连接
net.ipv4.tcp_tw_recycle = 0 # 4.12以上版本内核已移除
net.ipv4.tcp_fin_timeout = 1 # FIN_WAIT_2 TIME_WAIT 孤立连接状态超时时间
net.ipv4.tcp_max_tw_buckets = 180000 # TIME_WAIT 状态最大数量
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_syn_retries = 1 # SYN_SENT 状态 SYN 包重试次数
net.ipv4.tcp_synack_retries = 1 # SYN_RECV 状态 SYN+ACK 包重传次数
net.ipv4.tcp_syncookies = 1 # 不使用半连接队列建立连接 = 0为不开启,1为仅半连接队列满时启用,2为直接启用
# keepalive conn
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.ip_local_port_range = 10001 65000
# 拥塞算法
net.ipv4.tcp_allowed_congestion_control = reno cubic bbr
net.ipv4.tcp_available_congestion_control = reno cubic bbr
net.ipv4.tcp_congestion_control = bbr
# swap
vm.overcommit_memory = 0
vm.swappiness = 10 # default 60, 0 is donot swap memory
#net.ipv4.conf.eth1.rp_filter = 0
#net.ipv4.conf.lo.arp_ignore = 1
#net.ipv4.conf.lo.arp_announce = 2
#net.ipv4.conf.all.arp_ignore = 1
#net.ipv4.conf.all.arp_announce = 2
# effect config
sysctl -p /etc/sysctl.d/xxx.confOthers
ulimit:fd dont enough
TIME_WAIT: too mush connection state
nf_conntrack: table full, dropping packet
https://testerhome.com/topics/15824
ARP table
Last updated