在租用国外vps的时候,由于地理位置距离中国较远,访问和下载速度受限,安装bbr加速功能就是比较好的方法之一。有人会问bbr是什么?bbr是google提出的一种新型拥塞控制算法,可使得linux系统服务器显著地提高吞吐量和减少tcp连接的延迟,能够显著国外vps访问和下载速度。什么叫拥塞?就是数据包丢包,传统拥塞控制算法,当出现拥塞时,会使发送数据窗口大幅减少,导致数据传送效率急剧降低,国内云网络一般丢包率很低,开不开bbr,理论上影响不大,bbr对国际线路提升比较明显,国际线路丢包特别严重,因此需要安装bbr开启加速功能。
虽然现在很多美国主机商也都支持一键安装bbr加速功能,但总体来看还是占少数。常用的加速策略包括googlebbrtcp加速,以及在其基础上发展而来的bbr魔改版、暴力bbr、bbrplus,以及锐速加速等。本文老刘博客就给大家分享一个vps加速脚本,可以一键安装并开启这些加速策略,这里会以一台ucloud的华盛顿通用型云主机来演示。
安装环境:
1、系统支持:centos 6 、debian 7 ,ubuntu 12 。
2、虚拟构架: kvm、xen、vmware ,openvz 不支持。
3、bbr和锐速不能同时安装,一个是升级内核,一个是降级内核。
4、系统内核最低要求是4.9。
脚本命令:
wget -n --no-check-certificate \https://raw.githubusercontent.com/chiakge/linux-netspeed/master/tcp.sh\chmod x tcp.sh./tcp.sh这是脚本的面板,最下面一行是vps当前的加速内核和加速策略,所以如果我们需要开启某种加速,需要先安装对应的内核,再开启对应的管理,最后看看加速是否开启成功。
这里以bbr加速为例,先输入1安装bbr/bbr魔改版内核,之后再次使用脚本输入4即可开启bbr加速,以下是完整步骤:
[root@10-27-186-90 ~]# wget -n --no-check-certificate \https://raw.githubusercontent.com/chiakge/linux-netspeed/master/tcp.sh\--2021-02-07 23:46:55-- https://raw.githubusercontent.com/chiakge/linux-netspeed/master/tcp.shresolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.192.133, 151.101.0.133, 151.101.64.133, ...connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.192.133|:443... connected.http request sent, awaiting response... 200 oklength: 24274 (24k) [text/plain]last-modified header missing -- time-stamps turned off.--2021-02-07 23:46:55-- https://raw.githubusercontent.com/chiakge/linux-netspeed/master/tcp.shreusing existing connection to raw.githubusercontent.com:443.http request sent, awaiting response... 200 oklength: 24274 (24k) [text/plain]saving to: ‘tcp.sh’100%[=====================================================================================================================================================>] 24,274 --.-k/s in 0s 2021-02-07 23:46:55 (51.1 mb/s) - ‘tcp.sh’ saved [24274/24274][root@10-27-186-90 ~]# chmod x tcp.sh[root@10-27-186-90 ~]# ./tcp.sh tcp加速 一键安装管理脚本 [v1.3.2] -- 就是爱生活 | 94ish.me -- 0. 升级脚本————————————内核管理———————————— 1. 安装 bbr/bbr魔改版内核 2. 安装 bbrplus版内核 3. 安装 lotserver(锐速)内核————————————加速管理———————————— 4. 使用bbr加速 5. 使用bbr魔改版加速 6. 使用暴力bbr魔改版加速(不支持部分系统) 7. 使用bbrplus版加速 8. 使用lotserver(锐速)加速————————————杂项管理———————————— 9. 卸载全部加速 10. 系统配置优化 11. 退出脚本———————————————————————————————— 当前状态: 已安装 lotserver(锐速) 内核 , 未安装 bbr 加速内核 请输入数字 [0-11]:1loaded plugins: fastestmirrorkernel-ml-4.11.8.rpm | 41 mb 00:00:05 examining /var/tmp/yum-root-9rqtjz/kernel-ml-4.11.8.rpm: kernel-ml-4.11.8-1.el7.elrepo.x86_64/var/tmp/yum-root-9rqtjz/kernel-ml-4.11.8.rpm: does not update installed package.error: nothing to doloaded plugins: fastestmirrorresolving dependencies--> running transaction check---> package kernel-ml-headers.x86_64 0:4.11.8-1.el7.elrepo will be erased--> finished dependency resolutiondependencies resolved=============================================================================================================================================================================================== package arch version repository size===============================================================================================================================================================================================removing: kernel-ml-headers x86_64 4.11.8-1.el7.elrepo installed 4.0 mtransaction summary===============================================================================================================================================================================================remove 1 packageinstalled size: 4.0 mdownloading packages:running transaction checkrunning transaction testtransaction test succeededrunning transactionwarning: rpmdb altered outside of yum. erasing : kernel-ml-headers-4.11.8-1.el7.elrepo.x86_64 1/1 verifying : kernel-ml-headers-4.11.8-1.el7.elrepo.x86_64 1/1 removed: kernel-ml-headers.x86_64 0:4.11.8-1.el7.elrepo complete!loaded plugins: fastestmirrorkernel-ml-headers-4.11.8.rpm | 1.1 mb 00:00:00 examining /var/tmp/yum-root-9rqtjz/kernel-ml-headers-4.11.8.rpm: kernel-ml-headers-4.11.8-1.el7.elrepo.x86_64marking /var/tmp/yum-root-9rqtjz/kernel-ml-headers-4.11.8.rpm to be installedresolving dependencies--> running transaction check---> package kernel-ml-headers.x86_64 0:4.11.8-1.el7.elrepo will be installed--> finished dependency resolutiondependencies resolved=============================================================================================================================================================================================== package arch version repository size===============================================================================================================================================================================================installing: kernel-ml-headers x86_64 4.11.8-1.el7.elrepo /kernel-ml-headers-4.11.8 4.0 mtransaction summary===============================================================================================================================================================================================install 1 packagetotal size: 4.0 minstalled size: 4.0 mdownloading packages:running transaction checkrunning transaction testtransaction test succeededrunning transaction installing : kernel-ml-headers-4.11.8-1.el7.elrepo.x86_64 1/1 verifying : kernel-ml-headers-4.11.8-1.el7.elrepo.x86_64 1/1 installed: kernel-ml-headers.x86_64 0:4.11.8-1.el7.elrepo complete!loaded plugins: fastestmirrorkernel-ml-devel-4.11.8.rpm | 11 mb 00:00:00 examining /var/tmp/yum-root-9rqtjz/kernel-ml-devel-4.11.8.rpm: kernel-ml-devel-4.11.8-1.el7.elrepo.x86_64/var/tmp/yum-root-9rqtjz/kernel-ml-devel-4.11.8.rpm: does not update installed package.error: nothing to do检测到 0 个其余内核,开始卸载...--nodeps -e 内核卸载完毕,继续...[注意] 重启vps后,请重新运行脚本开启bbr/bbr魔改版需要重启vps后,才能开启bbr/bbr魔改版,是否现在重启 ? [y/n] :y[信息] vps 重启中...connection closing...socket close.connection closed by foreign host.disconnected from remote host(152.32.182.36) at 12:48:38.type `help\' to learn how to use xshell prompt.[c:\\~]$ #再次登录一次vpsconnecting to 152.32.182.36:22...connection established.to escape to local shell, press \'ctrl alt ]\'.warning! the remote ssh server rejected x11 forwarding request.last failed login: sun feb 7 23:49:09 est 2021 from 107.150.120.125 on ssh:nottythere was 1 failed login attempt since the last successful login.last login: sun feb 7 23:36:23 2021 from 107.150.120.125[root@10-27-186-90 ~]# ./tcp.sh tcp加速 一键安装管理脚本 [v1.3.2] -- 就是爱生活 | 94ish.me -- 0. 升级脚本————————————内核管理———————————— 1. 安装 bbr/bbr魔改版内核 2. 安装 bbrplus版内核 3. 安装 lotserver(锐速)内核————————————加速管理———————————— 4. 使用bbr加速 5. 使用bbr魔改版加速 6. 使用暴力bbr魔改版加速(不支持部分系统) 7. 使用bbrplus版加速 8. 使用lotserver(锐速)加速————————————杂项管理———————————— 9. 卸载全部加速 10. 系统配置优化 11. 退出脚本———————————————————————————————— 当前状态: 已安装 bbr 加速内核 , 未安装加速模块 请输入数字 [0-11]:4[信息]:清除加速完成。kernel.msgmnb = 65536kernel.msgmax = 65536net.ipv6.conf.all.disable_ipv6 = 1kernel.unknown_nmi_panic = 0kernel.sysrq = 1vm.swappiness = 10fs.inotify.max_user_watches = 10000000net.ipv4.conf.all.send_redirects = 0net.ipv4.conf.default.send_redirects = 0net.ipv4.conf.all.secure_redirects = 0net.ipv4.conf.default.secure_redirects = 0net.ipv4.conf.all.accept_redirects = 0net.ipv4.conf.default.accept_redirects = 0fs.inotify.max_queued_events = 327679kernel.shmmax = 68719476736kernel.shmall = 4294967296net.ipv4.neigh.default.gc_thresh1 = 2048net.ipv4.neigh.default.gc_thresh2 = 4096net.ipv4.neigh.default.gc_thresh3 = 8192net.core.default_qdisc = fqnet.ipv4.tcp_congestion_control = bbr[信息]bbr启动成功![root@10-27-186-90 ~]# ./tcp.sh tcp加速 一键安装管理脚本 [v1.3.2] -- 就是爱生活 | 94ish.me -- 0. 升级脚本————————————内核管理———————————— 1. 安装 bbr/bbr魔改版内核 2. 安装 bbrplus版内核 3. 安装 lotserver(锐速)内核————————————加速管理———————————— 4. 使用bbr加速 5. 使用bbr魔改版加速 6. 使用暴力bbr魔改版加速(不支持部分系统) 7. 使用bbrplus版加速 8. 使用lotserver(锐速)加速————————————杂项管理———————————— 9. 卸载全部加速 10. 系统配置优化 11. 退出脚本———————————————————————————————— 当前状态: 已安装 bbr 加速内核 , bbr启动成功 请输入数字 [0-11]:9[信息]:清除加速完成。[root@10-27-186-90 ~]# 这个脚本也支持卸载加速策略,如果你想用其他加速方法,只需要输入./tcp.sh重新使用脚本,输入9卸载全部加速之后重新安装内核、开启其他加速即可。
这里注意,如果你的系统是centos 8,不要安装以上脚本了,因为centos 8 默认内核版本为 4.18.x,内核版本高于 4.9 就可以直接开启 bbr:
#开启bbrecho \net.core.default_qdisc=fq\ >> /etc/sysctl.confecho \net.ipv4.tcp_congestion_control=bbr\ >> /etc/sysctl.conf#保存退出后,执行下边的命令使配置生效sysctl -p#检查 bbr 是否开启成功sysctl -n net.ipv4.tcp_congestion_controllsmod | grep bbr选择多了,有些人可能就有选择困难症,是bbr加速好还是锐速好?是原版bbr加速好还是bbr魔改版好?这个问题的答案确实因人而异,vps不同的使用用途可能适合不同的加速策略,一般我都是直接用原版bbr,ucloud华盛顿vps自带使用了锐速加速。
最后,如果大家嫌以上安装过程复杂的话,可以考虑选择vultr云服务器vps:《vultr新用户注册获赠$50或$100账户余额方法附vultr便宜vps方案整理》,支持一键安装bbr加速功能,非常方便,而且现在购买新用户还赠送100美元。
电脑屏幕录制软件有哪些 优秀的电脑屏幕录制软件推荐云服务器哪个镜像在提交资料进行备案中怎么取消备案.site域名多少钱建站建议选择云服务器网站登陆不了 或提示危险微软S2D2016滚动升级2019用户名这个为什么打不开-虚拟主机/数据库问题