服务器开启TCP BBR拥塞控制算法

听说TCP BBR在带宽上效果不错,所以决定在主服务器上启用试试。
tcp_bbr要在4.9.x内核及以上才有用,所以可能需要升级一下内核。

1.查看当前内核版本

uname -a

Linux a.sof618.com 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

2.版本不对,到kernel ubuntu找到最新版的4.9.x内核,然后下载、安装。

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.6/linux-headers-4.9.6-040906_4.9.6-040906.201701260330_all.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.6/linux-headers-4.9.6-040906-generic_4.9.6-040906.201701260330_amd64.deb

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.6/linux-image-4.9.6-040906-generic_4.9.6-040906.201701260330_amd64.deb

dpkg -i linux-*

3.安装完成后重启,新的内核生效。

uname -a

Linux a.sof618.com 4.9.6-040906-generic #201701260330 SMP Thu Jan 26 08:32:10 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

4.之后可以考虑删除其余内核

dpkg -l|grep linux-image

5.编辑sysctl.conf文件启用bbr,文件末尾添加以下两行

net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr

6.重启或者立即生效配置。

sysctl -p

7.查看bbr是否已经启用。

sysctl net.ipv4.tcp_available_congestion_control
lsmod | grep bbr

转自《mjollnir