组网需求
- R1的所有接口使用静态的方式配置地址
- R2的所有接口通过无状态自动配置的方式获取地址
- R3的所有接口通过DHCPv6的方式获取地址
组网拓扑
配置思路
- R1的G0/0/1和G0/0/2接口使用静态的方式配置地址
- R2的G0/0/1口使用无状态自动配置的方式获取地址(在R1接口使能RA功能)
- R3的G0/0/1口使用DHCP的方式获取地址(R1上配置DHCP服务器)
配置命令
配置全局和接口使能IPv6功能
R1配置
1
2
3
4
5
6
7sys
sys R1
ipv6
int g0/0/1
ipv6 enable
int g0/0/2
ipv6 enable
R2配置
1
2
3
4
5sys
sys R2
ipv6
int g0/0/1
ipv6 enable
R3配置
1
2
3
4
5sys
sys R3
ipv6
int g0/0/2
ipv6 enable
配置接口自动配置链路本地地址
R1配置
1
2
3
4
5sys
int g0/0/1
ipv6 address auto link-local
int g0/0/2
ipv6 address auto link-local
R2配置
1
2
3sys
int g0/0/1
ipv6 address auto link-local
R3配置
1
2
3sys
int g0/0/2
ipv6 address auto link-local
配置R1接口的全局单播地址(静态方式)
1
2
3
4
5sys
int g0/0/1
ipv6 address 2001:db8:12::1/64
int g0/0/2
ipv6 address 2001:db8:13::1/64
配置R2接口无状态自动配置地址(ICMPv6方式)
R1配置
1
2
3sys
int g0/0/1
undo ipv6 nd ra halt
R2配置
1
2
3sys
int g0/0/2
ipv6 address auto global
配置R3接口有状态自动配置地址(DHCPv6方式)
R1配置
1
2
3
4
5
6
7sys
dhcp enable
dhcpv6 pool pool1
address prefix 2001:db8:13::/64
int g0/0/2
dhcpv6 server pool1
R3配置
1
2
3
4
5sys
dhcp enbale
int g0/0/2
ipv6 address auto dhcp
查看结果
查看接口状态(以R1为例)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24display ipv6 interface g0/0/1
<R1>dis ipv6 int g0/0/1
GigabitEthernet0/0/1 current state : UP
IPv6 protocol current state : UP
IPv6 is enabled, link-local address is FE80::2E0:FCFF:FE2C:2E98
Global unicast address(es):
2001:DB8:12::1, subnet is 2001:DB8:12::/64
Joined group address(es):
FF02::1:FF00:1
FF02::2
FF02::1
FF02::1:FF2C:2E98
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
ND advertised reachable time is 0 milliseconds
ND advertised retransmit interval is 0 milliseconds
ND router advertisement max interval 600 seconds, min interval 200 seconds
ND router advertisements live for 1800 seconds
ND router advertisements hop-limit 64
ND default router preference medium
Hosts use stateless autoconfig for addresses
查看邻居状态
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20display ipv6 neighbor
<R1>dis ipv6 neighbors
-----------------------------------------------------------------------------
IPv6 Address : FE80::2E0:FCFF:FEB1:2735
Link-layer : 00e0-fcb1-2735 State : STALE
Interface : GE0/0/1 Age : 20
VLAN : - CEVLAN: -
VPN name : Is Router: TRUE
Secure FLAG : UN-SECURE
IPv6 Address : FE80::2E0:FCFF:FE99:414A
Link-layer : 00e0-fc99-414a State : STALE
Interface : GE0/0/2 Age : 30
VLAN : - CEVLAN: -
VPN name : Is Router: TRUE
Secure FLAG : UN-SECURE
-----------------------------------------------------------------------------
Total: 2 Dynamic: 2 Static: 0查看DHCPv6 Client 地址分配情况
1
2
3
4
5
6
7
8
9
10
11
12
13
14display dhcpv6 client
<R3>dis dhcpv6 client
GigabitEthernet0/0/2 is in stateful DHCPv6 client mode.
State is BOUND.
Preferred server DUID : 0003000100E0FC2C2E97
Reachable via address : FE80::2E0:FCFF:FE2C:2E99
IA NA IA ID 0x00000051 T1 43200 T2 69120
Obtained : 2022-04-24 11:08:58
Renews : 2022-04-24 23:08:58
Rebinds : 2022-04-25 06:20:58
Address : 2001:DB8:13::2
Lifetime valid 172800 seconds, preferred 86400 seconds
Expires at 2022-04-26 11:08:58(172790 seconds left)查看DHCPv6服务器详细信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23display dhcpv6 server statistics
<R1>dis dhcpv6 server statistics
Message statistics of interface GigabitEthernet0/0/2:
Message Received
Solicit 1
Request 1
Confirm 0
Renew 0
Rebind 0
Release 0
Decline 0
Information-request 0
Relay-forward 0
Leasequery 0
UnknownType 0
Message Sent
Advertise 1
Reply 1
Relay-reply 0
Leasequery-reply 0
Reconfigure 0