V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
unidotnet
V2EX  ›  宽带症候群

请问上海电信/联通给的 ipv6 只能连电信联通自己的 fe80 开头的地址吗?

  •  
  •   unidotnet · 321 天前 · 2446 次点击
    这是一个创建于 321 天前的主题,其中的信息可能已经有所发展或是发生改变。
    1.用的 routeros v7.9.2
    2.v6 的 dhcp pool 里能拿到 240 开头的地址
    3.bridge 能获得 2408 ,240e 开头的 v6 地址
    4.在 ipv6 里的 connection list 里看到能连上 fe80 开头的地址,别的都连不上 timeout
    5.ipv6 的 fiewall 里面都关了,input ,forward ,output 全部 accept
    7.本地的所有设备都能拿到 240 开头的 v6 地址

    但是在 ipw.cn 上显示无 ipv6 ,只开电信或者只开联通都一样

    测试:
    路由直接 ping 和 traceroute 外部 ipv6 的地址都 timeout

    内网机器测试:
    traceroute to 240e:38b:8529:9300:892c:xxxx:xxxx:xxxx
    xxx, 30 hops max, 80 byte packets
    xxx 3048.639 ms !H 3048.578 ms !H 3048.545 ms !H

    阿里 dns
    ping 2400:3200:baba::1
    Destination unreachable: No route


    traceroute -6 2400:3200:baba::1
    traceroute to 2400:3200:baba::1 (2400:3200:baba::1), 30 hops max, 80 byte packets
    1 xxx 0.424 ms !N 0.342 ms !N 0.310 ms !N

    请教是啥问题?
    21 条回复    2023-06-20 22:16:07 +08:00
    maobukui
        1
    maobukui  
       321 天前
    不是的,拿到的 V6 地址,跨运营商也是可以访问的。
    猜测你应该是路由器拿 V6 的配置不对吧
    maobukui
        2
    maobukui  
       321 天前   ❤️ 1
    fe80 是本地地址,240 开头的是外网地址
    unidotnet
        3
    unidotnet  
    OP
       321 天前
    @maobukui pppoe 拨号后拿到的是 fe80 开头的,自己去获取 ipv6 才能拿到 240 开头的。
    ipv6 的路由里 都写了 ::/0 gateway bridge 了
    Archeb
        4
    Archeb  
       321 天前
    你是一个路由器上有 2 个 IPv6 上游?这种情况你要根据源地址做策略路由让它选择正确的出口的。

    我建议先拔掉另一个运营商,使用单运营商进行测试,没问题再做下一步。
    Archeb
        5
    Archeb  
       321 天前
    我的配置,供参考

    /ipv6 firewall mangle
    add action=change-mss chain=forward new-mss=1420 out-interface-list=Public-Out \
    passthrough=yes protocol=tcp tcp-flags=syn
    add action=mark-routing chain=prerouting in-interface-list=!Public-Out \
    new-routing-mark=route6-ct passthrough=no src-address=240e::/18
    add action=mark-routing chain=prerouting in-interface-list=!Public-Out \
    new-routing-mark=route6-cu passthrough=no src-address=2408:8000::/20
    add action=mark-routing chain=prerouting in-interface-list=!Public-Out \
    new-routing-mark=route6-cmcc passthrough=no src-address=2409:8000::/20

    /routing rule
    add action=lookup disabled=no routing-mark=route6-cu table=route6-cu
    add action=lookup disabled=no routing-mark=route6-cmcc table=route6-cmcc
    add action=lookup disabled=no routing-mark=route6-ct table=route6-ct

    /ipv6 route
    add disabled=no distance=1 dst-address=::/0 gateway=pppoe-cu2 routing-table=\
    route6-cu scope=30 target-scope=10
    add disabled=no distance=1 dst-address=::/0 gateway=pppoe-ct-163 routing-table=\
    route6-ct scope=30 target-scope=10
    add disabled=no distance=1 dst-address=::/0 gateway=pppoe-cmcc-3 routing-table=\
    route6-cmcc scope=30 target-scope=10
    duke807
        6
    duke807  
       321 天前 via Android
    最简单是:路由器当交换机,无线路由器当 AP 用
    可以这样先排查一下
    questionyu
        7
    questionyu  
       321 天前
    拨号获得的 fe80::/128 地址其实可以理解为运营商先给你分配了一个 100.64.x.x/32 的地址,然后路由器再去获取一个 /60 的前缀可以理解为再去获取公网地址。你使用公网地址去访问外网的时候,其实可以理解为流量是走在 fe80 之上的,由 fe80 这个通道承载着上层的 240e:: 地址与互联网的通信。(我这里只是便于理解才这么类比的,实际情况不是这样的)
    cwbsw
        8
    cwbsw  
       321 天前
    @unidotnet
    ::/0 gateway bridge 这个不对吧。
    unidotnet
        10
    unidotnet  
    OP
       321 天前
    @Archeb 谢谢,我发现问题了,路由 ::/0 写电信的 pppoe out , 联通分流可以和您的配置差不多,就可以了。 不过用 firewall mark rule 再 look up table 有点消耗 cpu 哈。。

    感谢感谢

    但是问题又来了,dns 服务器对某些域名返回了 ipv6 地址,所以。。我连 V2EX 都上不上了。。 只能禁用 ipv6 了。。
    unidotnet
        11
    unidotnet  
    OP
       321 天前
    好了搞定了,ipv6 route 设置只能访问电信 /联通 /移动 /腾讯云 /阿里云 /淘宝的 ipv6 地址, 别的都不能,解决,谢谢。
    @Archeb
    Archeb
        12
    Archeb  
       321 天前   ❤️ 1
    @unidotnet #10 直接用 /routing/rule 规则匹配 src 和 interface 其实也行,我只是习惯了用防火墙搞
    unidotnet
        13
    unidotnet  
    OP
       320 天前
    @Archeb 我现在只允许 ipv6 访问国内。
    但是一个网卡上有电信和联通 2 个 ipv6 , 都能 ping 通, 但是为什么客户端会选择联通 v6 ip 出去而不是电信?
    Archeb
        14
    Archeb  
       320 天前
    @unidotnet #13 客户端选择哪个 IP 出去,一般遵循 rfc3484 中的八条规则。在同一个接口上有多个 IP 地址的情况下,一般根据第八条规则 "Use longest matching prefix" (最长前缀匹配)来选择源地址。

    你可以尝试一下,分别 tracert -6 www.189.cn 和 tracert -6 www.chinaunicom.com.cn
    如果两个源地址都能正常工作,那么他们应该会分别使用电信和联通的源地址进行连接,如下图所示



    Archeb
        15
    Archeb  
       320 天前
    @unidotnet #13 简单的说,就是接口上的哪个源地址与目的地址长得最像(从左往右看),就用哪个源地址。
    alamak76
        16
    alamak76  
       320 天前
    CGNAT 吗?
    cnbatch
        17
    cnbatch  
       319 天前
    fe80 并不是运营商分配的,而是设备自己生成的。fe80 的地位相当于 IPv4 时期的 169.254.0.0/16 ,属于链路本地地址。

    如果运营商想要分配 IPv6 内网地址,那顶多也只能选择 fd00 这个网段(说实话,十分不妥)。
    fd00 相当于 IPv4 时期的 10.0.0.0/8 、172.16.0.0.0/12 、192.168.0.0/16 ,是可以自己在内网随便用的。
    unidotnet
        18
    unidotnet  
    OP
       318 天前
    @Archeb 果真都能链接,哈哈哈。。所以腾讯云的地址和联通长得像。。2400 离 2408 近?
    unidotnet
        19
    unidotnet  
    OP
       318 天前
    @Archeb 另外问一下,为了安全性,我把非内网的 input 和 forward 都 drop 了, 那咋设置可以让 BT 的 peers 能从外面连进来?貌似只有我主动去连外面的 peers 才可以?
    Archeb
        20
    Archeb  
       318 天前
    @unidotnet #19 可以设置允许到特定目标端口的连接。
    flynaj
        21
    flynaj  
       312 天前 via Android
    routeros 用了很多年还是放弃了,IPv6 确实不如 openwrt 稳定。还有不可以安装其它软件。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   900 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 22:20 · PVG 06:20 · LAX 15:20 · JFK 18:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.