IPv6有状态自动配置地址
目录
IPv6有状态自动配置地址...
1
一、理论支持和实验目的...
1
三、实验步骤...
2
1、设置和观察M
bit和O
bit.
2
2、无状态自动配置:保留O位置位1,M位置位
0,观察R4通过DHCPv6获得的其他参数情况
3
3、设置M
bit置位,从DHCP
server获得地址(注意某些命令只有15.0以上IOS才支持)
5
IPv6支持有状态自动配置获得地址的方式,这涉及到RA消息中的两个bit,M bit和O bit。如图所以为RA消息的格式:
M是管理地址的配置标记。如果设置了该位,始发路由器就会利用DHCPv6协议来告诉链路上的主机使用有状态地址自动配置。如果不设置该位,链路上的主机应该使用无状态地址自动配置。
o
是其他的有状态配置标记。当设置该位时,始发路由器就会告诉所在链路上的主机使用DHCPv6协议来获取其他的链路信息。M标记和0标记可以一起使用。例如,不设置M标记但设置0标记,那么路由器将会告诉链路上的主机使用无状态地址自动配置,但对于其他的配置参数则不考虑DHCPv6服务器的存在
二、拓扑描述
如图所示,每个设备上的地址设计为20xy::x/64如敝R3连接R4的接口地址为2034::3/64
1、设置和观察M bit和O bit
R3(config)#ipv6 unicast-routing
R3(config)#
R3(config)#int f0/1
R3(config-if)ipv6 address 2034::3/64
R3(config-if)#ipv6 nd
managed-config-flag
R3(config-if)#ipv6 nd
other-config-flag
!
R3#debug ipv6 nd
ICMP Neighbor Discovery events debugging is
on
*Mar 4 19:44:21.443:
ICMPv6-ND: Received RS on FastEthernet0/1 from
FE80::C801:A4FF:FE68:6
*Mar 4 19:44:21.447:
ICMPv6-ND: Sending solicited RA on
FastEthernet0/1
*Mar 4 19:44:21.447:
ICMPv6-ND: Request to send RA for
FE80::C802:A4FF:FE68:6
*Mar 4 19:44:21.451:
ICMPv6-ND: Sending RA from FE80::C802:A4FF:FE68:6 to FF02::1 on
FastEthernet0/1
*Mar 4 19:44:21.455:
ICMPv6-ND:
Managed address configuration---M
位置为的RA消息
*Mar 4 19:44:21.455:
ICMPv6-ND:
Other stateful configuration---O
位置为的RA消息
*Mar 4 19:44:21.459:
ICMPv6-ND:
MTU = 1500
*Mar 4 19:44:21.459:
ICMPv6-ND:
prefix = 2034::/64 onlink autoconfig
*Mar 4 19:44:21.463:
ICMPv6-ND:
2592000/604800 (valid/preferred)
R3#
*Mar 4 19:44:22.511:
ICMPv6-ND: Received NA for 2034::C801:A4FF:FE68:6 on
FastEthernet0/1 from
2034::C801:A4FF:FE68:6
2、无状态自动配置:保留O位置位1,M位置位
0,观察R4通过DHCPv6获得的其他参数情况
R3(config)#int f0/1
R3(config-if)#no ipv6 nd
managed-config-flag
此时R4需要通过R3的DHCP服务获得除地址之外的其他参数
R3(config)#ipv6 dhcp pool Ender
---进入DHCPv6配置模式
R3(config-dhcp)#?
IPv6
DHCP configuration commands:
default
Set a command to its defaults
dns-server
DNS servers
domain-name
Domain name to complete unqualified host
names
exit
Exit from DHCPv6 configuration mode
import
Import options
information
Information refresh option
nis
NIS server options
nisp
NISP server options
no
Negate a command or set its defaults
prefix-delegation IPv6 prefix
delegation
sip
SIP server options
sntp
SNTP server options
R3(config-dhcp)#domain-name
www.yeslab.net
R3(config-dhcp)#dns-server
2033::3---设置DNS参数和域名参数
!
R3(config)#int f0/1
R3(config-if)#ipv6 dhcp server
Ender---应用该DHCP server
Client端:
R4(config-if)#ipv6 address
autoconfig
!
验证和观察:
R4#debug ipv6 dhcp
-----------------------------------------------省略----------------------------------------------
Mar
4 19:51:26.195: type
REPLY(7), xid 16276064
*Mar 4
19:51:26.195:
option SERVERID(2), len 10
*Mar 4
19:51:26.199:
00030001CA02A4680008
*Mar 4
19:51:26.199:
option CLIENTID(1), len 10
*Mar 4
19:51:26.203:
00030001CA01A4680008
*Mar 4
19:51:26.203:
option DNS-SERVERS(23), len 16
*Mar 4
19:51:26.203:
2033::3
*Mar 4
19:51:26.207:
option DOMAIN-LIST(24), len 16
*Mar 4
19:51:26.207:
www.yeslab.net
*Mar 4 19:51:26.207: IPv6
DHCP: Adding server
FE80::C802:A4FF:FE68:6
*Mar 4 19:51:26.211: IPv6
DHCP: Processing options
*Mar 4 19:51:26.215: IPv6
DHCP: Configuring DNS server 2033::3
*Mar 4 19:51:26.215: IPv6
DHCP: Configuring domain name
www.yeslab.net
*Mar 4 19:51:26.215: IPv6
DHCP: DHCPv6 changes state from INFORMATION-REQUEST to IDLE
(REPLY_RECEIVED) on FastEthernet0/1
!
R4#sh
ipv6 interface fastEthernet 0/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 2591991 preferred lifetime
604791
Joined group address(es):
FF02::1
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
36991)
Default router is FE80::C802:A4FF:FE68:6 on
FastEthernet0/1
R4#sh ipv6 dhcp interface f0/1
FastEthernet0/1 is in client
mode
State is IDLE (1)
Information refresh timer expires in
23:56:57
List of known servers:
Reachable via address:
FE80::C802:A4FF:FE68:6
DUID: 00030001CA02A4680008
Preference: 0
Configuration parameters:---从DHCP
服务器获得了如下消息
DNS server: 2033::3
Domain name: www.yeslab.net
Information refresh time: 0
Rapid-Commit: disabled
3、设置M bit置位,从DHCP
server获得地址(注意某些命令只有15.0以上IOS才支持)
之前实验的配置依旧保留
R3:
ipv6
dhcp pool Ender
address prefix
2034:3434::/64---设置前缀
dns-server
2033::3
domain-name
www.yeslab.net
R4:
R4(config-if)#ipv6 enable
---必须配置该命令让接口获得link-local地址作为DHCP源,才能发送DHCP报文
R4(config-if)#ipv6 address
dhcp---注意该命令才是DHCP客户端命令
!
R4#sh
ipv6 int f0/1
Fastethernet0/1 is up, line protocol is
up
IPv6 is enabled, link-local address is
FE80::A8BB:CCFF:FE00:400
No
Virtual link-local address(es):
Global unicast address(es):
2034:3434::692D:6296:2D18:9B9A, subnet is
2034:3434::692D:6296:2D18:9B9A/128
Joined group address(es):
FF02::1
FF02::1:FF00:400
FF02::1:FF18:9B9A
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
30000)
ND
NS retransmit interval is 1000
milliseconds
!
R4#sh
ipv6 dhcp interface f0/1
Fastethernet0/0 is in client mode
Prefix State is IDLE---前缀信息为空
Address State is OPEN---地址状态为OPEN,意味着获得了地址
Renew for address will be sent in 11:56:11
List of known servers:
Reachable via address:
FE80::A8BB:CCFF:FE00:230
DUID: 00030001AABBCC000200
Preference: 0
Configuration parameters:
IA NA: IA ID 0x00030001, T1 43200, T2
69120
Address:
2034:3434::692D:6296:2D18:9B9A/128
preferred lifetime 86400, valid lifetime
172800
expires at Mar 06 2013 08:21 PM (172572
seconds)
DNS server: 2033::3
Domain name: www.yeslab.net
Information refresh time: 0
Prefix Rapid-Commit: disabled
Address Rapid-Commit: disabled
!
R3#sh
ipv6 dhcp pool
DHCPv6 pool: Ender
Address allocation prefix: 2034:3434::/64 valid 172800 preferred
86400 (1 in use, 0 conflicts)
DNS server: 2033::3
Domain name: www.yeslab.net
Active clients:
1---已经有一个活动的客户端
优化:设置valid时间和prefer时间:
R2(config-dhcpv6)#address prefix 2034:3434::/64
lifetime
600 590
DHCP
Agent命令为:接口下
ipv6
dhcp relay destination ..
如:
Router(config-if) ipv6 dhcp relay destination
FE80::250:A2FF:FEBF:A056 ethernet 4/3
附:以下为DHCPv6报文的工作过程和debug消息
客户端:
*Mar 4 12:33:15.452: IPv6
DHCP: Sending SOLICIT to FF02::1:2 on
Ethernet0/0---第一个包为solicit消息,目标地址为保留的FF02::1:2
*Mar 4 12:33:15.461: IPv6
DHCP: Received ADVERTISE from FE80::A8BB:CCFF:FE00:230 on
Ethernet0/0
*Mar 4 12:33:15.461: IPv6
DHCP: Adding server
FE80::A8BB:CCFF:FE00:230
*Mar 4 12:33:16.589: IPv6
DHCP: Sending REQUEST to FF02::1:2 on
Ethernet0/0---第三个报文为request报文
*Mar 4 12:33:16.589: IPv6
DHCP: DHCPv6 address changes state from SOLICIT to REQUEST
(ADDR_ADVERTISE_RECEIVED) on Ethernet0/0
*Mar 4 12:33:16.589: IPv6
DHCP: Received REPLY from FE80::A8BB:CCFF:FE00:230 on
Ethernet0/0---从客户端收到了reply报文,以确认该地址
*Mar 4 12:33:16.589: IPv6
DHCP: Processing options
*Mar 4 12:33:16.589: IPv6
DHCP: Adding address 2034:3434::C9B0:9626:ED5A:9BC1/128 to
Ethernet0/0
*Mar 4 12:33:16.590: IPv6
DHCP: T1 set to expire in 295 seconds
*Mar 4 12:33:16.590: IPv6
DHCP: T2 set to expire in 472 seconds
*Mar 4 12:33:16.590: IPv6
DHCP: Configuring DNS server 2033::3
R4#
*Mar 4 12:33:16.590: IPv6
DHCP: Configuring domain name
www.yeslab.net
*Mar 4 12:33:16.590: IPv6
DHCP: DHCPv6 address changes state from REQUEST to OPEN
(ADDR_REPLY_RECEIVED) on Ethernet0/0
服务器端:
Mar
4 12:33:15.452: IPv6 DHCP: Received SOLICIT from
FE80::A8BB:CCFF:FE00:400 on Ethernet0/3
*Mar 4 12:33:15.452: IPv6
DHCP: Using interface pool Ender
*Mar 4 12:33:15.452: IPv6
DHCP: Creating binding for FE80::A8BB:CCFF:FE00:400 in pool
Ender
*Mar 4 12:33:15.452: IPv6
DHCP: Binding for IA_NA 00030001 not found
*Mar 4 12:33:15.452: IPv6
DHCP: Allocating IA_NA 00030001 in binding for
FE80::A8BB:CCFF:FE00:400
*Mar 4 12:33:15.452: IPv6
DHCP: Looking up pool 2034:3434::/64 entry with username
'00030001AABBCC00040000030001'
*Mar 4 12:33:15.452: IPv6
DHCP: Poolentry for user not found
*Mar 4 12:33:15.452: IPv6
DHCP: Allocated new address
2034:3434::C9B0:9626:ED5A:9BC1
R2#
*Mar 4 12:33:15.452: IPv6
DHCP: Allocating address 2034:3434::C9B0:9626:ED5A:9BC1 in binding
for FE80::A8BB:CCFF:FE00:400, IAID
00030001
*Mar 4 12:33:15.452: IPv6
DHCP: Updating binding address entry for address
2034:3434::C9B0:9626:ED5A:9BC1
*Mar 4 12:33:15.452: IPv6
DHCP: Setting timer on 2034:3434::C9B0:9626:ED5A:9BC1 for 60
seconds
*Mar 4 12:33:15.452: IPv6
DHCP: Sending ADVERTISE to FE80::A8BB:CCFF:FE00:400 on
Ethernet0/3---在该接口上发送了advertise消息
*Mar 4 12:33:15.452:
ether_vencap:(1975)
*Mar 4 12:33:16.589: IPv6
DHCP: Received REQUEST from FE80::A8BB:CCFF:FE00:400 on
Ethernet0/3
*Mar 4 12:33:16.589: IPv6
DHCP: Using interface pool Ender
*Mar 4 12:33:16.589: IPv6
DHCP: Looking up pool 2034:3434::/64 entry with username
'00030001AABBCC00040000030001'
*Mar 4 12:33:16.589: IPv6
DHCP: Poolentry for user found
*Mar 4 12:33:16.589: IPv6
DHCP: Found address 2034:3434::C9B0:9626:ED5A:9BC1 in binding for
FE80::A8BB:CCFF:FE00:400, IAID 00030001
*Mar 4 12:33:16.589: IPv6
DHCP: Updating binding address entry for address
2034:3434::C9B0:9626:ED5A:9BC1
*Mar 4 12:33:16.589: IPv6
DHCP: Setting timer on 2034:3434::C9B0:9626:ED5A:9BC1 for 600
seconds
R2#
*Mar 4 12:33:16.589: IPv6
DHCP: Sending REPLY to FE80::A8BB:CCFF:FE00:400 on
Ethernet0/3--发送了reply消息
实验完成
欢迎大家继续关注Ender的文档以及更多视频:
http://www.yeslab.net/ender/
http://ender.joe.blog.163.com/