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

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

  •  
  •   okletgo · 52 天前 · 698 次点击
    这是一个创建于 52 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我用 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
    5 条回复
    lxcopenwrt
        1
    lxcopenwrt  
       52 天前
    麻烦问下怎么设置才能做到二层桥接?我想把家宽的 IPv6 传给阿里云 ECS 用但一直没找到教程(国内几个云服务商 IPv6 带宽还要单独收费真的是太恶心了)
    lxcopenwrt
        2
    lxcopenwrt  
       52 天前
    楼主的问题应该是 SLAAC 无状态分配地址的问题,可以考虑怎么将 ICMPv6 的包禁止通过 zerotier 传输就能解决问题
    okletgo
        3
    okletgo  
    OP
       52 天前
    @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
        4
    okletgo  
    OP
       52 天前
    @lxcopenwrt 不对,SLAAC 是一种可以在没有 DHCPv6 服务器服务的情况下获取 IPv6 全局单播地址的方法,我这明显是主网和子网分别向对方的网关获取到了 IPv6 ,zerotier 没有起到屏蔽作用,现在肉眼暂时没看到副作用,但是说不定抓包分析就发现问题了。
    okletgo
        5
    okletgo  
    OP
       51 天前
    @lxcopenwrt 你是对的,我在 github 看到老外 2017 年提过同样的问题,然后琢磨了一整天的写法。
    然后我发现这样写就对了:
    drop ethertype ipv6
    and ipprotocol icmp6
    ;
    谢天谢地,问题解决了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1799 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 00:24 · PVG 08:24 · LAX 17:24 · JFK 20:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.