![在 dnsmasq 中启用 DHCPv6 来分配固定范围的 IPv6 地址但失败了](https://linux22.com/image/673083/%E5%9C%A8%20dnsmasq%20%E4%B8%AD%E5%90%AF%E7%94%A8%20DHCPv6%20%E6%9D%A5%E5%88%86%E9%85%8D%E5%9B%BA%E5%AE%9A%E8%8C%83%E5%9B%B4%E7%9A%84%20IPv6%20%E5%9C%B0%E5%9D%80%E4%BD%86%E5%A4%B1%E8%B4%A5%E4%BA%86.png)
需要帮助!我想在我的 Raspbian PI 中创建一个 AP。我选择 dnsmasq 作为 dhcpv4 和 dhcpv6 服务器。但是,我的笔记本电脑可以成功获取 IPv4,但无法获取 IPv6。为什么 dnsmasq 不适用于 IPv6?
# my dnsmasq.conf
domain-needed
no-resolv
no-poll
server=8.8.8.8
server=8.8.4.4
all-servers
interface=wlan0
dhcp-range=192.168.233.100, 192.168.233.200, 255.255.255.0, 12h
dhcp-range=fec0::ff00, fec0::fffe/10, 12h
enable-ra
dhcp-option-force=26,1397
log-queries
log-dhcp
conf-dir=/etc/dnsmasq.d
# glance at the dnsmasq log when i make a DHCP request
hostapd: wlan0: STA 88:53:2e:65:8c:a4 IEEE 802.11: associated
hostapd: wlan0: STA 88:53:2e:65:8c:a4 RADIUS: starting accounting session 56703A6F-00000010
hostapd: wlan0: STA 88:53:2e:65:8c:a4 WPA: pairwise key handshake completed (RSN)
dnsmasq-dhcp[3585]: 2738259568 available DHCP range: 192.168.233.100 -- 192.168.233.200
dnsmasq-dhcp[3585]: 2738259568 client provides name: anri
dnsmasq-dhcp[3585]: 2738259568 DHCPREQUEST(wlan0) 192.168.233.200 88:53:2e:65:8c:a4
dnsmasq-dhcp[3585]: 2738259568 tags: wlan0
dnsmasq-dhcp[3585]: 2738259568 DHCPACK(wlan0) 192.168.233.200 88:53:2e:65:8c:a4 anri
dnsmasq-dhcp[3585]: 2738259568 requested options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
dnsmasq-dhcp[3585]: 2738259568 requested options: 15:domain-name, 6:dns-server, 119:domain-search,
dnsmasq-dhcp[3585]: 2738259568 requested options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
dnsmasq-dhcp[3585]: 2738259568 requested options: 26:mtu, 121:classless-static-route, 42:ntp-server,
dnsmasq-dhcp[3585]: 2738259568 requested options: 121:classless-static-route, 249, 33:static-route,
dnsmasq-dhcp[3585]: 2738259568 requested options: 252, 42:ntp-server
dnsmasq-dhcp[3585]: 2738259568 next server: 192.168.233.254
dnsmasq-dhcp[3585]: 2738259568 sent size: 1 option: 53 message-type 5
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 54 server-identifier 192.168.233.254
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 51 lease-time 43200
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 58 T1 21600
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 59 T2 37800
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 1 netmask 255.255.255.0
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 28 broadcast 192.168.233.255
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 3 router 192.168.233.254
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 6 dns-server 192.168.233.254
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 12 hostname anri
dnsmasq-dhcp[3585]: 2738259568 sent size: 2 option: 26 mtu 1397
dnsmasq-dhcp[3585]: RTR-SOLICIT(wlan0)
dnsmasq-dhcp[3585]: 2738259568 available DHCP range: 192.168.233.100 -- 192.168.233.200
dnsmasq-dhcp[3585]: 2738259568 client provides name: anri
dnsmasq-dhcp[3585]: 2738259568 DHCPREQUEST(wlan0) 192.168.233.200 88:53:2e:65:8c:a4
dnsmasq-dhcp[3585]: 2738259568 tags: wlan0
dnsmasq-dhcp[3585]: 2738259568 DHCPACK(wlan0) 192.168.233.200 88:53:2e:65:8c:a4 anri
dnsmasq-dhcp[3585]: 2738259568 requested options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
dnsmasq-dhcp[3585]: 2738259568 requested options: 15:domain-name, 6:dns-server, 119:domain-search,
dnsmasq-dhcp[3585]: 2738259568 requested options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
dnsmasq-dhcp[3585]: 2738259568 requested options: 26:mtu, 121:classless-static-route, 42:ntp-server,
dnsmasq-dhcp[3585]: 2738259568 requested options: 121:classless-static-route, 249, 33:static-route,
dnsmasq-dhcp[3585]: 2738259568 requested options: 252, 42:ntp-server
dnsmasq-dhcp[3585]: 2738259568 next server: 192.168.233.254
dnsmasq-dhcp[3585]: 2738259568 sent size: 1 option: 53 message-type 5
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 54 server-identifier 192.168.233.254
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 51 lease-time 43200
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 58 T1 21600
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 59 T2 37800
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 1 netmask 255.255.255.0
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 28 broadcast 192.168.233.255
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 3 router 192.168.233.254
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 6 dns-server 192.168.233.254
dnsmasq-dhcp[3585]: 2738259568 sent size: 4 option: 12 hostname anri
dnsmasq-dhcp[3585]: 2738259568 sent size: 2 option: 26 mtu 1397
答案1
您在配置中犯了几个不同的错误。首先,站点本地地址已被弃用多年。任何告诉您使用以 开头的地址的文档fec0
都已过时,需要更新。
站点本地地址的替代品称为唯一本地地址。这些地址由fd
第一个八位字节和五个字节组成。随机的八位字节。例如,您可以将fdda:772b:1c61::/48
其作为本地前缀。
但是,上述两种类型的地址都不适用于要与自己网络之外的任何设备通信的计算机。如果希望这些计算机与自己网络之外的任何设备通信,则应从 ISP 路由给您的前缀中为它们分配地址。
此外,对于许多场景来说,使用 DHCPv6 并不是最佳选择。这取决于您的特定需求,但通常使用路由器广告守护程序(例如radvd
)比 DHCPv6 服务器更合适。