首先光猫是路由模式,因为要用 ipv6 ,所以开了 odhcpd 做 ra 模式。光猫-->软路由-->wifi ap-->pc 这样的连接模式。
fgfw 的模式是 dnsmasq-->openclash(redir-host)-->smartdns
dnsmasq 的上游 dns 设置为 openclash 的 127.0.0.1:7847 ,这样 openclash 可以根据域名来分流。
现在发现 dnsmasq+odhcpd 会给客户端分配 ipv6 的 dns (从光猫),dhcp 获得 dns 有时候 v4 在前,有时候 v6 在前。v6 在前,而走 ipv6 的 dns 不会被 openclash 拦截,从而都是根据 ip 来判定分流,有时候就出错。
如何禁止 odhcpd ra 不分配 ipv6 的 dns 呢,问了 gpt 和 ds ,都不靠谱。
另外,软路由里 dhcpv6 是否可以用 server 模式,也能保证 pc 的 ipv6 能被外网访问。
另外,我尝试用 adguardhome 替代 dnsmasq ,但是 adguardhome dhcp 明明分配了 dns ,但是客户端就是获取不到,抓包能看到:
AdGuardHome dhcp配置如下:dhcp: enabled: true interface_name: br-lan local_domain_name: lan dhcpv4: gateway_ip: 192.168.10.1 subnet_mask: 255.255.255.0 range_start: 192.168.10.110 range_end: 192.168.10.250 lease_duration: 86400 icmp_timeout_msec: 1000 options: [], Adguardhome 的日志如下:2025/02/25 13:08:54.419245 32548#140 [debug] dhcpv4: sending 303 bytes to fe:33:ec:64:54:13: DHCPv4 Message opcode: BootReply hwtype: Ethernet hopcount: 0 transaction ID: 0x30473afe num seconds: 0 flags: Unicast (0x00) client IP: 0.0.0.0 your IP: 192.168.10.140 server IP: 0.0.0.0 gateway IP: 0.0.0.0 client MAC: fe:33:ec:64:54:13 server hostname: bootfile name: options: Subnet Mask: ffffff00 Router: 192.168.10.1 Domain Name Server: 192.168.10.1, 192.168.10.1 Host Name: 192-168-10-140 IP Addresses Lease Time: 24h0m0s DHCP Message Type: ACK Server Identifier: 192.168.10.1 Client identifier: [1 254 51 236 100 84 19]
1 chuxi 220 天前 |