V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
unidentifiedme
V2EX  ›  路由器

请教软路由相关问题

  •  
  •   unidentifiedme · 2017-08-27 22:09:40 +08:00 · 9138 次点击
    这是一个创建于 2405 天前的主题,其中的信息可能已经有所发展或是发生改变。

    主要需求是目前的 R6300v2 跑不满 200Mbps 的众所周知的某种服务,所以想考虑上软路由+NAS (不是强需求)。 考虑的解决方案是 ESXi 虚拟一个路由器和一个黑群晖,然后软路由连光猫,R6300v2 只作为 AP。

    目前纠结在两种方案:

    1. 淘宝 N3700 (半)成品。优点是不用折腾,自带多个网卡,但是感觉扩展性略弱,并且是山寨主板(据称是工控板)。
    2. 自己 DIY N3150。华擎的 BGA 板子。优点是能硬解 HEVC,缺点是折腾和略贵。

    方案 2,主要是多个 HEVC 硬解,我也有偶尔看 HEVC 的视频的需求,不过大部分时间也就是弄个 Plex 在 iPad 上看看。

    主要是来这想问问玩过软路由的 dalao:

    1. 方案 1 靠谱么?感觉性价比很高的样子,但是比较担心山寨板子的质量。
    2. 有必要上个小的 SSD 作为系统盘嘛?
    3. 咨询了一下方案 1 的卖家,N3700 是可以满足 200Mbps 的 AES-256-CFB 加密的。N3150 应该也可以吧?

    3150 方案主要参考这篇文章 https://saier.me/n3150-router/

    36 条回复    2017-11-03 10:12:28 +08:00
    xspoco
        1
    xspoco  
       2017-08-27 23:47:15 +08:00
    上小马 V5 吧
    songdezu
        2
    songdezu  
       2017-08-28 06:54:10 +08:00 via Android
    @xspoco 这是什么?路由器和 nas 合体的产物?有没有更好的选择
    waltcow
        3
    waltcow  
       2017-08-28 08:37:47 +08:00 via Android
    我现在用的是 华擎 n3150 + Ubuntu 16.04 + KVM + lede x64
    lan894734188
        4
    lan894734188  
       2017-08-28 08:53:13 +08:00 via Android
    RE6500 padavab 500m 测试通过 原生千兆跑满
    carrionlee
        5
    carrionlee  
       2017-08-28 08:57:41 +08:00 via Android
    我是 n3150 + 2012 server + hyper-v 方案
    hyper-v 跑 openwrt,ubuntu server 和 黑群。
    AES-256-CFB 性能没问题,plex 服务器转码性能倒是不够
    gstqc
        6
    gstqc  
       2017-08-28 09:20:14 +08:00 via iPhone
    1. 稳定性还行,芯片集成度极高,其实主板主要是供电和 IO 了。
    2. mSATA 之类的内部接口可以考虑上,SATA SSD 就算了。
    3. N3150 支持 AES-NI,如果软件支持,跑几百 MB 肯定没问题

    ESXi 并不支持 broadwell 的集显,如果出故障无法远程,只能摸黑处理。
    另外 N3150, N3700 都不支持 VT-D,硬解在 ESXi 下毫无用处。
    建议用 Proxmox,最起码有途径可以解决上面两点问题。
    unidentifiedme
        7
    unidentifiedme  
    OP
       2017-08-28 13:54:39 +08:00 via iPhone
    @gstqc 虚拟化一个路由和一个黑群晖的话,内存 4GB 够吗,还是要上 8GB ?
    xspoco
        8
    xspoco  
       2017-08-28 15:34:44 +08:00
    @songdezu #2 可以单独做,软路由或 NAS,也可以合在一起。不过 nas 的话要换机箱吧。不然塞不下几个硬盘。
    gstqc
        9
    gstqc  
       2017-08-28 16:22:11 +08:00   ❤️ 1
    @unidentifiedme 4G 足够了
    Proxmox 本身要占 700M 左右内存
    路由器 128-256M,黑群晖 1-2G,群晖的中端型号好像极少 2G 以上的内存
    如果你还想跑一下解码、虚拟机、lxc 容器等,8G 当然更好

    我的配置:
    N3700 四核
    8G 内存
    4 千兆
    16G mSATA+机械 SATA

    主要用途:
    1. 虚拟机跑软路由 LEDE,还有 SS
    2. lxc 的容器跑 PT 下载,下载完需要保存的手动挪到 Gen8 的存储中,不需要保存的共享看完删
    3. lxc 容器做测试,比如自己写的代码直接在容器里部署个环境跑,容器比虚拟机轻便很多
    4. kvm 虚拟机做 kernel 层的测试,比如我要改 kernel、加 mod 等等,就在 kvm 虚拟机里跑
    5. Proxmox 跑个 git,和 Gen8 同步。
    通过 2 和 5,Gen8 可以少开机,毕竟 E3 CPU + 5 块硬盘空载都有 60W
    enihcam
        10
    enihcam  
       2017-08-30 13:29:48 +08:00
    unidentifiedme
        11
    unidentifiedme  
    OP
       2017-09-06 11:13:30 +08:00 via iPhone
    @gstqc 和你弄了差不多的配置,但是主要的需求还是没有达到,ESXi 虚拟化下的 LEDE 挂 Chacha20 的代理还是不能跑满 200Mbps,你试过能跑多少吗?(等待本身是没有问题的,我用 Surge 可以跑满
    unidentifiedme
        12
    unidentifiedme  
    OP
       2017-09-06 11:33:53 +08:00 via iPhone
    @gstqc 我发现 libev 版本自带了 iperf 测试脚本,晚上回去试试
    gstqc
        13
    gstqc  
       2017-09-06 12:20:19 +08:00   ❤️ 1
    @unidentifiedme 用 AES-128-GCM 吧
    Chacha20 在 N3150 N3700 下性能不是很好,另外也受服务器影响

    另外你看下服务器的 CPU 是否支持 AES, AVX, AVX2

    大多数加密方式在 N3150 的性能下肯定不止 25 MB/s 的加解密速度,你可以看下网络、网卡、网线是否达到这个性能
    unidentifiedme
        14
    unidentifiedme  
    OP
       2017-09-06 17:18:11 +08:00 via iPhone
    @gstqc
    蛋疼的是这个加密模式不是我能控制的

    我在同一个网络下,关闭 LEDE 上的透明代理,使用 Mac 上的 Surge 连接同一个服务器,能跑满 200Mbps (长时间跑 CPU 温度显著上升,看来即使移动低压版的 i5 应付这种情况也不是想象中那么轻松)

    目前看来瓶颈只能是 CPU。回去跑跑 iperf 基本上就能确认了。

    https://github.com/shadowsocks/shadowsocks-libev/issues/1242
    gstqc
        15
    gstqc  
       2017-09-06 18:57:30 +08:00 via iPhone
    @unidentifiedme 用代理的方式测试下,瓶颈也可能是 ipset 或 iptables
    unidentifiedme
        16
    unidentifiedme  
    OP
       2017-09-06 23:00:28 +08:00
    @gstqc #15

    带着代理测了一下,果然和实际速度差不多。瓶颈果然还是 CPU。
    脚本在这
    https://raw.githubusercontent.com/shadowsocks/shadowsocks-libev/master/scripts/iperf.sh

    这是在 N3700 上( ESXi )
    root@LEDE:~# sh iperf.sh 40960000 chacha20-ietf-poly1305

    [ 3] local 127.0.0.1 port 40372 connected with 127.0.0.1 port 8387
    [ 4] local 127.0.0.1 port 8388 connected with 127.0.0.1 port 36980
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0- 3.8 sec 39.1 MBytes 86.7 Mbits/sec
    Waiting for server threads to complete. Interrupt again to force quit.
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0- 4.8 sec 32.8 MBytes 57.1 Mbits/sec


    这是在 2015 MacBook Pro 13 上
    ❯ ./iperf_test.sh 40960000 chacha20-ietf-poly1305
    Client connecting to 127.0.0.1, TCP port 8387
    TCP window size: 144 KByte (default)
    ------------------------------------------------------------
    [ 4] local 127.0.0.1 port 50396 connected with 127.0.0.1 port 8387
    [ 4] local 127.0.0.1 port 8388 connected with 127.0.0.1 port 50398
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0- 0.5 sec 39.1 MBytes 727 Mbits/sec
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0- 0.5 sec 39.1 MBytes 703 Mbits/sec
    Test Finished

    大概是 10 倍左右的差距
    gstqc
        17
    gstqc  
       2017-09-07 14:39:25 +08:00
    @unidentifiedme #16
    cat /proc/cpuinfo

    model name : Intel(R) Celeron(R) CPU N3150 @ 1.60GHz
    flags : sse4_1 sse4_2 aes
    # flags 支持 aes,其他信息省略掉了


    shadowsocks-libev 3.0.8


    sh iperf-ss.sh 1024M chacha20-ietf-poly1305

    [ 4] local 127.0.0.1 port 8388 connected with 127.0.0.1 port 46898
    [ 3] local 127.0.0.1 port 53200 connected with 127.0.0.1 port 8387
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0-36.3 sec 1.00 GBytes 237 Mbits/sec
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0-36.8 sec 1.00 GBytes 234 Mbits/sec


    sh iperf-ss.sh 1024M aes-128-gcm

    [ 3] local 127.0.0.1 port 53206 connected with 127.0.0.1 port 8387
    [ 4] local 127.0.0.1 port 8388 connected with 127.0.0.1 port 46904
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0-41.4 sec 1.00 GBytes 208 Mbits/sec
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0-42.0 sec 1.00 GBytes 205 Mbits/sec


    sh iperf-ss.sh 1024M aes-128-cfb
    [ 4] local 127.0.0.1 port 8388 connected with 127.0.0.1 port 46912
    [ 3] local 127.0.0.1 port 53214 connected with 127.0.0.1 port 8387
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0-29.2 sec 1.00 GBytes 294 Mbits/sec
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0-29.7 sec 1.00 GBytes 289 Mbits/sec
    unidentifiedme
        18
    unidentifiedme  
    OP
       2017-09-07 17:04:17 +08:00 via iPhone
    @gstqc 这就很奇怪了
    那看来只能是 ESXi 的锅了
    unidentifiedme
        19
    unidentifiedme  
    OP
       2017-09-07 17:36:09 +08:00 via iPhone
    @gstqc 对了你是在你推荐的那个 kvm 环境跑的还是裸机?是 LEDE 嘛
    gstqc
        20
    gstqc  
       2017-09-07 18:12:29 +08:00 via iPhone
    @unidentifiedme 容器里跑的,我弄个 KVM 试下
    gstqc
        21
    gstqc  
       2017-09-19 23:43:25 +08:00 via iPhone   ❤️ 1
    @unidentifiedme 家里网络断了很久
    CPU 同样是 N3700
    Proxmox KVM
    虚拟机双核,LEDE 17.1.2
    SS 3.1.0


    sh iperf-ss.sh 1G aes-128-gcm

    ------------------------------------------------------------
    Server listening on TCP port 8388
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    Client connecting to 127.0.0.1, TCP port 8387
    TCP window size: 2.50 MByte (default)
    ------------------------------------------------------------
    [ 3] local 127.0.0.1 port 35388 connected with 127.0.0.1 port 8387
    [ 4] local 127.0.0.1 port 8388 connected with 127.0.0.1 port 43496
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0-35.9 sec 1.00 GBytes 240 Mbits/sec
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0-36.3 sec 1.00 GBytes 237 Mbits/sec




    sh iperf-ss.sh 100M chacha20-ietf-poly1305

    ------------------------------------------------------------
    Server listening on TCP port 8388
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    Client connecting to 127.0.0.1, TCP port 8387
    TCP window size: 2.50 MByte (default)
    ------------------------------------------------------------
    [ 3] local 127.0.0.1 port 35364 connected with 127.0.0.1 port 8387
    [ 4] local 127.0.0.1 port 8388 connected with 127.0.0.1 port 43472
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0- 2.7 sec 100 MBytes 315 Mbits/sec
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0- 3.1 sec 100 MBytes 274 Mbits/sec






    sh iperf-ss.sh 100M aes-256-gcm
    ------------------------------------------------------------
    Server listening on TCP port 8388
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    Client connecting to 127.0.0.1, TCP port 8387
    TCP window size: 3.01 MByte (default)
    ------------------------------------------------------------
    [ 3] local 127.0.0.1 port 35370 connected with 127.0.0.1 port 8387
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0- 3.8 sec 100 MBytes 221 Mbits/sec
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0- 4.2 sec 100 MBytes 202 Mbits/sec
    gstqc
        22
    gstqc  
       2017-09-19 23:53:41 +08:00 via iPhone
    这种单机环境
    Proxmox 比 ESXi 好太多了
    unidentifiedme
        23
    unidentifiedme  
    OP
       2017-09-20 12:13:20 +08:00
    @gstqc #22 雾草,我这就换掉 ESXi。没想到 ESXi 性能这么惨不忍睹
    unidentifiedme
        24
    unidentifiedme  
    OP
       2017-09-20 16:19:25 +08:00
    @gstqc #22 遇到了一点问题,我在 Proxmox 里面新建 VM 的时候,只能使用 ISO,我将 LEDE 的 IMG 用转换成 ISO。但是在 Proxmox 里面启动 VM 之后报错 “ Could not read from CDROM (code 0005)”

    Google 没有结果,请问你是用什么工具将 IMG 转换到 ISO 的?
    gstqc
        25
    gstqc  
       2017-09-20 16:43:07 +08:00 via iPhone   ❤️ 1
    @unidentifiedme
    下载 Debian 的 LiveCD,可以用 8.8 的 standard,没有 GUI
    上传 iso 到 Proxmox,创建虚拟机,启动
    然后在 Debian Live 里下载 LEDE,看你安装方式,combined-ext4.img.gz 或者 rootfs-ext4.img.gz generic-rootfs.tar.gz 都可以
    然后把系统写到硬盘里,dd 或者手动分区 cp 文件,设置启动分区
    最后重启虚拟机就行。
    unidentifiedme
        26
    unidentifiedme  
    OP
       2017-09-20 17:02:01 +08:00
    @gstqc #25 意思是随意先弄一个 Linux,然后在这个 Linux 里面用 dd img 到磁盘分区,然后换掉启动分区。这样么?
    gstqc
        27
    gstqc  
       2017-09-20 17:41:55 +08:00
    @unidentifiedme #26
    对,不过建议用 livecd 启动到系统
    这样不用安装一个 Linux 到硬盘那么麻烦

    下载 combined-ext4.img.gz
    gzip -d combined-ext4.img.gz -c | dd of=/dev/sda
    重启即可
    unidentifiedme
        28
    unidentifiedme  
    OP
       2017-09-20 19:40:44 +08:00
    @gstqc #27 我简直不敢相信我的眼睛,给了 2 个核,感觉是假的 N3700
    难道是山寨主板的锅?(不支持一些 CPU 相关的功能?) KVM 的 CPU 配置的不对?(我的设置是默认的 kvm64 )

    sh iperf.sh 100M aes-128-gcm
    2017-09-20 11:36:25 INFO: initializing ciphers... aes-128-gcm
    2017-09-20 11:36:25 INFO: listening at 127.0.0.1:8387
    2017-09-20 11:36:25 INFO: running from root user
    2017-09-20 11:36:25 INFO: initializing ciphers... aes-128-gcm
    2017-09-20 11:36:25 INFO: tcp server listening at 127.0.0.1:8389
    2017-09-20 11:36:25 INFO: running from root user
    ------------------------------------------------------------
    Server listening on TCP port 8388
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    ------------------------------------------------------------
    Client connecting to 127.0.0.1, TCP port 8387
    TCP window size: 2.50 MByte (default)
    ------------------------------------------------------------
    [ 3] local 127.0.0.1 port 35600 connected with 127.0.0.1 port 8387
    [ 4] local 127.0.0.1 port 8388 connected with 127.0.0.1 port 35170
    [ ID] Interval Transfer Bandwidth
    [ 3] 0.0-22.2 sec 100 MBytes 37.8 Mbits/sec
    Waiting for server threads to complete. Interrupt again to force quit.
    2017-09-20 11:36:50 ERROR: send: Connection reset by peer
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0-23.2 sec 94.5 MBytes 34.2 Mbits/sec
    Test Finished
    unidentifiedme
        29
    unidentifiedme  
    OP
       2017-09-20 19:52:22 +08:00
    @gstqc #27 从 kvm64 换成 host 之后,性能有所提升,之前设置为 kvm64 的时候少了很多指令集。不过还是和你的测试结果有很大差距。
    gstqc
        30
    gstqc  
       2017-09-20 20:05:26 +08:00
    @unidentifiedme #29
    我没有做任何设置,选 CPU 时就选 host,512M 内存,其他限制都是默认的
    安装的二进制包是这个
    https://bintray.com/aa65535/opkg/shadowsocks-libev/3.1.0#files/shadowsocks-libev%2F3.1.0%2FLEDE%2Fx86_64
    unidentifiedme
        31
    unidentifiedme  
    OP
       2017-09-20 20:29:16 +08:00
    @gstqc #30 你的机器是什么主板? Proxmox 是啥版本?我装的 5.0
    感觉很神奇,搞不懂这个性能差距在哪里。
    gstqc
        32
    gstqc  
       2017-09-20 20:56:47 +08:00
    unidentifiedme
        33
    unidentifiedme  
    OP
       2017-09-20 21:20:27 +08:00
    @gstqc #32 这可能真的是玄学,我的是这家的 V2+,甚至可能主板都是一毛一样的。。。只有网卡不一样,但是网卡根本不影响这个
    gstqc
        34
    gstqc  
       2017-09-20 21:35:31 +08:00 via iPhone
    @unidentifiedme #33 裸机或者容器跑一下试试
    gstqc
        35
    gstqc  
       2017-09-20 21:47:09 +08:00 via iPhone
    @unidentifiedme #33
    我写了个脚本下载 lxc 容器镜像的
    你可以下载容器,然后容器里安装二进制 ss,跑一下试试
    RedHat 系和 Debian 都有官方仓库

    https://gist.github.com/travislee8964/bbc25e5e74f17cfa428c3343c545c9ac

    创建容器,启动,然后在 Proxmox 的 shelllxc-attach -n 100(容器 ID)进入容器即可
    cdh1075
        36
    cdh1075  
       2017-11-03 10:12:28 +08:00
    用 d525 便宜啊,也不需要什么 exsi 虚拟化,nas 直接跑在 d525 上,然后在上面开个 nat 和 dhcp 不就行了,或者装个 debian 更方便,也不用什么群辉了,nas 自己实现
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2815 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:30 · PVG 21:30 · LAX 06:30 · JFK 09:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.