在 Debian 和 CentOS 上启用 BBR 加速网络

在 Linux 系统上,通过启用 BBR(Bottleneck Bandwidth and Round-trip propagation time)可以显著提升网络性能。BBR 是由 Google 开发的一种拥塞控制算法,它通过更智能地管理网络流量,提高了带宽利用率和减少了网络延迟。本文将介绍在 Debian 和 CentOS 系统上启用 BBR 的步骤。

在 Debian 上启用 BBR

  1. 打开终端并以 root 用户身份登录。
  2. 执行以下命令更新系统软件包:
apt update && apt upgrade -y
  1. 安装必要的工具:
apt install -y wget
  1. 下载 BBR 安装脚本:
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh
  1. 给脚本添加执行权限:
chmod +x bbr.sh
  1. 运行脚本安装 BBR:
./bbr.sh
  1. 安装完成后,重启系统:
reboot

在 CentOS 上启用 BBR

  1. 打开终端并以 root 用户身份登录。
  2. 执行以下命令安装 elrepo 源:
yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
  1. 安装新内核和 BBR 模块:
yum --enablerepo=elrepo-kernel install kernel-ml -y
yum --enablerepo=elrepo-kernel install kmod-tcp_bbr -y
  1. 更新 GRUB 配置:
grub2-mkconfig -o /boot/grub2/grub.cfg
  1. 设置默认启动项为新内核:
grub2-set-default 0
  1. 重启系统:
reboot

BBR 已成功启用,你的系统网络性能应该有所提升。

请记得在执行这些步骤前备份重要数据,并在生产环境中谨慎操作。

THE END