Skip to content
This repository was archived by the owner on Aug 22, 2021. It is now read-only.

Ubuntu 18.04 升级内核至 5.3 并开启新版 BBR

phlinhng edited this page Aug 23, 2020 · 17 revisions

ubuntu 18.04.4 版本开始默认采用 5.3 版内核,若你的 VPS 提供的 Ubuntu 18.04 模版还在使用 4.15 版内核,可以用 apt-get 升级到新版内核后再开启新版 BBR 加速。

更换 5.3 版内核

  1. 检查目前所用的内核版本。若己经是 5.x 版本,则不需要更换。
uname -r
  1. 安装新版内核(以下两者择一)
  • 官方 5.3
apt-get install --install-recommends linux-generic-hwe-18.04
  • 第三方內核 xanmod (目前最新为 5.7.9-xanmod1
apt-get install gnupg2 -y
echo 'deb http://deb.xanmod.org releases main' | tee /etc/apt/sources.list.d/xanmod-kernel.list && wget -qO - https://dl.xanmod.org/gpg.key | apt-key add -
apt update && apt install linux-xanmod -y
  1. 重启 VPS
reboot
  1. 移除旧版内核
apt-get update && apt-get upgrade -y && apt-get autoremove -y --purge

开启原版 BBR

xanmod 内核安装完即自动开启 bbr,此步骤可跳过。

modprobe tcp_bbr
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p

检查 BBR 是否生效

sysctl net.core.default_qdisc
sysctl net.ipv4.tcp_congestion_control
sysctl net.ipv4.tcp_available_congestion_control