记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

OpenVZ 平台 Google BBR Rinetd 方式 加速 TCP

OpenVZ 平台 Google BBR Rinetd 方式 加速 TCP

简介

ubuntu-16.04-x86_64 亲侧,效果非常好,极其稳定

手动搭建

仅支持 64 位系统。

1.下载文件到 /usr/bin/rinetd-bbr

  1. wget -O /usr/bin/rinetd-bbr https://github.com/linhua55/lkl_study/releases/download/v1.2/rinetd_bbr_powered

2.设置权限

  1. chmod a+x /usr/bin/rinetd-bbr

3.创建配置文件

  1. vi /etc/rinetd-bbr.conf

输入以下内容

  1. # bindadress bindport connectaddress connectport
  2. 0.0.0.0 443 0.0.0.0 443

其中的 443 请改为你的端口
IP 地址统一写 0.0.0.0

4.获取接口名称

  1. #
  2. ip addr
  3. 1: lo: mtu 65536 qdisc noqueue state UNKNOWN
  4. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  5. inet 127.0.0.1/8 scope host lo
  6. inet6 ::1/128 scope host
  7. valid_lft forever preferred_lft forever
  8. 2: venet0: mtu 1500 qdisc noqueue state UNKNOWN
  9. link/void
  10. inet 127.0.0.2/32 scope host venet0
  11. inet 10.10.10.10/32 brd 10.10.10.10 scope global venet0:0

看具有公网 IP 的接口名称(比如我的公网 IP 是 10.10.10.10),上面这种的接口是 venet0:0 而不是 venet0
OpenVZ 应该都是 venet0:0 接口。

5.启动

  1. /usr/bin/rinetd-bbr -f -c /etc/rinetd-bbr.conf raw venet0:0 &

注意:将最后的接口改为你上面获取到的接口。在命令最后面加 & 以使其能后台运行。
验证

正常情况下的输出:

  1. [ 0.000000] Linux version 4.10.0+ (root@gcc) (gcc version 4.9.4 (Ubuntu 4.9.4-2ubuntu1~14.04.1) ) #1 Mon Jul 31 04:50:50 UTC 2017
  2. [ 0.000000] bootmem address range: 0x7f2acc000000 - 0x7f2acffff000
  3. [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16159
  4. [ 0.000000] Kernel command line: virtio_mmio.device=268@0x1000000:1
  5. [ 0.000000] PID hash table entries: 256 (order: -1, 2048 bytes)
  6. [ 0.000000] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
  7. [ 0.000000] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes)
  8. [ 0.000000] Memory available: 64492k/0k RAM
  9. [ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
  10. [ 0.000000] NR_IRQS:4096
  11. [ 0.000000] lkl: irqs initialized
  12. [ 0.000000] clocksource: lkl: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
  13. [ 0.000001] lkl: time and timers initialized (irq2)
  14. [ 0.000003] pid_max: default: 4096 minimum: 301
  15. [ 0.000021] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
  16. [ 0.000023] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
  17. [ 0.009053] console [lkl_console0] enabled
  18. [ 0.009056] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
  19. [ 0.009128] NET: Registered protocol family 16
  20. [ 0.009265] clocksource: Switched to clocksource lkl
  21. [ 0.009324] NET: Registered protocol family 2
  22. [ 0.009418] TCP established hash table entries: 512 (order: 0, 4096 bytes)
  23. [ 0.009421] TCP bind hash table entries: 512 (order: 0, 4096 bytes)
  24. [ 0.009503] TCP: Hash tables configured (established 512 bind 512)
  25. [ 0.009971] UDP hash table entries: 128 (order: 0, 4096 bytes)
  26. [ 0.009976] UDP-Lite hash table entries: 128 (order: 0, 4096 bytes)
  27. [ 0.010060] virtio-mmio: Registering device virtio-mmio.0 at 0x1000000-0x100010b, IRQ 1.
  28. [ 0.010186] workingset: timestamp_bits=62 max_order=14 bucket_order=0
  29. [ 0.010203] virtio-mmio virtio-mmio.0: Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.
  30. [ 0.010350] NET: Registered protocol family 10
  31. [ 0.010849] Segment Routing with IPv6
  32. [ 0.010859] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
  33. [ 0.010993] Warning: unable to open an initial console.
  34. [ 0.011006] This architecture does not have kernel memory protection.
  35. [ 2.169284] random: fast init done

查看 iptables 规则:

  1. # iptables -t raw -nL
  2. Chain PREROUTING (policy ACCEPT)
  3. target prot opt source destination
  4. ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 /* LKL_RAW */
  5. DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 /* LKL_RAW */
  6. Chain OUTPUT (policy ACCEPT)
  7. target prot opt source destination

已经有两条规则了。

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):