现在官方库里已经有kmod-tcp-bbr.ipk了

直接opkg install kmod-tcp-bbr

然后在/etc/sysctl.conf里最下边添加net.ipv4.tcp_congestion_control=bbr

最后sysctl -p即可

最新openwrt的内核(4.14.*)默认不编译bbr。

可以修改kernel的.config来启用bbr

用ipk包的形式安装也很方便,于是写了个ipk makefile 顺便学习:

项目地址https://github.com/anshi233/Openwrt-BBR

支持内核>=4.14.* 所以请使用官方最新源码编译。

Openwrt 18*以上版本已经自带BBR了

(直接在路由器里执行insmod tcp_bbr

然后执行echo "tcp_bbr" > /etc/modules.d/bbr

然后在/etc/sysctl.conf里最下边添加net.ipv4.tcp_congestion_control=bbr

最后sysctl -p即可

git clone https://git.openwrt.org/openwrt/openwrt.git

使用方法:


原版BBR:

在源码根目录或者sdk根目录:

git clone https://github.com/anshi233/Openwrt-BBR.git package/Openwrt-BBR
选择Kernel modules --> Network Support ---> kmod-bbr
make package/Openwrt-BBR/bbr_origin/compile

然后去bin文件夹找kmod-bbr-(内核版本).ipk

下载到路由器里然后用opkg 安装上

路由器里启用BBR:

insmod bbr

添加开机加载:

echo "bbr" > /etc/modules.d/bbr

然后修改/etc/sysctl.conf

随便什么地方加上:

net.ipv4.tcp_congestion_control=bbr

然后保存

运行

sysctl -p

检查运行:

sysctl net.ipv4.tcp_congestion_control

应返回

net.ipv4.tcp_congestion_control = bbr


魔改BBR:

在源码根目录或者sdk根目录:

git clone https://github.com/anshi233/Openwrt-BBR.git package/Openwrt-BBR
选择Kernel modules --> Network Support ---> kmod-bbr_mod
make package/Openwrt-BBR/bbr_mod/compile

然后去bin文件夹找kmod-bbr_mod-(内核版本).ipk

下载到路由器里然后用opkg 安装上

路由器里启用BBR:

insmod tcp_bbr_mod

添加开机加载:

echo "tcp_bbr_mod" > /etc/modules.d/bbr

然后修改/etc/sysctl.conf

随便什么地方加上:

net.ipv4.tcp_congestion_control=tcp_bbr_mod

然后保存

运行

sysctl -p

检查运行:

sysctl net.ipv4.tcp_congestion_control

应返回

net.ipv4.tcp_congestion_control = tcp_bbr_mod

至于有没有用

传统应用上看youtube为例主要是大带宽tcp连接下载,bbr只能加速本地回复的ACK包。这种情况下ACK包基本上是碰不到上传带宽极限的。所以没用。

但是如果把数据备份到远程大盘鸡上这种情况,那就有用。

但是路由器只负责转发和我tcp发包有什么关系吗?

所以除非拿路由器刷pt或者在路由器上挂酸酸客户端。否则一点用都没有。

8 Comments

回复 anshi 取消回复

  • make[3]: Entering directory `/home/ouxin/WorkSpace/openwrt_lede/openwrt/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7621/linux-4.4.92′
    CC [M] /home/ouxin/WorkSpace/openwrt_lede/openwrt/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7621/bbr_mod/tcp_bbr_mod.o
    /home/ouxin/WorkSpace/openwrt_lede/openwrt/build_dir/target-mipsel_24kc_musl-1.1.16/linux-ramips_mt7621/bbr_mod/tcp_bbr_mod.c:64:30: fatal error: linux/win_minmax.h: No such file or directory
    是否是内核问题?

    1. 官方release的内核是4.4.92,并不支持。
      而官方最新源码用的是4.14.29,这个可以用。
      所以请用最新官方源码编译。。

  • 前面SDK编译的都对,而且opkg也装好了,能看到kmod-bbr装上去了

    但运行下面的命令时找不到
    insmod kmod-bbr
    Failed to find kmod-bbr. Maybe it is a built in module ?

    uname -a
    uname -a
    Linux c2gl19 4.14.63 #0 SMP Thu Aug 16 07:51:15 2018 armv7l GNU/Linux

  • 版主你好!我参照你的步骤,下载了最新的源码18.06.01版。在make menuconfig后直接make它提示找不到很多dependecy。然后我就做了feeds update:
    ./scripts/feeds update -a
    ./scripts/feeds install -a
    然后再make menuconfig再编译。可是编译的时候出现如下错误信息。不知道可以怎么解决?谢谢!

    make[1]: Entering directory `/home/yaokan/openwrt’
    make[2]: Entering directory `/home/yaokan/openwrt/package/Openwrt-BBR/bbr_origin’
    make[2]: *** No rule to make target `/home/yaokan/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.78/.config’, needed by `/home/yaokan/openwrt/build_dir/target-x86_64_musl/linux-x86_64/bbr/.built’. Stop.
    make[2]: Leaving directory `/home/yaokan/openwrt/package/Openwrt-BBR/bbr_origin’
    time: package/Openwrt-BBR/bbr_origin/compile#0.06#0.05#0.12
    make[1]: *** [package/Openwrt-BBR/bbr_origin/compile] Error 2
    make[1]: Leaving directory `/home/yaokan/openwrt’
    make: *** [package/Openwrt-BBR/bbr_origin/compile] Error 2

    1. 重新下载源码试试(其实18已经自带bbr了我这个已经属于历史遗物了)