「DHCPv6」- 有状态自动配置(Statefull Address Configuration)

  CREATED BY JENKINSBOT

华为网络设备

注意事项,具体的配置方法参考设备文档。

第一步、配置 DHCPv6 服务

// 第 1 步、配置接口地址
[Huawei] ipv6
[Interface] ipv6 enable
[Interface] ipv6 address <prefix/length>

// 第 2 步、配置地址池
[Huawei] dhcp enable
[Huawei] dhcpv6 pool <pool-name>
[Pool] address prefix <prefix/length>
[Pool] dns-server 2008::8

// 第 3 步、开启 RA 发送
[Interface] undo ipv6 nd ra halt
[Interface] ipv6 nd autoconfig managed-address-flag   # 指示 Client 以 DHCPv6 获取网络地址
[Interface] ipv6 nd autoconfig other-flag             # 指示 Client 以 DHCPv6 获取其他参数

// 第 4 步、选择地址池
[Interface] dhcpv6 server <pool-name>

第二步、配置客户端获取地址

路由器通过 DHCPv6 获取地址:

interface GigabitEthernet0/0/2
 ipv6 enable 
 ipv6 address auto link-local
 ipv6 address auto dhcp
 
[AR1]display ipv6 interface GigabitEthernet 0/0/2
GigabitEthernet0/0/2 current state : UP 
IPv6 protocol current state : UP
IPv6 is enabled, link-local address is FE80::2E0:FCFF:FEAC:2EC5
  Global unicast address(es):
    2001::3, subnet is 2001::3/128
  Joined group address(es):
    FF02::1:FF00:3
    FF02::2
    FF02::1
    FF02::1:FFAC:2EC5
  MTU is 1500 bytes
  ND DAD is enabled, number of DAD attempts: 1
  ND reachable time is 30000 milliseconds
  ND retransmit interval is 1000 milliseconds
  Hosts use stateless autoconfig for addresses

错误的前缀长度

linux – How to get a proper prefix length from DHCPv6 server? – Server Fault
A Common Mistake with DHCPv6 – American Registry for Internet Numbers

问题描述:在 Huawei eNSP 中,路由器(或 PC)作为 DHCP Client 获取地址前缀为 128 长度。图中的 Cloud 桥接到 PC 的网卡,PC 能够获取正常的 IPv6 地址及前缀(64);

原因分析:在 DHCPv6 中,报文并不包含前缀长度。Client 应该根据 RA 报文来获取正确的前缀长度。