• 学派吧-由新云网络独家赞助-https://www.sq9.cn。

如何在Linode CentOS7开启Google TCP-BBR优化算法 | linux运维

unix admin 6年前 (2018-11-21) 1941次浏览 已收录 0个评论 扫描二维码

Linux在4.9版本的内核新增了一款TCP拥塞控制技术:BBR,Linode最新内核也更新到4.9,但是没有把BBR编译进去,下面是教程是替换Linode CentOS7内核,并开启Google TCP-BBR优化算法方法。

注意:Linode、阿里云测试OK,Ucloud测试加载4.9变为只读系统。

1. 安装elrepo提供的kernel4.9

增加elrepo源


<ol class="dp-xml" start="1">
<li class="alt">cat <span class="tag">></span> /etc/yum.repos.d/elrepo.repo <span class="tag"><</span><span class="tag"><</span> <span class="tag-name">EOF</span></li>
<li class="">[elrepo-kernel]</li>
<li class="">name=ELRepo.org Community Enterprise Linux Kernel Repository - el7</li>
<li class="alt"><span class="attribute">baseurl</span>=<span class="attribute-value">http</span>://elrepo.org/linux/kernel/el7/\$basearch/</li>
<li class="">        http://mirrors.coreix.net/elrepo/kernel/el7/\$basearch/</li>
<li class="alt">        http://jur-linux.org/download/elrepo/kernel/el7/\$basearch/</li>
<li class="">        http://repos.lax-noc.com/elrepo/kernel/el7/\$basearch/</li>
<li class="alt">        http://mirror.ventraip.net.au/elrepo/kernel/el7/\$basearch/</li>
<li class=""><span class="attribute">enabled</span>=<span class="attribute-value">1</span></li>
<li class="alt"><span class="attribute">gpgcheck</span>=<span class="attribute-value">0</span></li>
<li class="">EOF</li>
</ol>

可能存在yum更新内核时候找不到升级包,请检查/etc/yum.conf是否过滤了kernel

找到改文件将exclude=kernel* centos-release*注销,再尝试安装

安装elrepo替换4.9内核及grub2

  1. yum -y install kernel-ml grub2

查看4.9内核是否安装成功

  1. [root@linode1495332 ~]# ls -l /boot/vmlinuz*
  2. -rwxr-xr-x 1 root root 6037696 Dec 22 10:16 /boot/vmlinuz-0-rescue-72863e389b584a4dab36fae7f3bffda2
  3. -rwxr-xr-x 1 root root 6037696 Dec 12 05:37 /boot/vmlinuz-4.9.0-1.el7.elrepo.x86_64

2. 替换CentOS7内核

Linode内核切换方法:

  1. [root@linode1495332 etc]# mkdir /boot/grub
  2. [root@linode1495332 etc]# grub2-mkconfig -o /boot/grub/grub.cfg
  3. Generating grub configuration file …
  4. Found linux image: /boot/vmlinuz-4.9.0-1.el7.elrepo.x86_64
  5. Found initrd image: /boot/initramfs-4.9.0-1.el7.elrepo.x86_64.img
  6. Found linux image: /boot/vmlinuz-0-rescue-72863e389b584a4dab36fae7f3bffda2
  7. Found initrd image: /boot/initramfs-0-rescue-72863e389b584a4dab36fae7f3bffda2.img
  8. done

点击Linode后台面板Dashboard,点击Edit按钮:

在Kernel下拉菜单,选择GRUB 2启动:

非Linode切换内核方法:

  1. [root@oneinstack ~]#  awk -F\’ ‘$1==”menuentry ” {print $2}’ /etc/grub2.cfg
  2. CentOS Linux (4.9.0-1.el7.elrepo.x86_64) 7 (Core)
  3. CentOS Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)
  4. CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
  5. CentOS Linux (0-rescue-7d26c16f128042a684ea474c9e2c240f) 7 (Core)

grub2-set-default 0,切换到新内核

  1. [root@oneinstack ~]# grub2-set-default 0

重启服务器:

  1. reboot

查看内核版本

  1. [root@linode1495332 ~]# uname -a
  2. Linux linode1495332.members.linode.com 4.9.0-1.el7.elrepo.x86_64 #1 SMP Sun Dec 11 15:43:54 EST 2016 x86_64 x86_64 x86_64 GNU/Linux

3. 开启TCP-BBR

  1. cat >>/etc/sysctl.conf << EOF
  2. net.core.default_qdisc=fq
  3. net.ipv4.tcp_congestion_control=bbr
  4. EOF

内核参数生效:

  1. sysctl -p

查看bbr是否生效:

  1. [root@linode1495332 ~]# sysctl net.ipv4.tcp_available_congestion_control
  2. net.ipv4.tcp_available_congestion_control = bbr cubic reno
  3. [root@linode1495332 ~]# lsmod | grep bbr
  4. tcp_bbr                16384  70

Thu Dec 22 11:17:53 CST 2016


学派吧 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:如何在Linode CentOS7开启Google TCP-BBR优化算法 | linux运维
喜欢 (0)
[pay@sq9.cn]
分享 (0)
关于作者:
腾讯云-运维运维 QQ 690624
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址