DHCPv6返回/ 128掩码

时间:2018-04-27 09:36:59

标签: ipv6

我有一个运行和工作的dhcp服务器(dnsmask)。 但我的客户收到一个/ 128 ipv6地址。像那样:

 inet6 fd00:cafe:cafe:cafe::4246/128 scope global dynamic

我不应该得到/ 64面具吗?

这是我的dnsmask conf:

interface=wlx503eaa3d7d6c
no-dhcp-interface=lo, eth0
dhcp-range=fd00:cafe:cafe:cafe::10,fd00:cafe:cafe:cafe::cafe,12h
port = 0
enable-ra

我错过了什么?

由于

2 个答案:

答案 0 :(得分:0)

回答:

dhcp-range=fd00:cafe:cafe:cafe::,ra-only

然后我得到一个/ 64面具

MAN页面(http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html):

--dhcp-range=::,constructor:eth0

 For IPv6, the mode may be some combination of ra-only, slaac, ra-names, ra-stateless, ra-advrouter, off-link.

ra-only tells dnsmasq to offer Router Advertisement only on this subnet, and not DHCP. 

答案 1 :(得分:0)

/sbin/dhcpcd 有一个“-U”选项,可以转储有关您的 ISP 分配的租用的所有信息。使用“-4”和“-6”选项,可以查询IPv4和IPv6。信息以可以“grep”的 bash 脚本格式转储。

dnsmasq 允许在启动时读取目录中的所有文件,因此我在运行脚本时编写了网络要求。我已经预留了 1-500 个 IPv6 地址供我自己私人使用,但未公开。

该脚本还会为我的防火墙机器提取 fe80:: 地址,以便 dnsmasq 在需要来自计算机或手机的 dhcp 请求时通告路由器。

我还将 MTU 设置为 1412。查看“man pppoe”的手册页。在底部的注释中有关于 1412 的讨论。我不再有 Netflix 视频流掉线了。

我已经构建了自己的 RPI-4 防火墙机器,并添加了 USB 加密狗以太网。我运行以下脚本来提取我的 ISP 信息。

#!/bin/bash -xv

base_prefix=$(/sbin/dhcpcd -6 -U eth0 | grep "dhcp6_ia_pd1_prefix1=" | cut -d '=' -f 2 | cut -d : -f 1-4 | cut -d "'" -f 2)

#   echo $base_prefix

# following sets up router advertizements for dnsmasq

# ie: dnsmasq reads this file to get the ipv6 network ip6 base prefix numbers

echo "dhcp-range="$base_prefix":0:0:0:500,"$base_prefix":FFFF:FFFF:FFFF:FFFF, ra-names, 150" >/etc/dnsmasq.d/router-advertise.conf

# scanned from iptables enx0050b6eab7d6 device

link_ip=$(ip address show dev enx0050b6eab7d6 scope link | awk /inet6 / {split($2,var,"/"); print var[1]}')

echo "dhcp-option=option6:dns-server,[${link_ip}]"  >/etc/dnsmasq.d/local-dns-server.conf


/etc/init.d/dnsmasq restart

exit 0