IPv6无状态自动配置获得地址
目录
IPv6无状态自动配置获得地址...
1
一、理论支持和实验目的...
1
二、拓扑描述...
1
三、实验步骤...
2
1、R3作为路由器开启IPv6路由功能以及接口配置地址...
2
2、R4模拟主机,并配置自动获得地址...
2
3、调整邻居发现相关的RA参数...
3
IPv6地址有两部分组成:前缀部分和接口ID部分
IPv6的一个很大的特点是支持即插即用:路由器发现(Router
Discovery)——当一个节点连接到一个IPv6的链路上时,它能够发现本地的路由器,而不必借助动态主机配置协议(DHCP)。
前缀发现(prefix)——当一个节点连接到一个IPv6的链路上时,它能够发现分配给该链路的前缀。参数发现(Parameter
Discovery)——节点能够发现它所相连的链路的参数,例如
链路的MTU和跳数限制等。主机可以通过RA消息(Router-Advertisement,ICMP type 134)中携带的前缀得到地址的前缀部分,同时通过该接口自动生成接口ID部分,从而得到一个完整的128位的IPv6地址,该消息默认情况下200S发送一次。当然主机(或者路由器)也可以主动发送RS(router solicit,ICMP Type = 133)消息来主动请求该前缀
实验目的:了解IPv6无状态自动获得地址的理论和操作
如图所示,每个设备上的地址设计为20xy::x/64如敝R3连接R4的接口地址为2034::3/64
1、R3作为路由器开启IPv6路由功能以及接口配置地址
R3(config)#ipv6 unicast-routing
---此命令是必须的
R3(config)#interface f0/1
R3(config-if)#ipv6 address
2034::3/64
通过debug消息来查看RA消息
R3#debug ipv6
nd(如果没有观察到,请关闭然后开启接口)
Created RA context for
FE80::C800:A4FF:FE0C:6---创建RA消息
*Mar 4 18:49:42.319:
ICMPv6-ND: Request to send RA for
FE80::C800:A4FF:FE0C:6
*Mar 4 18:49:42.323:
ICMPv6-ND: Sending RA from
FE80::C800:A4FF:FE0C:6 to FF02::1 on FastEthernet0/1---发送了RA消息,该RA消息目的地址为ff02::1。所有ipv6节点组播地址
*Mar 4 18:49:42.327:
ICMPv6-ND:
MTU = 1500---其他参数,MTU 1500
*Mar 4 18:49:42.331:
ICMPv6-ND:
prefix = 2034::/64 onlink
autoconfig---默认情况下通告该接口拥有的前缀
*Mar 4 18:49:42.331:
ICMPv6-ND:
2592000/604800
(valid/preferred)---通告了valid时间和preferred时间
2、R4模拟主机,并配置自动获得地址
R4(config)#int f0/1
R4(config-if)#no shutdown
R4(config-if)#ipv6 address
autoconfig
观察NS消息:
R4#debug ipv6 nd
*Mar 4 18:58:06.275:
ICMPv6-ND: Sending RS on
FastEthernet0/1---从该接口主动发出了RS消息,来获得前缀
*Mar 4 18:58:06.303:
ICMPv6-ND: Received RA from FE80::C802:A4FF:FE68:6 on
FastEthernet0/1---收到了来自R3的RA消息
*Mar 4 18:58:06.307:
ICMPv6-ND: DELETE -> INCMP:
FE80::C802:A4FF:FE68:6
*Mar 4 18:58:06.311:
ICMPv6-ND: Neighbour FE80::C802:A4FF:FE68:6 on FastEthernet0/1 :
LLA ca02.a468.0006
*Mar 4 18:58:06.315:
ICMPv6-ND: INCMP -> STALE:
FE80::C802:A4FF:FE68:6
*Mar 4 18:58:06.315:
ICMPv6-ND: Selected new default router FE80::C802:A4FF:FE68:6 on
FastEthernet0/1
*Mar 4 18:58:06.323:
ICMPv6-ND: Installed default to FE80::C802:A4FF:FE68:6 on
FastEthernet0/1---该版本的IOS会自动安装默认路由
*Mar 4 18:58:06.331:
IPv6-Address: Prefix Information change for 2034::/64, 0x0 ->
0xE0
*Mar 4 18:58:06.335:
IPv6-Address: Adding prefix 2034::/64 to
FastEthernet0/1---增加从R3收到的前缀信息到f0/1接口
*Mar 4 18:58:06.335:
IPv6-Address: Adding operating owner prefix configured on
FastEthernet0/1
*Mar 4 18:58:06.339:
IPv6-Address: Adding operating owner address configured on
FastEthernet0/1
*Mar 4
18:58:06.343
R4#:
IPv6-Address: Address 2034::C801:A4FF:FE68:6 configured on
FastEthernet0/1
*Mar 4 18:58:06.343:
IPv6-Addrmgr-ND: DAD request for 2034::C801:A4FF:FE68:6 on
FastEthernet0/1
*Mar 4 18:58:06.347:
ICMPv6-ND: Sending NS for 2034::C801:A4FF:FE68:6 on
FastEthernet0/1
*Mar 4 18:58:06.351:
ICMPv6-ND: Autoconfiguring 2034::C801:A4FF:FE68:6 on
FastEthernet0/1
*Mar 4 18:58:07.351:
IPv6-Addrmgr-ND: DAD: 2034::C801:A4FF:FE68:6 is
unique.---这中间会进行一次DAD检测,确保该地址是唯一的才可以使用
*Mar 4 18:58:07.355:
ICMPv6-ND: Sending NA for 2034::C801:A4FF:FE68:6 on
FastEthernet0/1
*Mar 4 18:58:07.359:
IPv6-Address: Address 2034::C801:A4FF:FE68:6/64 is up on
FastEthernet0/1
验证:
R4#sh ipv6 interface f0/1
FastEthernet0/1 is up, line protocol is
up
IPv6 is enabled, link-local address is FE80::C801:A4FF:FE68:6
----link-local地址是通过EUI 64的方式自动有MAC地址映射过来
No
Virtual link-local address(es):
Stateless address
autoconfig enabled---该接口通过无状态自动配置获得地址
Global unicast address(es):
2034::C801:A4FF:FE68:6, subnet is 2034::/64
[EUI/CAL/PRE]---全局单播地址的前缀从RA消息得到,接口ID部分从link-local地址得到,组成一个完整的IPv6发地址
valid lifetime 2591876 preferred lifetime 604676---valid
time是2591876秒,preferred
time是604676秒,在这个时段内可以主动发起连接,该时间可以控制
Joined group address(es):
FF02::1
FF02::1:FF68:6
MTU is 1500 bytes
ICMP error messages limited to one every 100
milliseconds---ICMP差错报文每100毫秒生成一个
ICMP redirects are enabled
ICMP unreachables are sent
ND
DAD is enabled, number of DAD attempts: 1
ND
reachable time is 30000 milliseconds (using
23934)
Default router is FE80::C802:A4FF:FE68:6 on
FastEthernet0/1---默认路由指向了对端的link-local地址
3、调整邻居发现相关的RA参数
R3:
interface FastEthernet0/1
ipv6 address
2034::3/64
ipv6 nd prefix
2034::/64 600 599---调整valid time和preferred time
ipv6 nd ra lifetime
600---调整RA消息生存时间,即在该时间内通告的前缀和参数有效
ipv6 nd ra interval
4---每四秒钟通告一次RA消息,可以在R3上查看,省略
验证:
R4#sh
ipv6 int f0/1
FastEthernet0/1 is up, line protocol is
up
IPv6 is enabled, link-local address is
FE80::C801:A4FF:FE68:6
No
Virtual link-local address(es):
Stateless address autoconfig enabled
Global unicast address(es):
2034::C801:A4FF:FE68:6, subnet is 2034::/64
[EUI/CAL/PRE]
valid lifetime 547 preferred lifetime
546---该时间值在想减小,说明我们调整的参数生效了
最后在介绍一下RA抑制特性如下(即不在发送RA消息,那么对端也不能获得前缀消息)
R3(config-if)#ipv6 nd ra
suppress
但是该功能在7200模拟器上没有生效
R4上的debug消息:
R4#
*Mar 4 19:19:55.987:
ICMPv6-ND: Sending RS on FastEthernet0/1
*Mar 4 19:19:56.039:
ICMPv6-ND: Received RA from FE80::C802:A4FF:FE68:6 on
FastEthernet0/1---从R3收到了RA消息
*Mar 4 19:19:56.043:
ICMPv6-ND: DELETE -> INCMP:
FE80::C802:A4FF:FE68:6
*Mar 4 19:19:56.047:
ICMPv6-ND: Neighbour FE80::C802:A4FF:FE68:6 on FastEthernet0/1 :
LLA ca02.a468.0006
我们来查看R3:
R3#sh
ipv6 int f0/1
FastEthernet0/1 is up, line protocol is
up
IPv6 is enabled, link-local address is
FE80::C802:A4FF:FE68:6
No
Virtual link-local address(es):
Global unicast address(es):
2034::3, subnet is 2034::/64
Joined group address(es):
FF02::1
FF02::2
FF02::1:FF00:3
FF02::1:FF68:6
MTU is 1500 bytes
ICMP error messages limited to one every 100
milliseconds
ICMP redirects are enabled
ICMP unreachables are sent
ND
DAD is enabled, number of DAD attempts: 1
ND
reachable time is 30000 milliseconds (using
38363)
ND
advertised reachable time is 0
(unspecified)
ND
advertised retransmit interval is 0
(unspecified)
ND
router advertisements are sent every 4
seconds----如果RA消息被抑制,那么这些显示将会消失
ND
router advertisements live for 600 seconds
ND
advertised default router preference is
Medium
ND
RAs are suppressed
Hosts use stateless autoconfig for
addresses.
实验完成
欢迎大家继续关注Ender的文档以及更多视频:
http://www.yeslab.net/ender/
http://ender.joe.blog.163.com/