前提条件 Openwrt >= 22.03 + fw4
在/etc/nftables.d/下创建一个.nft 文件,比如/etc/nftables.d/20-ipv6-allowed-filter.nft , 输入以下内容:# chain allow_icmpv6_from_selected_macs { type filter hook prerouting priority -300; policy accept; # 允许获取 IPV6 的设备 MAC 地址, 多个设备逗号隔开 #iifname "br-lan" ether saddr { xx:xx:xx:xx:xx:xx, yy:xx:xx:xx:xx:xx } ip6 nexthdr icmpv6 accept # 可以用 ipset 名称方便管理(Network->Firewall->IP Sets), 比如 devices_allow_ipv6 iifname "br-lan" ether saddr ip6 nexthdr icmpv6 accept # 丢弃其他 icmp 请求 iifname "br-lan" ip6 nexthdr icmpv6 drop}
重启 firewall 和 odhcpd 生效