怎么在 Zerotier 丢弃 IPv6 的 DHCP 数据包?

73 天前
 okletgo
我用 Zerotier 二层桥接了多个异地的网络,但是我发现每个设备都分配不同运营商的 IPv6 。
例如被桥接的两个异地的网络分别是电信、联通的,那么每个设备都会获得 240e 、2408 前缀的 IPv6 ,这并不是我想要的效果,我希望每个设备只能获得所在运营商的 IPv6 。

我找到了丢弃 IPv4 DHCP 的方法。
drop
not ethertype ipv4
and not ethertype arp
and not ethertype ipv6
;

drop ethertype ipv4
and ipprotocol udp
and sport 68
and dport 67
;

drop ethertype ipv4
and ipprotocol udp
and sport 67
and dport 68
;

但是当我修改成这样以丢弃 IPv6 DHCP ,我发现没有效果。

drop ethertype ipv6
and ipprotocol udp
and sport 547
and dport 546
;

drop ethertype ipv6
and ipprotocol udp
and sport 546
and dport 547
738 次点击
所在节点    宽带症候群
5 条回复
lxcopenwrt
73 天前
麻烦问下怎么设置才能做到二层桥接?我想把家宽的 IPv6 传给阿里云 ECS 用但一直没找到教程(国内几个云服务商 IPv6 带宽还要单独收费真的是太恶心了)
lxcopenwrt
73 天前
楼主的问题应该是 SLAAC 无状态分配地址的问题,可以考虑怎么将 ICMPv6 的包禁止通过 zerotier 传输就能解决问题
okletgo
73 天前
@lxcopenwrt 我用的是 172.25.0.0/16 ,子网掩码 255.255.0.0 ,主网是 172.25.1.100~172.25.1.250 ,网关 172.25.1.1 ,子网是 172.25.2.100~172.25.2.250 ,网关 172.25.2.1 。在 OpenWRT 把 zerotier 开启,zerotier 的管理后台勾选允许该接口桥接,然后给主网 zerotier 设置地址 172.25.1.10 ,子网 zerotier 设置地址 172.25.2.10 ,规则丢弃 IPv4 DHCP ,然后把 zerotier 接口和 br-lan 桥接起来。阿里云没搞过不知道,我想尽量不花钱 P2P ,不搞花钱中继。
okletgo
73 天前
@lxcopenwrt 不对,SLAAC 是一种可以在没有 DHCPv6 服务器服务的情况下获取 IPv6 全局单播地址的方法,我这明显是主网和子网分别向对方的网关获取到了 IPv6 ,zerotier 没有起到屏蔽作用,现在肉眼暂时没看到副作用,但是说不定抓包分析就发现问题了。
okletgo
72 天前
@lxcopenwrt 你是对的,我在 github 看到老外 2017 年提过同样的问题,然后琢磨了一整天的写法。
然后我发现这样写就对了:
drop ethertype ipv6
and ipprotocol icmp6
;
谢天谢地,问题解决了

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

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

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

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

© 2021 V2EX