DHCPv6实验配置
一、DHCPv6有状态配置
拓扑图:
配置:
# 全局启用ipv6
ipv6 # 启用DHCP
dhcp enable# 创建dhcpv6的地址池
dhcpv6 pool pool1address prefix 2001::/64excluded-address 2001::10dns-server 2001:4860:4860::8888# 接口配置启用ipv6,在接口调用地址池,rapid-commit快速分配即启用两步交互,如果客户端也支持的话
interface GigabitEthernet0/0/0ipv6 enable ipv6 address 2001::10/64 dhcpv6 server pool1 rapid-commit
客户端配置:模拟器计算机似乎看不到DNS等其它信息。
服务器端查看信息:
# 查看DHCPv6在接口的配置
[Huawei]dis dhcpv6 server interface g0/0/0Interface : GigabitEthernet0/0/0DHCPv6 pool : pool1Preference : 0 Allow-hint : DisabledRapid-commit : EnabledUnicast : Disabled# 查看DHCPv6地址池的分配信息
[Huawei]dis dhcpv6 pool pool1
DHCPv6 pool: pool1Address prefix: 2001::/64Lifetime valid 172800 seconds, preferred 86400 seconds1 in use, 0 conflictsExcluded-address 2001::101 excluded addressesInformation refresh time: 86400DNS server address: 2001:4860:4860::8888Conflict-address expire-time: 172800Active normal clients: 1# 查看报文统计
[Huawei]dis dhcpv6 server statistics Message statistics of interface GigabitEthernet0/0/0:Message ReceivedSolicit 2 Request 2 Confirm 0 Renew 0 Rebind 0 Release 0 Decline 0 Information-request 0 Relay-forward 0 Leasequery 0 UnknownType 0 Message SentAdvertise 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 pool1dns-server 2001:4860:4860::8888# 接口配置IPV6,
interface GigabitEthernet0/0/0ipv6 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/0ipv6 enable # 开启ipv6ipv6 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:511FGlobal 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:511FFF02::2FF02::1MTU is 1500 bytesND DAD is enabled, number of DAD attempts: 1ND reachable time is 30000 millisecondsND retransmit interval is 1000 millisecondsHosts use stateless autoconfig for addresses
三、DHCPv6PD前缀代理
就是AR4作为代理,代理服务器分配给AR5的前缀。
配置:
# AR3 PD 服务器
# 全局启用ipv6
ipv6
# 开启dhcp
dhcp enable
# 配置PD前缀地址池
dhcpv6 pool pool1prefix-delegation 2002:1::/64 64dns-server 2001:4860:4860::8888
# 接口配置
interface GigabitEthernet0/0/0ipv6 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/0ipv6 enable ipv6 address auto global defaultdhcpv6 client pd pool1
# 下联接口调用代理的地址池pool1然后加上一个主机地址形成一个完整地址
interface GigabitEthernet0/0/1ipv6 enable ipv6 address pool1 ::1/64 # 也就是2002:1::/64+::1ipv6 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/1ipv6 enable ipv6 address auto link-localipv6 address auto global defaultdhcpv6 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 多平台发布