Ubuntu 16.04 升级内核 安装 BBR

 bbr, ubuntu  Ubuntu 16.04 升级内核 安装 BBR已关闭评论
3月 272019
 

 BBR 只能配合 Linux Kernel 4.10 以上内核才能使用, 所以需要升级内核


查看内核版本,如达到要求略

# uname -r

4.4.0-1075-aws  //默认4.4.0,因此需要升级

//切换到root用户

$ sudo -s  

# wget –no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh

# chmod +x bbr.sh 

# ./bbr.sh

———- System Information ———-

 OS      : Ubuntu 16.04.5 LTS

 Arch    : x86_64 (64 Bit)

 Kernel  : 4.4.0-1075-aws

—————————————-

 Auto install latest kernel for TCP BBR

 URL: https://teddysun.com/489.html

—————————————-

Press any key to start…or Press Ctrl+C to cancel

按任意键后会显示

Info: Getting latest kernel version…

———— kernel setting ————

1) 4.14

……

…..

234) 4.20.16

235) 4.20.17

236) 5.0

237) 5.0.1

238) 5.0.2

239) 5.0.3

240) 5.0.4

which kernel you’d select (default 5.0.4):  // 按回车键选择最新版本 

your selection: 5.0.4

–2019-03-27 02:55:58–  https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.0.4/linux-modules-5.0.4-050004-generic_5.0.4-050004.201903231634_amd64.deb

Resolving kernel.ubuntu.com (kernel.ubuntu.com)… 91.189.94.216

Connecting to kernel.ubuntu.com (kernel.ubuntu.com)|91.189.94.216|:443… connected.

HTTP request sent, awaiting response… 200 OK

Length: 46593520 (44M) [application/x-debian-package]

Saving to: ‘linux-modules-5.0.4-amd64.deb’

     0K ………. ………. ………. ………. ……….  0%  160K 4m44s

    50K ………. ………. ………. ………. ……….  0%  321K 3m33s

   100K ………. ………. ………. ………. ……….  0% 24.3M 2m22s

   150K ………. ……..

……..

done

Info: The system needs to reboot.

Do you want to restart system? [y/n]y  //按“y“重启

./bbr.sh: line 271:  8748 Terminated              reboot



#######重启后##########

$ uname -r

5.0.4-050004-generic

$ sudo -s


#分别输入下面命令检查

# sysctl net.ipv4.tcp_available_congestion_control

net.ipv4.tcp_available_congestion_control = reno cubic bbr


# sysctl net.ipv4.tcp_congestion_control

net.ipv4.tcp_congestion_control = bbr


# sysctl net.core.default_qdisc

net.core.default_qdisc = fq


# lsmod | grep bbr

tcp_bbr                20480  6


看到bbr即完成


centos 7 升级内核 安装 BBR

 bbr  centos 7 升级内核 安装 BBR已关闭评论
3月 272019
 

BBR介绍

Google BBR (Bottleneck Bandwidth and RTT) 是一种新的TCP拥塞控制算法,它可以高效增加吞吐和降低网络延迟,并且Linux Kernel4.9+已经集成该算法。开启BBR也非常简单,因为它只需要在发送端开启,网络其他节点和接收端不需要任何改变。

升级内核

1. 打开Terminal

输入

# uname -r 

查看内核版本,如果输出类似

3.10.0-514.21.2.el7.x86_64

则表示小于4.9,需要升级内核,
而如果内核大于等于4.9则跳过至开启Google BBR

2. 升级内核

  • 安装 ELRepo 仓库

    # rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org # rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm 
  • 安装最新版kernel

    # yum --enablerepo=elrepo-kernel install kernel-ml -y 
  • 确认是否安装成功

    # rpm -qa | grep kernel 

    如果输出类似如下,包含kernel-ml-4.13.10-1.el7.elrepo.x86_64,则表示安装成功

    kernel-3.10.0-693.el7.x86_64
    kernel-tools-3.10.0-693.el7.x86_64
    kernel-ml-4.13.10-1.el7.elrepo.x86_64
    kernel-tools-libs-3.10.0-693.el7.x86_64

  • 设置开机默认启动项

    # egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \' 

    输出结果类似如下

    CentOS Linux 7 Rescue f212d2d7754a4a6bb2b98950c20cc0b5 (4.13.10-1.el7.elrepo.x86_64)
    CentOS Linux (4.13.10-1.el7.elrepo.x86_64) 7 (Core)
    CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)
    CentOS Linux (0-rescue-d1f142097d497f24c021d7de9b81cab4) 7 (Core)

    该列表从0开始索引,所以4.13内核索引为1

  • 设置启动项

    # grub2-set-default 1 
  • 重启

    # reboot 

    查看内核版本

    # uname -r 

    如果输出类似

    4.13.10-1.el7.elrepo.x86_64

    则表示升级完成

开启Google BBR

  • 修改sysctl配置

    # echo 'net.core.default_qdisc=fq' | tee -a /etc/sysctl.conf # echo 'net.ipv4.tcp_congestion_control=bbr' |  tee -a /etc/sysctl.conf # sysctl -p 
  • 检查是否加载BBR

    # lsmod | grep bbr 

    如果输出结果包含tcp_bbr,则表示开启成功

    tcp_bbr 20480 0

转自:https://www.jianshu.com/p/52815c34215e