MENU

CentOS7 开启 bbr 加速

September 9, 2019 • linux相关

前提

查看当前系统内核版本号,如果是 4.9 及以上版本均已自带 bbr,所以需要先更新内核版本。

[root@demo ~]# uname -r
5.2.10-1.el7.elrepo.x86_64

修改系统配置

编辑文件 vim /etc/sysctl.conf ,在文件末尾添加如下内容:

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

加载系统参数

确认刚才添加的两条配置项存在

[root@demo ~]# sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
kernel.sysrq = 1
fs.file-max = 65535
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

确认 bbr 已成功开启

[root@demo ~]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr
[root@demo ~]# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr
[root@demo ~]# lsmod | grep bbr
tcp_bbr                20480  1

如上所示,则表示bbr已经成功开启。

Last Modified: November 19, 2021