All Articles

Ubuntu 16.04 LTS BBR 安装

0. 前言

最近找的一些Linux操作系统的VPS选择的时候一般都只支持到16.04的Ubuntu版本,内核一般都是4.4,不支持BBR。所以如何安装这玩意儿也是很麻烦的一件事情。这里做下笔记。

1. 更新内核

首先需要更新内核到 >= 4.9,到官网看了下,一列的内核版本,有点搞不清楚装哪个,于是就找了最新的4.13.11。

下载内核包并安装:

mkdir kernel && cd kernel
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.11/linux-headers-4.13.11-041311_4.13.11-041311.201711020532_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.11/linux-headers-4.13.11-041311-generic_4.13.11-041311.201711020532_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.11/linux-image-4.13.11-041311-generic_4.13.11-041311.201711020532_amd64.deb
sudo dpkg -i *.deb
reboot

重启后查看下:

uname -r
4.13.11-041311-generic

2. 启用BBR

先检查下BBR是否开启

$ lsmod | grep bbr

如果输出有tcp_bbr,那就是已经安装了,否则则需要做后续的操作手动安装。

编辑文件/etc/sysctl.conf

$ cat >> /etc/sysctl.conf << EOF

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

使用sysctl -p命令让刚才的改动生效:

$ sysctl -p

net.ipv6.conf.all.accept_ra = 2 net.core.default_qdisc = fq net.ipv4.tcp_congestion_control = bbr

再检查下:

$ lsmod | grep bbr

tcp_bbr 20480 0

安装成功。

后续可以使用命令modprobe -r tcp_bbr删除BBR。

可以使用命令查看tcp_bbr模块信息:

$ modinfo tcp_bbr

filename: /lib/modules/4.13.0-25-generic/kernel/net/ipv4/tcp_bbr.ko
description: TCP BBR (Bottleneck Bandwidth and RTT)
license: Dual BSD/GPL
author: Soheil Hassas Yeganeh [email protected]
author: Yuchung Cheng [email protected]
author: Neal Cardwell [email protected]
author: Van Jacobson [email protected]
srcversion: 9F5EC90C4B0C83923BB4B38
depends:
intree: Y
name: tcp_bbr
vermagic: 4.13.0-25-generic SMP mod_unload
signat: PKCS#7
signer:
sig_key:
sig_hashalgo: md4

EOF

Published 2017/11/3

Some tech & personal blog posts