Choose Language: English 中文 日本語
TL;DR: BBR enables big throughput improvements on high-speed, long-haul links: BBR's throughput can be 2700x higher than today's best loss-based congestion control, CUBIC (CUBIC gets about 3.3 Mbps, while BBR gets over 9,100 Mbps); BBR also enables significant reductions in latency in last-mile networks that connect users to the internet: BBR can keep queuing delay 25x lower than CUBIC (BBR v1 official blog in 2017). BBR v3, which has not yet been merged into the kernel, is an improved version of BBR v1.
Important notes:
- You have to login your system as a privileged user (i.e.,
sudo-able) in order to run the following command. dpkgshould be available on your system in order to install packages provided by this repo.dpkgcomes with Debian/Ubuntu systems.- If your system uses a bootloader other than GRUB, you have to manually update your bootloader to boot to the new kernel after the script finished.
- If able, please backup your data before proceeding. Although the script is designed to be robust and to not corrupt your system and data if anything went wrong, the developers of this repo hold no liability toward the users of this repo.
To install the latest Linux kernel with Google BBR v3 integrated and enabled, simply run the following command:
wget "https://raw.githubusercontent.com/XDflight/bbr3-debs/refs/heads/build/install_latest.sh" && sudo bash install_latest.sh
Mainland China users may run the following command instead for faster download:
wget "https://ghfast.top/https://raw.githubusercontent.com/XDflight/bbr3-debs/refs/heads/build/install_latest.sh" && sudo CDN_URL="https://ghfast.top/" bash install_latest.sh
You are good to go if every step completed without error. No post-installation configuration (except the mandatory reboot) is required.
To verify that everything is working properly after the reboot, just run the same command again.
You can expect to see sysctl settings are correct. in the script's output.
The script will automatically help you repair your kernel and/or sysctl settings if any of the checks fails.
The command can also be used to update the kernel. It will check for kernel update every time it runs, and will update the kernel if a newer version is available. The script will also help you remove old, unused kernels from your system, so you don't have to worry about old kernels taking up too much space overtime.
Currently supported CPU architectures:
amd64/x86-64i386/i686/ia32/x86/x86-32arm64/aarch64armhf/armv7/arm/arm32/aarch32(hard-float)riscv64
Using the script in non-interactive flows:
To prevent the script from prompting the user for reboot, one can supply -y(--yes) or -n(--no) as the first argument to the script to select whether or not the script should automatically reboot the system after installation, update, or repair.
You can find the research papers about BBR here (2016) and here (2017).
For simple explanation, this article (2017) written by the development team of Google BBR is a good introduction.
Basically, BBR aims to improve network performance by considering both bandwidth and round-trip time (RTT) to optimize data transmission.
BBR v1 was already merged into the Linux kernel in 4.9.
BBR v3 is an improved version of BBR v1, with the primary goal of addressing issues related to unfairness and high retransmission rates.
However, BBR v3 has not yet been merged into the kernel.
The current Linux kernel used in google/bbr is 6.13.7.
This repo intends to rebase all the commits made by the BBR development team onto the kernel source tree, so that people can use BBR v3 in newer Linux kernels (especially the latest stable & LTS versions).
For convenience, GitHub workflows have been setup to compile those "modded" kernels into .deb packages and release them on GitHub, so that Debian/Ubuntu users can install the kernels easily.
- Four TCP congestion control algorithms are available:
bbr(Google BBR3),dctcp,cubic, andreno.bbris the default and is built-in,dctcpandcubicwere compiled as modules, andrenois built-in because it is the "original" one that comes with the Linux kernel. In general,bbris recommended for general purposes (especially high bandwidth and variable/high latency environments), whiledctcpis recommended for low latency environments such as data centers;cubicandrenoare included mainly for debugging and testing purposes (more information about them can be found online). Becausebbris the default algorithm, there is no need to setnet.ipv4.tcp_congestion_control = bbrinsysctl.d. - Two TCP active queue management algorithms are available:
fifoandfq_codel. If you are not familiar with them, using the default one (fq_codel) will work in almost all scenarios.fifo, as its name suggests, is a very simple AQM algorithm that comes with the kernel originally, whilefq_codelis configured as the default because it performs well with BBR, does not require careful parameter tuning, and is very robust in all network environments. - Other configurations are basically inherited from the "currently latest" (likely not the case when you read this
README) official Debian kernel6.1.0-35-amd64(which is based on Linux kernel6.1.137), with minors changes to adapt the configurations to newer kernels. The only two things worth highlighting are:- Kernel debug information is omitted because it is too big to upload to and download from GitHub and generally not useful if one does not do kernel development. Don't worry, many distros also omit kernel debug info in their standard install and offer them as a standalone package.
- Transparent Hugepage Support (THP) is disabled in the kernels by default since it is recommended by many database systems (and I think may people will install these kernels on servers). Anyway, you can always change the setting yourself at
/sys/kernel/mm/transparent_hugepage/.
On the GitHub Releases page, you can find all the compiled kernels packaged into .deb files.
Simply choose a version you'd like to use.
Every release will come with a brief explanation of the kernel version to help you decide which version you'd like to use.
Generally, look for any of the following versions:
- For best compatibility & less headache: Choose the latest kernel that has the same (or close to the) major version (first two numbers) as your current kernel. You can check the version of your kernel using
uname -a. - For best stability & security: Choose the latest LTS kernel.
- For most features & best support for new hardware: Choose the latest kernel.
In any case, please choose a kernel version that's higher/newer than your current kernel version, because many bootloaders (such as GRUB) will boot to the newest kernel by default.
As for the architecture (amd64, arm64, ...), just choose the one used by your system.
Please download all three packages in the release, namely the following:
linux-headers-*: The header files of the kernel. Useful for building external kernel modules.linux-image-*: The kernel binary - the most important one.linux-libc-dev-*: The standard C librarylibcand other user-space stuff critical for things to work.
- Run
sudo dpkg -i linux-*.debin your Linux terminal. Make sure you are in the directory where the downloaded files are located. - Run
sudo update-grubto update your GRUB bootloader. Note that this step may differ if you are using other bootloaders, like on Raspberry Pi or using uBoot. Check the instructions online for how to properly update your bootloader to boot to the new kernel. - You may want to check if the current
/etc/sysctl.confand/etc/sysctl.d/*.confconfig files contain anynet.ipv4.tcp_congestion_controlornet.core.default_qdiscwhich can accidentally overwrite the default values set by the kernel. You can remove those quickly using the following commands:sudo sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.confsudo sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.d/*.confsudo sed -i '/net.core.default_qdisc/d' /etc/sysctl.confsudo sed -i '/net.core.default_qdisc/d' /etc/sysctl.d/*.conf
- You may want to enable TCP Fast Open (TFO) to further reduce RTT. TFO is proposed by a team from Google and described in RFC 7413. To do so, follow these steps:
- Run
sysctl net.ipv4.tcp_fastopen. If the current value is3, no need to change. - Otherwise, add
net.ipv4.tcp_fastopen = 3to one of thesysctl.dfiles. Instructions to do so can be found online.
- Run
- You may want to enable TCP ECN to further reduce packet loss. ECN allows routers to signal impending network congestion to endpoints without dropping packets. To do so, follow these steps:
- Run
sysctl net.ipv4.tcp_ecn. If the current value is1, no need to change. - Otherwise, add
net.ipv4.tcp_ecn = 1to one of thesysctl.dfiles. Instructions to do so can be found online.
- Run
- Reboot the system. To verify that the new kernel is working properly, please do the following checks:
- Running
uname -rshould give you the new kernel version and the-bbr3version suffix. - Running
sysctl net.ipv4.tcp_congestion_controlshould give youbbr. - Running
sysctl net.core.default_qdiscshould give youfq_codel. - Running
sysctl net.ipv4.tcp_fastopenshould give you3(if configured). - Running
sysctl net.ipv4.tcp_ecnshould give you1(if configured).
- Running
- Yay! Your system is now fully configured with BBR v3.
- You may update the kernel using the same instructions above.
Compiled kernels will be released on a weekly basis, or whenever there is a new kernel version available.
Specifically, a GitHub workflow will be automatically triggered every Monday at 07:21 UTC to pull the source code of the latest stable kernel and compile it with BBR v3 integrated.
It will then upload the compiled .deb packages to the GitHub Releases page as a set of draft releases.
The draft releases will be published manually after their tags are assigned and their release notes are written.
If any abnormalities occur during the compilation, especially if the patch files fail to apply cleanly due to upstream conflicts, the workflow will fail and the patch files will later be reviewed and fixed.
This may take some time, so please be patient.
Updates from the BBR development team, particularly from the google/bbr repo, the BBR Development Google Group, and the RFC draft at ietf-wg-ccwg/draft-ietf-ccwg-bbr, will also be monitored closely, and changes will be made to the patch files to keep up with the latest developments on BBR.
If you have encountered any issues or are interested in contributing to this project, please feel free to open an issue or a pull request. Any suggestions or improvements are welcome. By the way, make sure to report any performance-related problems not only here but also to the BBR development team, so that they can investigate and fix the issues in the upstream code. Thanks!