我的 IPv6 addr_gen_mode 设置是什么?

我的 IPv6 addr_gen_mode 设置是什么?

我刚刚实现了自己的 DynDNS 服务,该服务使用 IPv6 前缀和一组 LXD 容器 macvlan 接口的 MAC 地址通过我的 DNS 提供商更新 AAAA 记录。效果很好。

现在我想对网络上的几台客户端计算机执行相同的操作,但似乎我的 Kubuntu 20.04 笔记本没有从 EUI-64 生成其 IPv6 地址。实际上,/proc/sys/net/ipv6/conf/enp0s31f6/addr_gen_mode包含 1。我不太明白这是什么意思,但结果地址不是以任何明显的方式从 MAC 生成的。

我将 0 回显到文件中,并设置

net.ipv6.conf.default.addr_gen_mode = 0
net.ipv6.conf.enp0s31f6.addr_gen_mode = 0

但是/etc/sysctl.conf,一旦我通过 NetworkManager 禁用并重新启用连接,/proc/sys/net/ipv6/conf/enp0s31f6/addr_gen_mode就会回到 1。是什么导致了这种行为?

答案1

Network-Manager 会导致这种情况。它管理每个连接的自身配置,并配置您的适配器以满足其需求。如果您希望它在网络上使用 eui64,请相应地配置连接。您也可以通过编辑/etc/NetworkManager/NetworkManager.conf,添加以下内容使其成为默认设置:

[connection]
ipv6.addr-gen-mode=eui64

man 5 NetworkManager.conf

   CONNECTION SECTION

   Specify default values for connections.

   Such default values are only consulted if the corresponding
   per-connection property explicitly allows for that. That means, all
   these properties correspond to a property of the connection profile
   (for example connection.mud-url). Only if the per-profile property is
   set to a special value that indicates to use the default, the default
   value from NetworkManager.conf is consulted. It depends on the
   property, which is the special value that indicates fallback to the
   default, but it usually is something like empty, unset values or
   special numeric values like 0 or -1. That means the effectively used
   value can first always be configured for each profile, and these
   default values only matter if the per-profile values explicitly
   indicates to use the default from NetworkManager.conf.

   Example:

       [connection]
       ipv6.ip6-privacy=0

相关内容