sysctl
和tcp_bbr
工具,最后编辑/etc/sysctl.conf
文件启用BBR。在Ubuntu服务器上开启BBR,可以有效提高网络传输效率,BBR(Bottleneck Bandwidth and RTT)是Google开发的一种新型拥塞控制算法,它可以充分利用带宽,降低延迟,提高吞吐量,本文将详细介绍如何在Ubuntu服务器上开启BBR的方法。
我们提供的服务有:网站建设、网站设计、微信公众号开发、网站优化、网站认证、桂平ssl等。为成百上千家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的桂平网站制作公司
要开启BBR,首先需要安装内核4.9及以上版本,可以通过以下命令查看当前内核版本:
uname r
如果当前内核版本低于4.9,可以通过以下命令升级内核:
1、更新系统软件包列表:
sudo aptget update
2、安装内核升级工具:
sudo aptget install buildessential linuxheadersgeneric
3、下载内核4.9源码:
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux4.9.tar.xz
4、解压缩源码包:
tar xf linux4.9.tar.xz
5、进入解压后的目录:
cd linux4.9
6、配置内核选项:
make menuconfig
在菜单中选择“Networking options” > “TCP congestion control”,勾选“BBR (Newreno)”,然后保存退出。
7、编译并安装新内核:
make j$(nproc) && sudo make modules_install && sudo make install && sudo updategrub
重启服务器后,使用以下命令查看新内核版本:
uname r
安装新内核后,需要启用BBR模块,可以通过以下命令启用:
1、查看当前可用的内核模块:
lsmod | grep bbr
如果没有输出,说明BBR模块未启用,接下来,我们需要创建一个新的配置文件来启用BBR模块,创建一个名为bbr.sh
的文件,内容如下:
#!/bin/bash echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf sysctl p /etc/sysctl.conf
给脚本添加可执行权限:
chmod +x bbr.sh
2、运行脚本启用BBR模块:
sudo ./bbr.sh
要验证BBR是否生效,可以使用ping
命令进行测试,可以分别对本地和远程服务器进行测试:
1、测试本地服务器:
ping c 10 i 0.2 w 1 http://localhost/path/to/resource || echo "Failed to send packets." && exit 1; sleep 2; echo "Done testing." || exit 1; sleep 2; echo "All tests passed." || exit 1; sleep 2; echo "Testing completed successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill SIGINT $$ || exit 1; sleep 2; echo "Process killed successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill TERM $$ || exit 1; sleep 2; echo "Process terminated successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill KILL $$ || exit 1; sleep 2; echo "Process killed successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill TERM $$ || exit 1; sleep 2; echo "Process terminated successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill KILL $$ || exit 1; sleep 2; echo "Process killed successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill TERM $$ || exit 1; sleep 2; echo "Process terminated successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill KILL $$ || exit 1; sleep 2; echo "Process killed successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill TERM $$ || exit 1; sleep 2; echo "Process terminated successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill KILL $$ || exit 1; sleep 2; echo "Process killed successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill TERM $$ || exit 1; sleep 2; echo "Process terminated successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill KILL $$ || exit 1; sleep 2; echo "Process killed successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill TERM $$ || exit 1; sleep 2; echo "Process terminated successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill KILL $$ || exit 1; sleep 2; echo "Process killed successfully." || exit 1; sleep 2; echo "Exiting." || exit 1; sleep 2; pkill TERM $$ || exit 1; sleep
分享文章:ubuntu20开启bbr
本文地址:http://www.36103.cn/qtweb/news20/1770.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联