哈喽啊 👋

这是一个没什么用的博客

编译BBR v3内核

安装编译依赖, 我使用的是Debian 12, 不同系统可能存在差异 apt -y install build-essential libncurses-dev libssl-dev libelf-dev bison bc flex rsync debhelper dwarves git 克隆希望编译的linux kernel版本与google bbr-v3仓库 git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git 6.12.y -b linux-6.12.y git clone https://github.com/google/bbr.git bbr -b v3 提取bbr v3补丁 cd bbr && git log 找到bbr v3仓库使用的内核版本对应的commit hash(发文章时为6.13.7) 提取补丁 git format-patch --stdout hash..HEAD > ../bbr3.patch 在目标编译内核目录应用补丁 创建新分支 cd ../6.12.y && git branch patched && git checkout patched 应用补丁, warning信息无视即可 git am ../bbr3.patch 复制当前内核配置文件并应用 cp /boot/config-$(uname -r) .config && make olddefconfig 启用BBR v3 make menuconfig 找到 Networking support ---> -> Networking options ---> -> TCP: advanced congestion control ---> 启用BBR, 如需保留BBR v1则追加启用BBR1, [*]代表编译进内核, [m]为编译为模块 编译为deb包 make deb-pkg KCFLAGS="-march=x86-64-v2 -pipe" -j$(nproc) 使用 dpkg -i 安装内核, 卸载其他所有内核或修改grub配置指定以新内核启动, 配置完成后重启 由于系统五花八门, 请自行搜索相关教程 验证是否成功启用BBR v3 modinfo tcp_bbr 启用BBR 临时启用 sysctl net.ipv4.tcp_congestion_control=bbr 设为bbr即启用BBR v3, 设为bbr1即启用BBR v1 持久启用 echo 'net.ipv4.tcp_congestion_control = bbr' > /etc/sysctl.conf 请检查 /etc/sysctl.d 文件夹, 如有配置冲突请自行解决