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

334 天前
 unidotnet
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

请教是啥问题?
2485 次点击
所在节点    宽带症候群
21 条回复
maobukui
334 天前
不是的,拿到的 V6 地址,跨运营商也是可以访问的。
猜测你应该是路由器拿 V6 的配置不对吧
maobukui
334 天前
fe80 是本地地址,240 开头的是外网地址
unidotnet
334 天前
@maobukui pppoe 拨号后拿到的是 fe80 开头的,自己去获取 ipv6 才能拿到 240 开头的。
ipv6 的路由里 都写了 ::/0 gateway bridge 了
Archeb
334 天前
你是一个路由器上有 2 个 IPv6 上游?这种情况你要根据源地址做策略路由让它选择正确的出口的。

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

/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
334 天前
最简单是:路由器当交换机,无线路由器当 AP 用
可以这样先排查一下
questionyu
334 天前
拨号获得的 fe80::/128 地址其实可以理解为运营商先给你分配了一个 100.64.x.x/32 的地址,然后路由器再去获取一个 /60 的前缀可以理解为再去获取公网地址。你使用公网地址去访问外网的时候,其实可以理解为流量是走在 fe80 之上的,由 fe80 这个通道承载着上层的 240e:: 地址与互联网的通信。(我这里只是便于理解才这么类比的,实际情况不是这样的)
cwbsw
334 天前
@unidotnet
::/0 gateway bridge 这个不对吧。
gearfox
334 天前
unidotnet
334 天前
@Archeb 谢谢,我发现问题了,路由 ::/0 写电信的 pppoe out , 联通分流可以和您的配置差不多,就可以了。 不过用 firewall mark rule 再 look up table 有点消耗 cpu 哈。。

感谢感谢

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

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



Archeb
333 天前
@unidotnet #13 简单的说,就是接口上的哪个源地址与目的地址长得最像(从左往右看),就用哪个源地址。
alamak76
333 天前
CGNAT 吗?
cnbatch
332 天前
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
331 天前
@Archeb 果真都能链接,哈哈哈。。所以腾讯云的地址和联通长得像。。2400 离 2408 近?
unidotnet
331 天前
@Archeb 另外问一下,为了安全性,我把非内网的 input 和 forward 都 drop 了, 那咋设置可以让 BT 的 peers 能从外面连进来?貌似只有我主动去连外面的 peers 才可以?
Archeb
331 天前
@unidotnet #19 可以设置允许到特定目标端口的连接。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/947652

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX