内核升级
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install -y https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install kernel-ml -y
内核手动下载
https://elrepo.org/linux/kernel/el7/x86_64/RPMS/
内核选择
cat /boot/grub2/grub.cfg |grep menuentry # 查看所有内核
# 默认使用新内核
sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=0/g' /etc/default/grub
# 查看可使用的内核列表
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
# 查看当前默认内核启动项
grub2-editenv list
# 更改默认启动内核项
grub2-set-default 0
# 内核重配置
grub2-mkconfig -o /boot/grub2/grub.cfg
# 重启
reboot
系统维护
uname -r #查看当前内核
grub2-editenv list #查看内核修改结果
yum remove kernel -y #使用yum remove 或rpm -e 删除无用内核
rpm -qa |grep kernel #查看系统安装了哪些内核包
内核header维护
yum remove -y kernel-tools-libs
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available #列出可用
yum --enablerepo=elrepo-kernel install -y kernel-ml-headers kernel-ml-tools kernel-ml-devel #安装对应headers
yum --enablerepo=elrepo-kernel install -y perf python-perf
开启 bbr
vi /etc/sysctl.conf
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
编译并开启 bbr plus TODO
yum install -y make gcc
mkdir -p /opt/bbrplus && cd /opt/bbrplus
wget -N --no-check-certificate http://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/bbr/tcp_tsunami.c
echo "obj-m:=tcp_tsunami.o" > Makefile
make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc
chmod +x ./tcp_tsunami.ko
cp -rf ./tcp_tsunami.ko /lib/modules/$(uname -r)/kernel/net/ipv4
insmod tcp_tsunami.ko
depmod -a
开启 tcp fastopen
vi /etc/sysctl.conf
net.ipv4.tcp_fastopen = 3
其他参数
net.ipv4.ip_forward = 1
net.ipv4.ip_no_pmtu_disc = 1
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
kernel.sysrq = 1
sysctl -p