1、无状态自动配置
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 配置命令 AR1 ipv6 #开启路由器ipv6报文转发功能 interface GigabitEthernet0/0/0 ipv6 enable #开启路由器接口IPv6报文转发功能 ipv6 address FC01::1/64 #配置接口的全球单播IPv6地址 undo ipv6 nd ra halt #开启发送RA报文,默认是关闭的 |
|---------------------------------------------------------------------------------------------------------------------------------|
| AR2 ipv6 interface GigabitEthernet0/0/0 ipv6 enable ipv6 address auto global # AR2只需要接收AR1推送的前缀即可 display ipv6 interface g0/0/0 |
过程
1.主机通过EUI-64 将48位的MAC地址,然后加上固定前缀FE80生成本地链路地址
2.主机以本地链路地址为源,FF02::2为目的发送RS(路由器请求)
3.路由器回复RA(路由器通告)
4.主机通过RA中携带的全球单播地址前缀加上接口ID,生成全球唯一单播地址
2、DHCPv6有状态配置
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 配置命令 AR1 ipv6 #开启路由器ipv6报文转发功能 dhcp enable dhcpv6 pool pool1 address prefix 2001::/64 excluded-address 2001::100 dns-server 2001::100 int g0/0/0 ipv6 enable ipv6 address 2001::1/64 ipv6 nd autoconfig managed-address-flag dhcpv6 server pool1 |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| AR2 interface GigabitEthernet0/0/0 ipv6 enable ipv6 address auto link-local #或者 auto global ipv6 address auto dhcp ipv6 address auto global default通过RA报文学习到IPv6网关的缺省路由。 |
display dhcpv6 pool pool1 allocated address 查看地址分配信息。 display dhcpv6 pool pool1 display dhcpv6 server
3、DHCPv6无状态配置 (ensp只能通过AR路由器模拟)
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| AR1 ipv6 dhcp enable dhcpv6 pool pool1 dns-server 2002::2 dns-domain-name example.com interface GigabitEthernet0/0/0 ipv6 enable ipv6 address 2001::1/64 undo ipv6 nd ra halt ipv6 nd autoconfig other-flag dhcpv6 server pool1 |
|-----------------------------------------------------------------------------------------------------------|
| interface GigabitEthernet0/0/0 ipv6 enable ipv6 address auto global dhcpv6 client information-request |
1.服务器的地址分配模式 display ipv6 interface g0/0/0
2.display dhcpv6 client查看DHCPv6客户端获取的信息。
3.如果dhcpserver不在同一链路上,display ipv6 routing-table查看DHCPv6客户端上已经生成了到IPv6网关的缺省路由。
4、总结
ICMPv6 RA flags标志位
#M和O都置位0(手工配置地址)
#O置位1,表示其他参数由dhcpv6获取(dhcpv6无状态)
#只要M置位1、O置位0或1,都表示所有参数由dhcpv6获取(dhcpv6有状态)
undo ipv6 nd ra halt 开启RA,通过无状态获取IPV6地址
ipv6 nd autoconfig other-flag 开启DHChv6获取除IPV6地址的其他信息(例如dns)
ipv6 nd autoconfig managed-address-flag 开启DHChv6获取所有信息