Skip to content

Commit

Permalink
# v1.0.12 无需新更换内核安装BBR并重启后,再运行 bash bbr.sh start 了
Browse files Browse the repository at this point in the history
  • Loading branch information
Toyo authored Jul 21, 2017
1 parent f30c2bc commit f0b266e
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions bbr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export PATH
#=================================================
# System Required: Debian/Ubuntu
# Description: TCP-BBR
# Version: 1.0.11
# Version: 1.0.12
# Author: Toyo
# Blog: https://doub.io/wlzy-16/
#=================================================
Expand Down Expand Up @@ -101,13 +101,14 @@ del_deb(){
del_deb_over(){
del_deb
update-grub
echo -e "\033[42;37m[注意]\033[0m 重启VPS后,请重新运行脚本开启BBR \033[42;37m bash bbr.sh start \033[0m"
addsysctl
echo -e "\033[42;37m[注意]\033[0m 重启VPS后,请重新运行脚本查看BBR是否加载成功 \033[42;37m bash bbr.sh status \033[0m"
stty erase '^H' && read -p "需要重启VPS后,才能开启BBR,是否现在重启 ? [Y/n] :" yn
[ -z "${yn}" ] && yn="y"
if [[ $yn == [Yy] ]]; then
if [[ $yn == [Yy] ]]; then
echo -e "\033[41;37m[信息]\033[0m VPS 重启中..."
reboot
fi
fi
}
# 安装BBR
installbbr(){
Expand Down Expand Up @@ -178,19 +179,13 @@ bbrstatus(){
exit 1
fi
}
# 开启BBR
startbbr(){
check_deb_off
bbrstatus
addsysctl(){
sed -i '/net\.core\.default_qdisc=fq/d' /etc/sysctl.conf
sed -i '/net\.ipv4\.tcp_congestion_control=bbr/d' /etc/sysctl.conf

echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
sleep 1s
bbrstatus
echo -e "${Error} BBR 启动失败,请检查 !"
}
# 关闭BBR
stopbbr(){
Expand All @@ -202,10 +197,10 @@ stopbbr(){

stty erase '^H' && read -p "需要重启VPS后,才能彻底停止BBR,是否现在重启 ? [Y/n] :" yn
[ -z "${yn}" ] && yn="y"
if [[ $yn == [Yy] ]]; then
if [[ $yn == [Yy] ]]; then
echo -e "\033[41;37m[信息]\033[0m VPS 重启中..."
reboot
fi
fi
}
# 查看BBR状态
statusbbr(){
Expand All @@ -217,11 +212,11 @@ statusbbr(){
action=$1
[ -z $1 ] && action=install
case "$action" in
install|start|stop|status)
install|stop|status)
${action}bbr
;;
*)
echo "输入错误 !"
echo "用法: { install | start | stop | status }"
echo "用法: { install | stop | status }"
;;
esac

0 comments on commit f0b266e

Please sign in to comment.