felix0012 最近的时间轴更新
felix0012

felix0012

V2EX 第 285186 号会员,加入于 2018-01-22 08:23:01 +08:00
felix0012 最近回复了
一贴文字,缩进格式全没了……

Openwrt 路由器的 Advertise

DHCPv6
____Message_type:_Advertise_(2)
____Transaction_ID:_0x19f696
____Server_Identifier
________Option:_Server_Identifier_(2)
________Length:_10
________DUID:_0003000120769300a03c
________DUID_Type:_link-layer_address_(3)
________Hardware_type:_Ethernet_(1)
________Link-layer_address:_xxx
________Link-layer_address_(Ethernet):_xxx
____Client_Identifier
________Option:_Client_Identifier_(1)
________Length:_14
________DUID:_000100012b3dd50b507b9d730987
________DUID_Type:_link-layer_address_plus_time_(1)
________Hardware_type:_Ethernet_(1)
________DUID_Time:_Dec_28,_2022_00:08:43.000000000_中国标准时间
________Link-layer_address:_xxx
________Link-layer_address_(Ethernet):_xxx
____SOL_MAX_RT
________Option:_SOL_MAX_RT_(82)
________Length:_4
____DNS_recursive_name_server
________Option:_DNS_recursive_name_server_(23)
________Length:_16
_________1_DNS_server_address:_fd5c:1e:6cb0::1
____Identity_Association_for_Non-temporary_Address
________Option:_Identity_Association_for_Non-temporary_Address_(3)
________Length:_40
________IAID:_03e09467
________T1:_21600
________T2:_34560
________IA_Address
____________Option:_IA_Address_(5)
____________Length:_24
____________IPv6_address:_fd5c:1e:6cb0::7e8
____________Preferred_lifetime:_43200
____________Valid_lifetime:_43200


光猫的 Advertise

DHCPv6
____Message_type:_Advertise_(2)
____Transaction_ID:_0x19f696
____Client_Identifier
________Option:_Client_Identifier_(1)
________Length:_14
________DUID:_000100012b3dd50b507b9d730987
________DUID_Type:_link-layer_address_plus_time_(1)
________Hardware_type:_Ethernet_(1)
________DUID_Time:_Dec_28,_2022_00:08:43.000000000_中国标准时间
________Link-layer_address:_xxx
________Link-layer_address_(Ethernet):_xxx
____Server_Identifier
________Option:_Server_Identifier_(2)
________Length:_10
________DUID:_0003000628011c3da73f
________DUID_Type:_link-layer_address_(3)
________Hardware_type:_IEEE_802_(6)
________Link-layer_address:_xxx
________Link-layer_address_(Ethernet):_xxx
____Identity_Association_for_Non-temporary_Address
________Option:_Identity_Association_for_Non-temporary_Address_(3)
________Length:_40
________IAID:_03e09467
________T1:_26117
________T2:_41787
________IA_Address
____________Option:_IA_Address_(5)
____________Length:_24
____________IPv6_address:_240e:3af:e1a:2080:e294:67ff:fe0f:af4b
____________Preferred_lifetime:_52234
____________Valid_lifetime:_52234
____Preference
________Option:_Preference_(7)
________Length:_1
________Pref-value:_7
____DNS_recursive_name_server
________Option:_DNS_recursive_name_server_(23)
________Length:_16
_________1_DNS_server_address:_fe80::1
____Vendor-specific_Information
________Option:_Vendor-specific_Information_(17)
________Length:_25
________Enterprise_ID:_Reserved_(0)
Openwrt 路由器的 Advertise

DHCPv6
Message type: Advertise (2)
Transaction ID: 0x19f696
Server Identifier
Option: Server Identifier (2)
Length: 10
DUID: xxx
DUID Type: link-layer address (3)
Hardware type: Ethernet (1)
Link-layer address: xxx
Link-layer address (Ethernet): xxx
Client Identifier
Option: Client Identifier (1)
Length: 14
DUID: xxx
DUID Type: link-layer address plus time (1)
Hardware type: Ethernet (1)
DUID Time: Dec 28, 2022 00:08:43.000000000 中国标准时间
Link-layer address: xxx
Link-layer address (Ethernet): xxx
SOL_MAX_RT
Option: SOL_MAX_RT (82)
Length: 4
DNS recursive name server
Option: DNS recursive name server (23)
Length: 16
1 DNS server address: fd5c:1e:6cb0::1
Identity Association for Non-temporary Address
Option: Identity Association for Non-temporary Address (3)
Length: 40
IAID: 03e09467
T1: 21600
T2: 34560
IA Address
Option: IA Address (5)
Length: 24
IPv6 address: fd5c:1e:6cb0::7e8
Preferred lifetime: 43200
Valid lifetime: 43200

------------

光猫的 Advertise

DHCPv6
Message type: Advertise (2)
Transaction ID: 0x19f696
Client Identifier
Option: Client Identifier (1)
Length: 14
DUID: xxx
DUID Type: link-layer address plus time (1)
Hardware type: Ethernet (1)
DUID Time: Dec 28, 2022 00:08:43.000000000 中国标准时间
Link-layer address: xxx
Link-layer address (Ethernet): xxx
Server Identifier
Option: Server Identifier (2)
Length: 10
DUID: 0003000628011c3da73f
DUID Type: link-layer address (3)
Hardware type: IEEE 802 (6)
Link-layer address: xxx
Link-layer address (Ethernet): xxx
Identity Association for Non-temporary Address
Option: Identity Association for Non-temporary Address (3)
Length: 40
IAID: 03e09467
T1: 26117
T2: 41787
IA Address
Option: IA Address (5)
Length: 24
IPv6 address: 240e:3af:e1a:2080:e294:67ff:fe0f:af4b
Preferred lifetime: 52234
Valid lifetime: 52234
Preference
Option: Preference (7)
Length: 1
Pref-value: 7
DNS recursive name server
Option: DNS recursive name server (23)
Length: 16
1 DNS server address: fe80::1
Vendor-specific Information
Option: Vendor-specific Information (17)
Length: 25
Enterprise ID: Reserved (0)
@luoshengdu
>> 去找 fe80::1 是因为你没有告诉电脑找 fd5c 的 IP
这里没看懂,告诉电脑用哪个 IPv6 地址,这就是 DHCPv6 的工作呀
现在电脑发送了 Solicit 请求,路由和光猫都回复了 Advertise 。只是电脑挑选了光猫来进行接下来的协议。

>> 在 dhcp 服务器上配置 v6 dns 的信息下发
这一点也实现了,因为路由给出了 DHCPv6 Advertise ,其中包含了 DNS 。

>> IP 地址不存在优先级
刚才我找了下资料,确实是这样。
但是优先级现象是存在的。
问题出在 DHCPv6 协议的环节,当网络上存在多个 Advertise 时,电脑会做出倾向性选择
参考 https://blog.csdn.net/Kuaisen/article/details/118675607

我又仔细看了抓包记录里面的两个 Advertise ,光猫的带有 preference option 字段,openwrt 给出的没有这个 option 。我猜测电脑收到这两个 Advertise 后倾向于回复光猫就是因为他的带有 preference 。

然后我又找 openwrt 的 odhp 怎么能加入这个 preference option ,没找到有资料。

接下来我感觉解决方案有两类,一个是拿到光猫的超级用户密码,想办法禁止光猫的 DHCPv6 。再就是用带有 VLAN 的交换机或者增加一个路由器,向子网屏蔽光猫的 DHCPv6
@luoshengdu
我怀疑节点获得的多个 IPv6 地址中,FE80::的优先级比 FDxx::的优先级高,或者说 Link-local 地址的优先级比 ULA 的优先级高…
@luoshengdu
我看了一下 Wireshark 抓包记录,发现以下特点:

1) 网络中光猫分发的是 FE80::地址,自己是 FE80::1 ,这个地址好像叫做本地链接地址( Link-local )
2) openwrt 路由器分发的是 fd5c:001e:6cb0::/48 ,一个 ULA 地址。自己有两个地址,一个是自己的 fd5c:1e:6cb0::1 ,一个是从光猫获得的 fe80::2276:93ff:fe00:a03c
3) 节点( Windows 系统)执行 ipconfig /renew6 后,向网络发送了 DHCPv6 Solicit XID 请求,请求是通过 FE80::前缀的地址发出的
4) 光猫和 openwrt 路由器分别使用 FE80::地址的 DHCPv6 Advertise XID 回复了节点。回复中光猫和 Openwrt 各自声明 DNS 服务器是自己,分别是 FE80::1 和 fd5c:1e:6cb0::1 。这说明 Openwrt 路由器的 DHCPv6 是工作了的。
5 )节点只向光猫发送了 DHCPv6 Request XID ,并得到光猫的 DHCPv6 Reply XID
6) 节点 ipconfig /renew6 命令完成后,DNS 列表里只有光猫,没有 Openwrt 路由器
@luoshengdu 谢谢大佬,这也是我寻求的方案。我对 openwrt 的 ipv6 下面配置不太熟悉,一直想实现 openwrt 下发 v6 dns 地址但没成功。

今晚回家试试看
@Andim
按照这个页面的方法试了下,注册表 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\里新建 DisabledComponents 并设置为 0x20:优先 IPv4 而非 IPv6 ,重启后 nslookup ,仍然向光猫的 ipv6 地址请求解析并失败
@dodakt
尝试了,有效,谢谢

首选 DNS 服务器填入 openwrt 路由器的 IPv6 地址:

默认网关. . . . . . . . . . . . . : fe80::1%4 <-- 这个是光猫的 IPv6 地址
192.168.1.1 <-- 这个是光猫的 IPv4 地址
DHCP 服务器 . . . . . . . . . . . : 192.168.1.254 <-- 这个是 openwrt 路由器的 IPv4 地址
DHCPv6 IAID . . . . . . . . . . . : 65049703
DNS 服务器 . . . . . . . . . . . : fd5c:1e:6cb0::1 <-- 这个是 openwrt 路由器的 IPv6 地址
192.168.1.254 <-- 这个是 openwrt 路由器的 IPv4 地址
TCPIP 上的 NetBIOS . . . . . . . : 已启用

C:\Users\Felix>nslookup gitea.onecloud.lan
服务器: UnKnown
Address: fd5c:1e:6cb0::1 <-- 这个是 openwrt 路由器的 IPv6 地址

名称: gitea.onecloud.lan
Address: 192.168.1.4
@godall
试了一下:
启用 IPv6 时

无线局域网适配器 WLAN:
连接特定的 DNS 后缀 . . . . . . . : lan
描述. . . . . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 3165
物理地址. . . . . . . . . . . . . : E0-94-67-xx-xx-xx
DHCP 已启用 . . . . . . . . . . . : 是
自动配置已启用. . . . . . . . . . : 是
IPv6 地址 . . . . . . . . . . . . : 240e:3af:e1a:2080:26bf:xxx:xxx:xxx(首选)
IPv6 地址 . . . . . . . . . . . . : 240e:3af:e1a:2080:e294:xxx:xxx:xxx(首选)
获得租约的时间 . . . . . . . . . : 2024 年 4 月 10 日 17:30:00
租约过期的时间 . . . . . . . . . : 2024 年 4 月 11 日 12:14:23
IPv6 地址 . . . . . . . . . . . . : fd5c:1e:6cb0:0:2f7b:xxx:xxx:xxx(首选)
临时 IPv6 地址. . . . . . . . . . : 240e:3af:e1a:2080:f985:xxx:xxx:xxx(首选)
临时 IPv6 地址. . . . . . . . . . : fd5c:1e:6cb0:0:f985:xxx:xxx:xxx(首选)
本地链接 IPv6 地址. . . . . . . . : fe80::d002:xxx:xxx:xxx%4(首选)
IPv4 地址 . . . . . . . . . . . . : 192.168.1.87(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.0
获得租约的时间 . . . . . . . . . : 2024 年 4 月 10 日 17:20:12
租约过期的时间 . . . . . . . . . : 2024 年 4 月 11 日 5:29:57
默认网关. . . . . . . . . . . . . : fe80::1%4 <-- 这个是光猫的 IPv6 地址
192.168.1.1 <-- 这个是光猫的 IPv6 地址
DHCP 服务器 . . . . . . . . . . . : 192.168.1.254 <-- 这个是 openwrt 路由器的 IPv4 地址
DHCPv6 IAID . . . . . . . . . . . : 65049703
DHCPv6 客户端 DUID . . . . . . . : 00-01-00-01-2B-3D-xxxxxxx
DNS 服务器 . . . . . . . . . . . : fe80::1%4 <-- 这个是光猫的 IPv6 地址
192.168.1.254 <-- 这个是 openwrt 路由器的 IPv4 地址
TCPIP 上的 NetBIOS . . . . . . . : 已启用

C:\Users\Felix>nslookup gitea.onecloud.lan
服务器: UnKnown
Address: fe80::1 <-- 这个是光猫的 IPv6 地址
*** UnKnown 找不到 gitea.onecloud.lan: Non-existent domain

禁用 IPv6 时

无线局域网适配器 WLAN:
连接特定的 DNS 后缀 . . . . . . . : lan
描述. . . . . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 3165
物理地址. . . . . . . . . . . . . : E0-94-67-xx-xx-xx
DHCP 已启用 . . . . . . . . . . . : 是
自动配置已启用. . . . . . . . . . : 是
IPv4 地址 . . . . . . . . . . . . : 192.168.1.87(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.0
获得租约的时间 . . . . . . . . . : 2024 年 4 月 10 日 17:20:12
租约过期的时间 . . . . . . . . . : 2024 年 4 月 11 日 5:20:07
默认网关. . . . . . . . . . . . . : 192.168.1.1 <-- 这个是光猫的 IPv4 地址
DHCP 服务器 . . . . . . . . . . . : 192.168.1.254 <-- 这个是 openwrt 路由器的 IPv4 地址
DNS 服务器 . . . . . . . . . . . : 192.168.1.254 <-- 这个是 openwrt 路由器的 IPv4 地址
TCPIP 上的 NetBIOS . . . . . . . : 已启用

C:\Users\Felix>nslookup gitea.onecloud.lan
服务器: OpenWrt.lan
Address: 192.168.1.254 <-- 这个是 openwrt 路由器的 IPv4 地址

名称: gitea.onecloud.lan
Address: 192.168.1.4
@guanzhangzhang 哈哈,买个支持 802.11ac 的 AP 可能是最简单的方案了
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2782 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 12:41 · PVG 20:41 · LAX 05:41 · JFK 08:41
Developed with CodeLauncher
♥ Do have faith in what you're doing.