初版BBR:
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/plain/net/ipv4/tcp_bbr.c
魔改BBR:
https://gist.github.com/anonymous/ba338038e799eafbba173215153a7f3a/raw/55ff1e45c97b46f12261e07ca07633a9922ad55d/tcp_tsunami.c
编译时系统必须安装4.10以上版本的kernel及对应的linux-header,gcc版本应在4.9以上
以4.10.9为例,需先更换内核,再先后安装:
(http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.9/)
linux-headers-4.10.9-041009_4.10.9-041009.201704080516_all.deb
linux-headers-4.10.9-041009-generic_4.10.9-041009.201704080516_amd64.deb
以下步骤在debian 8及ubuntu 16上测试通过:
apt-get install make gcc-4.9
wget -O ./tcp_tsunami.c https://gist.github.com/anonymous/ba338038e799eafbba173215153a7f3a/raw/55ff1e45c97b46f12261e07ca07633a9922ad55d/tcp_tsunami.c
echo "obj-m:=tcp_tsunami.o" > Makefile
make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc-4.9
install tcp_tsunami.ko /lib/modules/$(uname -r)/kernel
depmod -a
insmod tcp_tsunami.ko
sysctl -w net.ipv4.tcp_congestion_control=tsunami
复制代码
关键参数:bbr_bw_rtts, bbr_min_rtt_win_sec, bbr_probe_rtt_mode_ms, bbr_cwnd_min_target, bbr_drain_gain
关键函数:bbr_pacing_gain
经过一个月的测试,魔改BBR比起正常版的BBR确实强上不少,最起码以前看y2b 4k断断续续的远东ss现在能流畅播放了
以上版本的BBR不保证普适性,建议自行修改参数测试
参考链接:
1. http://blog.csdn.net/dog250/article/details/52939004
2. http://blog.csdn.net/dog250/article/details/52879298
3. http://blog.csdn.net/dog250/article/details/52972502
4. https://patchwork.ozlabs.org/patch/671069/
rpm -ivh http://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-4.11.6-1.el7.elrepo.x86_64.rpm
#查看内核顺序
egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
#切换启动内核为0(第一个,有变动自己改)
grub2-set-default 0
reboot
#移除旧版+安装新版kernel-headers
yum remove kernel-headers
rpm -ivh http://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-headers-4.11.6-1.el7.elrepo.x86_64.rpm
#安装dev包
rpm -ivh http://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.11.6-1.el7.elrepo.x86_64.rpm
yum install make gcc
wget -O ./tcp_tsunami.c https://gist.github.com/anonymous/ba338038e799eafbba173215153a7f3a/raw/55ff1e45c97b46f12261e07ca07633a9922ad55d/tcp_tsunami.c
echo "obj-m:=tcp_tsunami.o" > Makefile
make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc
insmod tcp_tsunami.ko
sysctl -w net.ipv4.tcp_congestion_control=tsunami
试了下Centos的..基本差不多...
Tips:
1.关于自启动 (optional)
由于自定义的模块没有直接编译入debian内核,现阶段系统重启后必须动态加载模块,并重新设定拥塞控制算法,建议将启动指令写入startup,范例如下:
PATH_EXEC="/etc/init.d/tsunami_up"
cat>>$PATH_EXEC<'EOF'
modprobe tcp_tsunami
sysctl -w net.ipv4.tcp_congestion_control=tsunami
exit 0
EOF
sudo chmod +x $PATH_EXEC
echo -e "`cat /etc/rc.local|grep -v -E '($PATH_EXEC|exit 0)'`\n$PATH_EXEC\n\nexit 0" > /etc/rc.local
$PATH_EXEC
复制代码
2.Additional Optimization (recommended)
参考:
https://github.com/shadowsocks/shadowsocks/wiki/Optimizing-Shadowsocks
https://github.com/breakwa11/shadowsocks-rss/wiki/ulimit
3.Experimental Optimization (optional)
实验性调优,通过对fq参数的进阶设定,以期提高BBR的发包能力上限
https://www.systutorials.com/docs/linux/man/8-tc-fq/
暂无评论内容