计算机网络-DHCPv6配置

DHCPv6实验配置

一、DHCPv6有状态配置

拓扑图: 有状态配置

请求报文
请求报文
回复报文中的信息
回复报文中的信息

配置:

# 全局启用ipv6
ipv6 

# 启用DHCP
dhcp enable

# 创建dhcpv6的地址池
dhcpv6 pool pool1
 address prefix 2001::/64
 excluded-address 2001::10
 dns-server 2001:4860:4860::8888

# 接口配置启用ipv6,在接口调用地址池,rapid-commit快速分配即启用两步交互,如果客户端也支持的话
interface GigabitEthernet0/0/0
 ipv6 enable 
 ipv6 address 2001::10/64 
 dhcpv6 server pool1 rapid-commit

客户端配置:模拟器计算机似乎看不到DNS等其它信息。 自动获取地址

客户端地址信息
客户端地址信息

服务器端查看信息:

# 查看DHCPv6在接口的配置
[Huawei]dis dhcpv6 server interface g0/0/0
 Interface               : GigabitEthernet0/0/0
 DHCPv6 pool             : pool1
 Preference              : 0               
 Allow-hint              : Disabled
 Rapid-commit            : Enabled
 Unicast                 : Disabled

# 查看DHCPv6地址池的分配信息
[Huawei]dis dhcpv6 pool pool1
DHCPv6 pool: pool1
  Address prefix: 2001::/64
    Lifetime valid 172800 seconds, preferred 86400 seconds
    1 in use, 0 conflicts
  Excluded-address 2001::10
  1 excluded addresses
  Information refresh time: 86400
  DNS server address: 2001:4860:4860::8888
  Conflict-address expire-time: 172800
  Active normal clients: 1
  
# 查看报文统计
[Huawei]dis dhcpv6 server statistics 
 Message statistics of interface GigabitEthernet0/0/0:
   Message                  Received
   Solicit                  2               
   Request                  2               
   Confirm                  0               
   Renew                    0               
   Rebind                   0               
   Release                  0               
   Decline                  0               
   Information-request      0               
   Relay-forward            0               
   Leasequery               0               
   UnknownType              0               

   Message                  Sent
   Advertise                2               
   Reply                    2               
   Relay-reply              0               
   Leasequery-reply         0               
   Reconfigure              0               

如果是在VLAN下配置也是类似的。

二、DHCPv6无状态配置

注意:ENSP自带的PC无法做DHCPv6无状态自动获取测试。

无状态自动配置
无状态自动配置

简单讲就是AR1开启RA报文,AR2通过路由器通告方式获取地址,通过DHCPv6获取DNS等其它信息。

配置:

# 服务器全局开启ipv6
ipv6 

# 开启DHCP提供DNS信息
dhcp enable

# 地址池只分配DNS信息 
dhcpv6 pool pool1
 dns-server 2001:4860:4860::8888
 
# 接口配置IPV6,
interface GigabitEthernet0/0/0
 ipv6 enable 
 ipv6 address 2001::10/64 
 ipv6 nd ra Max-interval 30 
 ipv6 nd ra Min-interval 15 
 undo ipv6 nd ra halt               # 开启发送RA路由器通告报文,实现无状态自动获取ipv6地址
 ipv6 nd autoconfig other-flag      # 通过O置位1获取除ip地址外的信息(DNS、SIP)
 dhcpv6 server pool1 preference 255 rapid-commit allow-hint   # 调用地址池,快速配置


# AR2客户端
# 全局开启ipv6
ipv6 
# 开启dhcp功能
dhcp enable
# 接口配置ipv6
interface GigabitEthernet0/0/0
 ipv6 enable                            # 开启ipv6
 ipv6 address auto global default       # 通过无状态自动获取全球单播地址
 dhcpv6 client information-request      # 通过发送info报文获取除地址外的信息(DNS)

验证配置:

# 在客户端查看获取的地址和DNS
[Huawei]dis dhcpv6 client interface g0/0/0
GigabitEthernet0/0/0 is in stateless DHCPv6 client mode.
State is OPEN.
Preferred server DUID   : 0003000100E0FC033F4D          # 服务器标识
  Reachable via address : FE80::2E0:FCFF:FE03:3F4D
Infomation refresh time is 86400 seconds
DNS server     : 2001:4860:4860::8888                   # DNS信息

[Huawei]DIS IPV6 INT G0/0/0
GigabitEthernet0/0/0 current state : UP 
IPv6 protocol current state : UP
IPv6 is enabled, link-local address is FE80::2E0:FCFF:FED6:511F
  Global unicast address(es):
    2001::2E0:FCFF:FED6:511F,
    subnet is 2001::/64 [SLAAC 1970-01-01 00:49:20 2592000S] # 通过SLAAC无状态自动获取到地址
  Joined group address(es):
    FF02::1:FFD6:511F
    FF02::2
    FF02::1
  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

三、DHCPv6PD前缀代理

就是AR4作为代理,代理服务器分配给AR5的前缀。 PD代理

配置:

# AR3 PD 服务器
# 全局启用ipv6
ipv6 
# 开启dhcp
dhcp enable
# 配置PD前缀地址池
dhcpv6 pool pool1
 prefix-delegation 2002:1::/64 64
 dns-server 2001:4860:4860::8888
# 接口配置
interface GigabitEthernet0/0/0
 ipv6 enable 
 ipv6 address 2001::1/64            # 手动配置地址
 undo ipv6 nd ra halt               # 发送RA报文
 ipv6 nd autoconfig other-flag      # 通过DHCP下发DNS等信息
 dhcpv6 server pool1 rapid-commit allow-hint # 调用地址池pool1

# 配置到达客户端网段的路由
ipv6 route-static 2002:1:: 64 2001::2E0:FCFF:FE00:283E


# AR4 PD客户端
# 全局启用ipv6
ipv6 

# 开启dhcp
dhcp enable

# 直连接口使用无状态自动获取地址,以及配置pd地址池代理
interface GigabitEthernet0/0/0
 ipv6 enable 
 ipv6 address auto global default
 dhcpv6 client pd pool1
# 下联接口调用代理的地址池pool1然后加上一个主机地址形成一个完整地址
interface GigabitEthernet0/0/1
 ipv6 enable 
 ipv6 address pool1 ::1/64        # 也就是2002:1::/64+::1
 ipv6 address auto link-local     # 自动生成链路本地地址
 undo ipv6 nd ra halt             # 下联接口也发送RA报文供AR5生成地址
 ipv6 nd autoconfig other-flag    # 下发DNS信息
 
 
# AR5 客户端
# 全局启用ipv6
ipv6 

# 开启dhcp
dhcp enable

# 接口使用无状态自动获取地址以及DNS信息
interface GigabitEthernet0/0/1
 ipv6 enable 
 ipv6 address auto link-local
 ipv6 address auto global default
 dhcpv6 client information-request

各路由器地址:

# AR3
[AR3]dis ipv6 int b
*down: administratively down
(l): loopback
(s): spoofing
Interface                    Physical              Protocol   
GigabitEthernet0/0/0         up                    up         
[IPv6 Address] 2001::1


# AR4
[AR4]dis ipv6 int b
*down: administratively down
(l): loopback
(s): spoofing
Interface                    Physical              Protocol   
GigabitEthernet0/0/0         up                    up         
[IPv6 Address] 2001::2E0:FCFF:FE00:283E
GigabitEthernet0/0/1         up                    up         
[IPv6 Address] 2002:1::1


# AR5客户端
[AR5]dis ipv6 int b
*down: administratively down
(l): loopback
(s): spoofing
Interface                    Physical              Protocol   
GigabitEthernet0/0/1         up                    up         
[IPv6 Address] 2002:1::2E0:FCFF:FE4E:1753

客户端测试 这样就能够使用PD代理模式获取地址,简单说就是在服务器配置一个前缀给下联客户端分配地址。

总结:可以通过配置DHCPv6的有状态配置、无状态配置、PD代理等方式实现地址分配。

本文由 mdnice 多平台发布

  • 20
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不喜欢热闹的孩子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值