forked from FunctionClub/YankeeBBR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbbr.sh
More file actions
58 lines (53 loc) · 1.96 KB
/
bbr.sh
File metadata and controls
58 lines (53 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#Check Root
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }
bit=`uname -m`
dir=`pwd`
installbbr(){
rm /etc/apt/sources.list
wget -O /etc/apt/sources.list -N --no-check-certificate https://raw.githubusercontent.com/S8Cloud/BBR/master/sources.list
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
apt-get autoremove && apt-get autoclean
apt-get install build-essential libssl1.0.2 libssl1.1 make autoconf libtool automake libpcre3 libpcre3-dev libssl-dev zlib1g-dev linux-image-$(uname -r) linux-headers-$(uname -r) automake curl vim git sudo unzip apt-transport-https screen lsb-release ca-certificates python python-pip -y
pip install speedtest-cli cymysql
apt-get -t stretch-backports update && apt-get -t stretch-backports upgrade -y
update-grub
echo 3 > /proc/sys/net/ipv4/tcp_fastopen
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
echo -e "Please run ./bbr.sh start after restart"
read -p "Need restart, Restart Now? [Y/n]:" yn
[ -z "${yn}" ] && yn="y"
if [[ $yn == [Yy] ]]; then
echo -e "Rebooting..."
reboot
fi
}
startbbr(){
mkdir -p $dir/tsunami && cd $dir/tsunami
wget -O ./tcp_tsunami.c -N --no-check-certificate https://raw.githubusercontent.com/S8Cloud/BBR/master/tcp_tsunami.c
echo "obj-m:=tcp_tsunami.o" > Makefile
make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc-6
insmod tcp_tsunami.ko
cp -rf ./tcp_tsunami.ko /lib/modules/$(uname -r)/kernel/net/ipv4
depmod -a
modprobe tcp_tsunami
rm -rf /etc/sysctl.conf
wget -O /etc/sysctl.conf -N --no-check-certificate https://raw.githubusercontent.com/S8Cloud/BBR/master/sysctl.conf
sysctl -p
cd .. && rm -rf $dir/tsunami
lsmod | grep tsunami
echo "Install Success!"
}
action=$1
[ -z $1 ] && action=install
case "$action" in
install|start)
${action}bbr
;;
*)
echo "Wrong Input"
echo "Use: { install | start }"
;;
esac