AWS lightsail Ubuntu系统 替换内核启用BBR加速
AWS lightsail Ubuntu系统 替换内核启用BBR加速
Sandy前几天搞了一个AWS lightsail账号, 发现里面竟然没有CentOS, 只有Ubuntu, 但因为平常用的都是CentOS, 对这个ubuntu完全不熟悉, 所以只能硬着头皮用.
系统是安装好了, 但是AWS的内核比较低, 是4.4.0的, 看网上的介绍需要在4.9以后才能开启BBR
查看内核
uname -r`</pre>
显示的是
<pre class="pure-highlightjs">`4.4.0-1013-aws`</pre>
<span style="font-size: 24pt; color: #ff0000;">折腾开始啰:</span>
创建目录,保持目录干净:
<pre class="pure-highlightjs">`mkdir /root/bbr
cd /root/bbr`</pre>
下载最新的内核
<pre class="pure-highlightjs">`wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15.7/linux-headers-4.15.7-041507_4.15.7-041507.201802280530_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15.7/linux-headers-4.15.7-041507-generic_4.15.7-041507.201802280530_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15.7/linux-image-4.15.7-041507-generic_4.15.7-041507.201802280530_amd64.deb`</pre>
ubuntu最新的内核地址
[http://kernel.ubuntu.com/~kernel-ppa/mainline/](http://kernel.ubuntu.com/~kernel-ppa/mainline/)
安装内核
<pre class="pure-highlightjs">`dpkg -i *.deb
`</pre>
查看已经安装的内核
<pre class="pure-highlightjs">`dpkg -l | grep linux-image
`</pre>
返回结果
<pre class="pure-highlightjs">`ii linux-image-4.15.7-041507-generic 4.15.7-041507.201802280530
amd64 Linux kernel image for version 4.15.7 on 64 bit x86 SMP
ii linux-image-4.4.0-1013-aws 4.4.0-1013.22
amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii
linux-image-aws 4.4.0.1013.16
amd64 Linux kernel image for Amazon Web Services (AWS) systems.`</pre>
删除老的4.4.0内核
<pre class="pure-highlightjs">`apt remove linux-image-4.4.0-1013-aws`</pre>
更新启动引导
<pre class="pure-highlightjs">`update-grub`</pre>
重启
<pre class="pure-highlightjs">`reboot`</pre>
重启后查看内核
<pre class="pure-highlightjs">`uname -r`</pre>
<pre class="pure-highlightjs">`root@ip-172-26-0-93:~# uname -r
4.15.7-041507-generic
root@ip-172-26-0-93:~#`</pre>
看到已经是最新的内核了
开始安装BBR
请完整复制下面代码
<pre class="pure-highlightjs">`cat >>/etc/sysctl.conf << EOF
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
EOF`</pre>
然后使其生效
<pre class="pure-highlightjs">`sysctl -p`</pre>
查看BBR是否安装成功
<pre class="pure-highlightjs">`sysctl net.core.default_qdisc
`</pre>
如果返回下面的信息
<pre class="pure-highlightjs">`net.core.default_qdisc = fq`</pre>
再输入
<pre class="pure-highlightjs">`sysctl net.ipv4.tcp_congestion_control`</pre>
返回
<pre class="pure-highlightjs">`net.ipv4.tcp_congestion_control = bbr
就说明安装成功了.


