使用 Linux Shell 脚本在 CentOS Linux 6 / 7 上安装 BBR(来自 Google 的 TCP 拥塞控制算法)

本文最后一次更新于:2019 年 5 月 9 日 22:11:31

BBR 介绍:

TCP BBR( Bottleneck Bandwidth and Round-trip propagation time )是由 Google 设计,于 2016 年发布的拥塞算法。以往大部分拥塞算法是基于丢包来作为降低传输速率的信号,而 BBR 则基于模型主动探测。相对于传统的 TCP 拥塞控制算法,BBR 在充分利用网络带宽的同时,还能够大幅减少不必要的丢包。更多算法细节请参见该篇文章《 BBR 拥塞控制算法解析(来自 Google 的 TCP 拥塞控制算法)》。

Google 在 YouTube 上应用该算法,将全球平均的 YouTube 网络吞吐量提高了 4 % ,在一些国家超过了 14 % 。根据实地测试,在部署了最新版内核并开启了 TCP BBR 的机器上,网速甚至可以提升好几个数量级。

之前写过一篇文章《 CentOS Linux 6 / 7 安装 BBR(来自 Google 的 TCP 拥塞控制算法)》,但为了方便批量安装于是写了一个自动化安装 BBR 的 Linux Shell 脚本,同时考虑到了一些细节问题(如在 CentOS Linux 6.x 上安装 BBR 前更新 nss ),在这里跟大家做一个分享。

安装:

目前 Linux Kernel 4.09 及其以上版本(包括 5.x )已经集成了 BBR ,并且对于 QUIC 可用,所以只需要升级 Kernel 即可。

安装过程还是非常简单的,支持 CentOS Linux 6.x 和 7.x 。如果您的服务器已经接入互联网,那么执行以下脚本并没有什么问题;如果您的服务器位于内网,请看 “ 讲解 ” 部分并根据实际需要进行相应地修改。

Ricky 个人是喜欢把一些临时文件放到 /tmp 目录下,所以进入 /tmp 目录,使用 wget 命令把安装脚本下载到这里,并执行脚本即可:

[root@host ~]# cd /tmp
[root@host ~]# yum -y install wget zip unzip
[root@host ~]# wget --no-check-certificate https://ccie.lol/wp-content/uploads/2018/09/install_bbr.zip
[root@host ~]# unzip install_bbr.zip -d . && sh install_bbr.sh && rm -f install_bbr.zip install_bbr.sh

讲解:

以下是该 Linux Shell 脚本的代码:

#!/bin/bash

# 0.check the system and bbr

# 检查 OS 的版本号
OS_VERSION="0"
if grep -Eqi "release 4\." /etc/redhat-release ; then
	#OS_VERSION="4"
	echo Sorry , BBR does not support CentOS Liunx 4.x
	exit
elif grep -Eqi "release 5\." /etc/redhat-release ; then
        #OS_VERSION="5"
	echo Sorry , BBR does not support CentOS Liunx 5.x
	exit
elif grep -Eqi "release 6\." /etc/redhat-release ; then
        OS_VERSION="6"
elif grep -Eqi "release 7\." /etc/redhat-release ; then
        OS_VERSION="7"
else
	echo Sorry , The current system is unknown .	
	exit
fi

# 检查是否已经安装了 BBR
if lsmod | grep -Eqi "bbr" ; then
        echo The server already installed BBR .
        exit
fi

# 1.check network ,检查是否可以访问互联网
CHANGE_FLAG="0"
CODE=`curl -I -m 30 -o /dev/null -s -w %{http_code} http://www.baidu.com`
if [ "$CODE" != "200" ] ; then
	# 如果不可以访问互联网,就去 192.168.1.1 上开启 IP 路由转发和 NAT ,然后把 192.168.1.1 当做这台服务器的网关
	echo "WARNING !接下来要做 NAT ,请不要同时在多台服务器上同时跑这个脚本!因为当某台服务器安装完 BBR 后会去清理掉 NAT ,其他服务器将无法通过 NAT 继续访问互联网。 "
	read -p "Presses Y to continue , presses E to exit ..." IS_CONTINUE
	if [ "$IS_CONTINUE" != "Y" -a "$IS_CONTINUE" != "y" ] ; then
                exit
        fi
        CHANGE_FLAG="1"

	# 选择内网网卡,好往这个网卡的配置文件里添加一行网关的配置( GATEWAY=192.168.1.1 ),然后重启网络服务让配置生效,这样服务器就可以通过 192.168.1.1 访问互联网了。
        echo network-scripts list :
        ls /etc/sysconfig/network-scripts/ | grep ifcfg-

        NETWORK_CONFIG_DIR="/etc/sysconfig/network-scripts/"
        NETWORK_CONFIG_NAME="NULL"
        while [ ! -f "$NETWORK_CONFIG_DIR$NETWORK_CONFIG_NAME" ] ; do
                read -p "Please input the private network config name (eg:ifcfg-eth1) : " NETWORK_CONFIG_NAME
        done

	cp -f $NETWORK_CONFIG_DIR$NETWORK_CONFIG_NAME /tmp/network_config.bak

	echo
	echo 'please input the root password:123456'
	# 此处 eth0 需要是能够访问外部网络的网卡接口
	ssh -t root@192.168.1.1 'iptables -t nat -F && iptables -P FORWARD ACCEPT && iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && echo "1" > /proc/sys/net/ipv4/ip_forward'

	sed -i "/GATEWAY=/d" $NETWORK_CONFIG_DIR$NETWORK_CONFIG_NAME
	echo "GATEWAY=192.168.1.1" >> $NETWORK_CONFIG_DIR$NETWORK_CONFIG_NAME
	service network restart
fi


CODE=`curl -I -m 30 -o /dev/null -s -w %{http_code} http://www.baidu.com`
if [ "$CODE" == "200" ] ; then

# 2.install BBR ,安装 BBR

	if [ "$OS_VERSION" = "6" ] ; then
		echo
		echo The Server running CentOS Linux 6.x
		echo
                
                # 如果不升级 nss 的话,在访问一些 https 站点时可能会报错
                yum install -y nss wget
		yum update -y nss wget

                # 注意:kernel-ml( ml 是 mainline 的缩写)目前已经升级至 5.x ,
                # 可能因为 CentOS 6 不支持 5.x 的 kernel ,所以 yum 源里 CentOS 6 的 kernel-ml 已经被移除不能安装了,
                # 目前仅能安装版本为 4.4.x 的 kernel-lt( lt 是 longterm 的缩写)。2019 年 5 月 9 日 22:11:31 。
		#rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
                #rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
		#yum --enablerepo=elrepo-kernel -y install kernel-ml kernel-ml-devel

                # 因为使用上述 yum 源无法安装 kernel-ml ,所以使用下列 rpm 包进行安装。2019 年 5 月 9 日 22:11:31 。
		if [ $(getconf WORD_BIT) = '32' ] && [ $(getconf LONG_BIT) = '64' ]; then
                        wget https://pan.ccie.lol:44944/file/Linux/CentOS/6/rpm/kernel-ml-4.18.20-1.el6.elrepo.x86_64.rpm -P /tmp/
                        wget https://pan.ccie.lol:44944/file/Linux/CentOS/6/rpm/kernel-ml-devel-4.18.20-1.el6.elrepo.x86_64.rpm -P /tmp/
                        rpm -ivh /tmp/kernel-ml-devel-4.18.20-1.el6.elrepo.x86_64.rpm
                        rpm -ivh /tmp/kernel-ml-4.18.20-1.el6.elrepo.x86_64.rpm
                        rm -f /tmp/kernel-ml-devel-4.18.20-1.el6.elrepo.x86_64.rpm /tmp/kernel-ml-4.18.20-1.el6.elrepo.x86_64.rpm
                else
                        wget https://pan.ccie.lol:44944/file/Linux/CentOS/6/rpm/kernel-ml-4.18.20-1.el6.elrepo.i686.rpm -P /tmp/
                        wget https://pan.ccie.lol:44944/file/Linux/CentOS/6/rpm/kernel-ml-devel-4.18.20-1.el6.elrepo.i686.rpm -P /tmp/
                        rpm -ivh /tmp/kernel-ml-devel-4.18.20-1.el6.elrepo.i686.rpm
                        rpm -ivh /tmp/kernel-ml-4.18.20-1.el6.elrepo.i686.rpm
                        rm -f /tmp/kernel-ml-devel-4.18.20-1.el6.elrepo.i686.rpm /tmp/kernel-ml-4.18.20-1.el6.elrepo.i686.rpm
                fi

		sed -i 's/^default=.*/default=0/g' /boot/grub/grub.conf
		sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf
		sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf

		echo "net.core.default_qdisc = fq" >> /etc/sysctl.conf
		echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.conf
		
	elif [ "$OS_VERSION" = "7" ] ; then
		echo
		echo The Server running CentOS Linux 7.x
		echo

		rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
		rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
		yum --enablerepo=elrepo-kernel install kernel-ml kernel-ml-devel -y
		
		egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
		grub2-set-default 0

		echo "net.core.default_qdisc = fq" >> /etc/sysctl.conf
		echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.conf
	fi
else
	# 网络还是不通
	echo Sorry ! Network connection failure , please check it !
fi

# 3.clear the network config ,清理相关网络配置,恢复原样
if [ "$CHANGE_FLAG" == "1" ] ; then
	echo
	echo 'please input the root password:123456'
	ssh -t root@192.168.1.1 'iptables -t nat -F && echo "0" > /proc/sys/net/ipv4/ip_forward'

	mv -f /tmp/network_config.bak $NETWORK_CONFIG_DIR$NETWORK_CONFIG_NAME
	service network restart

	# 这个 yum 源需要通过互联网才能访问到,如果内网机器平常不会连接互联网,那么最好改下这个文件名,防止这个 yum 源生效
        if [ -f "/etc/yum.repos.d/elrepo.repo" ] ; then
	    mv /etc/yum.repos.d/elrepo.repo /etc/yum.repos.d/elrepo.repo_bak
        fi
fi

# 4.hint ,安装完 BBR 并重新启动服务器后,可使用下列命令来查看 BBR 是否安装成功
echo
echo '==========================

Check the BBR command :

cat /etc/redhat-release
uname -r
lsmod | grep bbr
sysctl net.ipv4.tcp_available_congestion_control

=========================='

# 5.reboot the server ,重启服务器
echo
read -p "Presses Y to reboot system ..."  IS_REBOOT
if [ "$IS_REBOOT" == "Y" -o "$IS_REBOOT" == "y" ] ; then
	reboot
fi
附 CentOS Linux 6 的 kernel-ml 的 MD5 值:

0d8c0070e7d37f9ae29bf712de56e5de  kernel-ml-4.18.20-1.el6.elrepo.i686.rpm
54d1e49afac88c33d43e3a1347fcc4ef  kernel-ml-4.18.20-1.el6.elrepo.x86_64.rpm
214e0cb00d6fabd1656e92cb925745a9  kernel-ml-devel-4.18.20-1.el6.elrepo.i686.rpm
d12ae92659710f2b5b42188e121bb755  kernel-ml-devel-4.18.20-1.el6.elrepo.x86_64.rpm

( 1 )找一台服务器临时充当网关:

在安装 BBR 前该脚本会检查服务器是否可以访问互联网( 1.check network 部分),如果您的服务器已经接入互联网,那么直接跑上述脚本一般是没有什么问题的;但如果该服务器没有接入互联网,该脚本也提供了一个解决方法:

假设需要安装 BBR 的服务器是 192.168.1.2 ,该服务器没有接入互联网;但是有一台 CentOS Linux 服务器 192.168.1.1 是接入了互联网的。那么可以在 192.168.1.1 上开启 IP 路由转发和 NAT 功能(如何在 CentOS Linux 上开启 IP 路由转发和 NAT ?详情请点击这里),再把 192.168.1.1 设置为 192.168.1.2 的网关,这样 192.168.1.2 就可以接入互联网了。当 BBR 安装完毕后再关闭 192.168.1.1 上的 IP 路由转发和 NAT 功能,再恢复 192.168.1.2 的网卡配置即可。

需要自行修改的地方:

  1. 您临时充当网关的服务器不一定是 192.168.1.1 ,所以在使用上述功能前请根据实际情况全文替换掉这个 IP 地址;您可以使用以下命令来进行一个批量替换的操作:
    sed -i "s#192.168.1.1#x.x.x.x#g"  /tmp/install_bbr.sh
  2. 脚本中的 123456 是 192.168.1.1 的 root 密码,为了方便您可以将密码写到脚本中;但如果从安全的角度考虑,您可以不用写入。
  3. 如下所示,此处 eth0 需要是服务器 192.168.1.1 上能够访问外部网络的网卡接口,请根据实际情况进行相应地修改:
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

( 2 )关于 yum 源 elrepo.repo 是否需要改名的问题:

如果您的服务器已经接入互联网,加入这个 elrepo.repo 的 yum 源本身并没有什么问题;但如果您的服务器是通过 “ ( 1 )找一台服务器临时充当网关 ” 中描述的那样来安装 BBR 的,那么当服务器恢复到无法访问互联网的时候,这个 elrepo.repo 的 yum 源是无法使用的,所以需要进行如下所示的改名操作,防止这个 elrepo.repo 的 yum 源生效:

mv /etc/yum.repos.d/elrepo.repo /etc/yum.repos.d/elrepo.repo_bak

( 3 )关于检测互联网是否能访问的问题:

上述脚本会去访问 http://www.baidu.com 这个网址,如果能访问则判定互联网是可以访问的,您可以根据实际情况修改这个网址。

( 4 )请检查 DNS 域名解析是否能正常工作:

如果您的服务器已经接入互联网但是没法解析域名 www.elrepo.org ,那么 BBR 内核也是没法下载并更新的。此时服务器的表现为:外网 IP 地址可以 ping 通(如 ping 47.88.138.127 ),但是域名 ping 不通(如 ping ccie.lol )。

回滚内核:

( 1 )CentOS Linux 7 回滚内核:

先执行以下两条命令清理掉开启 BBR 的配置:

[root@host ~]# sed -i "/net.core.default_qdisc = fq/d" /etc/sysctl.conf
[root@host ~]# sed -i "/net.ipv4.tcp_congestion_control = bbr/d" /etc/sysctl.conf

接着使用如下命令查看当前 CentOS Linux 7 都安装了哪些内核:

[root@host ~]# egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
CentOS Linux (4.18.12-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux, with Linux 3.10.0-123.el7.x86_64
CentOS Linux, with Linux 0-rescue-ba3855e0f00f4ccdba0eabea711139b1
[root@host ~]#

如需选择版本号为 3.10.0-123 的内核,则执行以下命令并重启服务器即可:

[root@host ~]# grub2-set-default 1
[root@host ~]# reboot

即第一个内核的序号为 0 ,第二个内核的序号为 1 。

重启后使用 uname -r 命令即可查看当前运行的内核的版本号:

[root@host ~]# uname -r
3.10.0-123.el7.x86_64
[root@host ~]#

( 2 )CentOS Linux 6 回滚内核:

抱歉,关于 CentOS Linux 6 回滚内核的操作暂时还没有研究。

示例:

( 1 )CentOS Linux 7.0 安装示例(服务器位于内网,无法访问互联网,需要一台 CentOS Linux 充当网关):

[root@host ~]# cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core) 
[root@host ~]#
[root@host ~]# sh install_bbr.sh 
WARNING !接下来要做 NAT ,请不要同时在多台服务器上同时跑这个脚本!因为当某台服务器安装完 BBR 后会去清理掉 NAT ,其他服务器将无法通过 NAT 继续访问互联网。 
Presses Y to continue , presses E to exit ...y
network-scripts list :
ifcfg-eth0
ifcfg-eth1
ifcfg-lo
Please input the private network config name (eg:ifcfg-eth1) : ifcfg-eth1

please input the root password:123456
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
ECDSA key fingerprint is aa:bb:cc:dd:ee:ff:gg:hh:ii:jj:kk:ll:mm:af:e9:b1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.1' (ECDSA) to the list of known hosts.
root@192.168.1.1's password: 
Connection to 192.168.1.1 closed.
Restarting network (via systemctl):                        [  OK  ]

The Server running CentOS Linux 7.x

curl: (35) Cannot communicate securely with peer: no common encryption algorithm(s).
error: https://www.elrepo.org/RPM-GPG-KEY-elrepo.org: import read failed(2).
Retrieving http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Retrieving http://elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
warning: /var/tmp/rpm-tmp.mA4dco: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:elrepo-release-7.0-3.el7.elrepo  ################################# [100%]
Loaded plugins: fastestmirror
base                                                                                                                                                                              | 3.6 kB  00:00:00     
elrepo                                                                                                                                                                            | 2.9 kB  00:00:00     
elrepo-kernel                                                                                                                                                                     | 2.9 kB  00:00:00     
extras                                                                                                                                                                            | 3.4 kB  00:00:00     
tyrepo                                                                                                                                                                            | 2.9 kB  00:00:00     
updates                                                                                                                                                                           | 3.4 kB  00:00:00     
(1/7): base/7/x86_64/group_gz                                                                                                                                                     | 166 kB  00:00:00     
(2/7): tyrepo/7/x86_64/primary_db                                                                                                                                                 | 7.2 kB  00:00:00     
(3/7): extras/7/x86_64/primary_db                                                                                                                                                 | 187 kB  00:00:00     
(4/7): updates/7/x86_64/primary_db                                                                                                                                                | 6.0 MB  00:00:00     
(5/7): base/7/x86_64/primary_db                                                                                                                                                   | 5.9 MB  00:00:00     
(6/7): elrepo/primary_db                                                                                                                                                          | 489 kB  00:00:02     
(7/7): elrepo-kernel/primary_db                                                                                                                                                   | 1.8 MB  00:00:02     
Determining fastest mirrors
 * elrepo: hkg.mirror.rackspace.com
 * elrepo-kernel: hkg.mirror.rackspace.com
Resolving Dependencies
--> Running transaction check
---> Package kernel-ml.x86_64 0:4.18.11-1.el7.elrepo will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================================================
 Package                                      Arch                                      Version                                                   Repository                                        Size
=========================================================================================================================================================================================================
Installing:
 kernel-ml                                    x86_64                                    4.18.11-1.el7.elrepo                                      elrepo-kernel                                     45 M

Transaction Summary
=========================================================================================================================================================================================================
Install  1 Package

Total download size: 45 M
Installed size: 203 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/elrepo-kernel/packages/kernel-ml-4.18.11-1.el7.elrepo.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY===========-    ]  11 MB/s |  43 MB  00:00:00 ETA 
Public key for kernel-ml-4.18.11-1.el7.elrepo.x86_64.rpm is not installed
kernel-ml-4.18.11-1.el7.elrepo.x86_64.rpm                                                                                                                                         |  45 MB  00:00:02     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
Importing GPG key 0xBAADAE52:
 Userid     : "elrepo.org (RPM Signing Key for elrepo.org) <secure@elrepo.org>"
 Fingerprint: 96c0 104f 6315 4731 1e0b b1ae 309b c305 baad ae52
 Package    : elrepo-release-7.0-3.el7.elrepo.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : kernel-ml-4.18.11-1.el7.elrepo.x86_64                                                                                                                                                 1/1 
  Verifying  : kernel-ml-4.18.11-1.el7.elrepo.x86_64                                                                                                                                                 1/1 

Installed:
  kernel-ml.x86_64 0:4.18.11-1.el7.elrepo                                                                                                                                                                

Complete!
CentOS Linux (4.18.11-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux, with Linux 3.10.0-123.el7.x86_64
CentOS Linux, with Linux 0-rescue-ba3855e0f00f4ccdba0eabea711139b1

please input the root password:123456
root@192.168.1.1's password: 
Connection to 192.168.1.1 closed.
Restarting network (via systemctl):                        [  OK  ]

==========================

Check the BBR command :

cat /etc/redhat-release
uname -r
lsmod | grep bbr
sysctl net.ipv4.tcp_available_congestion_control

==========================

Presses Y to reboot system ...y
Connection to 192.168.1.2 closed by remote host.
Connection to 192.168.1.2 closed. 
[xxxx@other ~]$ 
[xxxx@other ~]$ ssh root@192.168.1.2
root@192.168.1.2's password: 
Last login: Sun Sep 30 10:26:22 2018 from 192.168.1.3
[root@host ~]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core) 
[root@host ~]# uname -r
4.18.11-1.el7.elrepo.x86_64
[root@host ~]# lsmod | grep bbr
tcp_bbr                20480  19 
[root@host ~]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr
[root@host ~]# 
[root@host ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 
DEVICE="eth1"
NM_CONTROLLED="yes"
ONBOOT="yes"
NETMASK="255.255.255.0"
BOOTPROTO="static"
IPADDR="192.168.1.2"
[root@host ~]#

如上所示,执行完该脚本后重启服务器,再次登录上来发现 BBR 已经安装成功了,同时 ifcfg-eth1 这个网卡配置文件也恢复到了最初的状态(最初就没有设置 GATEWAY )。

( 2 )CentOS Linux 6.10 安装示例(服务器可直接访问互联网):

[root@host ~]# cat /etc/redhat-release 
CentOS release 6.10 (Final)
[root@host ~]# 
[root@host ~]# uname -r
2.6.32-754.12.1.el6.x86_64
[root@host ~]# 
[root@host ~]# sh install_bbr.sh 

The Server running CentOS Linux 6.x

Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * elrepo: mirror-hk.koddos.net
base                                                                                                                                                                       | 3.7 kB     00:00     
elrepo                                                                                                                                                                     | 2.9 kB     00:00     
extras                                                                                                                                                                     | 3.4 kB     00:00     
updates                                                                                                                                                                    | 3.4 kB     00:00     
Package nss-3.36.0-9.el6_10.x86_64 already installed and latest version
Package wget-1.12-10.el6.x86_64 already installed and latest version
Nothing to do
Loaded plugins: fastestmirror, security
Setting up Update Process
Loading mirror speeds from cached hostfile
 * elrepo: mirror-hk.koddos.net
No Packages marked for Update
--2019-05-09 17:11:02--  https://pan.ccie.lol:44944/file/Linux/CentOS/6/rpm/kernel-ml-4.18.20-1.el6.elrepo.x86_64.rpm
Resolving pan.ccie.lol... 104.194.71.185
Connecting to pan.ccie.lol|104.194.71.185|:44944... connected.
HTTP request sent, awaiting response... 200 OK
Length: 47064928 (45M) [application/x-redhat-package-manager]
Saving to: “/tmp/kernel-ml-4.18.20-1.el6.elrepo.x86_64.rpm”

100%[========================================================================================================================================================>] 47,064,928  4.52M/s   in 13s     

2019-05-09 17:11:16 (3.55 MB/s) - “/tmp/kernel-ml-4.18.20-1.el6.elrepo.x86_64.rpm” saved [47064928/47064928]

--2019-05-09 17:11:16--  https://pan.ccie.lol:44944/file/Linux/CentOS/6/rpm/kernel-ml-devel-4.18.20-1.el6.elrepo.x86_64.rpm
Resolving pan.ccie.lol... 104.194.71.185
Connecting to pan.ccie.lol|104.194.71.185|:44944... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12964336 (12M) [application/x-redhat-package-manager]
Saving to: “/tmp/kernel-ml-devel-4.18.20-1.el6.elrepo.x86_64.rpm”

100%[========================================================================================================================================================>] 12,964,336  3.33M/s   in 5.2s    

2019-05-09 17:11:22 (2.38 MB/s) - “/tmp/kernel-ml-devel-4.18.20-1.el6.elrepo.x86_64.rpm” saved [12964336/12964336]

Preparing...                ########################################### [100%]
   1:kernel-ml-devel        ########################################### [100%]
Preparing...                ########################################### [100%]
   1:kernel-ml              ########################################### [100%]

==========================

Check the BBR command :

cat /etc/redhat-release
uname -r
lsmod | grep bbr
sysctl net.ipv4.tcp_available_congestion_control

==========================

Presses Y to reboot system ...Y

Broadcast message from root@host
        (/dev/pts/0) at 17:13 ...

The system is going down for reboot NOW!
[root@host ~]# Connection to 192.168.1.2 closed by remote host.
Connection to 192.168.1.2 closed.
[xxxx@other ~]$ 
[xxxx@other ~]$ ssh 192.168.1.2
xxxx@192.168.1.2's password: 
Last login: Thu May  9 09:49:43 2019 from 192.168.1.3
[xxxx@host ~]$ sudo su -
[sudo] password for xxxx: 
[root@host ~]# cat /etc/redhat-release
CentOS release 6.10 (Final)
[root@host ~]# uname -r
4.18.20-1.el6.elrepo.x86_64
[root@host ~]# lsmod | grep bbr
tcp_bbr                20480  3326 
[root@host ~]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr
[root@host ~]#

如果您的服务器可直接访问互联网,那么直接执行该脚本即可,无需任何操作,直接安装完成。

文章附件

这篇文章对你有帮助吗?

相关文章

2条评论

Ricky 发表评论 取消回复

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据