本文档提供IPv6前缀列表的示例配置。在本例中,路由器R1和R2配置了IPv6编址方案,并通过串行链路连接。两台路由器上启用的路由协议是IPv6 OSPF。为了生成网络,路由器R2中配置了10个环回地址,并且两台路由器(R1和R2)上配置的环回地址都使用ipv6 ospf process-id area area-id [instance instance-id]命令相互通告。在本例中,需要拒绝源自路由器R2的环回8和环回9接口的到达路由器R1的显式路由。
此配置示例使用ipv6 prefix-list list-name命令在路由器R1上创建名为ipv6_all_addresses的IPv6前缀列表。
在本例中,在IPv6 OSPF上,使用distribute-list prefix-listlist-name命令以在配置的协议上应用前缀列表。
尝试进行此配置之前,请确保满足以下要求:
具备与 IPv6 寻址方案相关的知识
对IPv6实施OSPF的知识
本文档中的信息基于Cisco IOS®软件版本15.1上的Cisco 7200系列路由器(用于路由器R1和R2的配置)。
有关文档规则的信息,请参阅 Cisco 技术提示规则。
本部分提供有关如何配置本文档所述功能的信息。
注意:使用命令查找工具(仅限注册客户)可查找有关本文档中使用的命令的详细信息。
本文档使用以下网络设置:
本文档使用以下配置:
路由器 R1 |
---|
R1#show running-config version 15.0 ! hostname R1 ! ip cef ! ! ipv6 unicast-routing !-- Enables the forwarding of IPv6 packets. ! interface Loopback0 no ip address ipv6 address 1111::1/128 ipv6 ospf 10 area 0 !--- Enables OSPFv3 on the interface and associates !--- the interface looback1 to area 0. ! interface Loopback1 no ip address ipv6 address 2222::1/128 ipv6 ospf 10 area 0 ! interface Serial0/0 no ip address ipv6 address 1010:1:1:1::11/64 ipv6 ospf 10 area 0 clock rate 2000000 ! ! ipv6 router ospf 10 router-id 2.2.2.2 log-adjacency-changes distribute-list prefix-list ipv6_all_addresses in Applies the prefix list ipv6_all_addresses !--- to OSPF for IPv6 routing updates that are received on an interface. !--- Use this command in router configuration mode. ! ipv6 prefix-list ipv6_all_addresses seq 10 permit AB00::1/128 !--- Creates a prefix-list named ipv6_all_addresses. !--- Seq 10 denotes the sequence number of the !--- prefix list entry being configured. !--- permit/deny permits/denies the network !--- that matches the condition. ipv6 prefix-list ipv6_all_addresses seq 20 permit AB10::1/128 ipv6 prefix-list ipv6_all_addresses seq 30 permit AB20::1/128 ipv6 prefix-list ipv6_all_addresses seq 40 permit AB30::1/128 ipv6 prefix-list ipv6_all_addresses seq 50 permit AB40::1/128 ipv6 prefix-list ipv6_all_addresses seq 60 permit AB50::1/128 ipv6 prefix-list ipv6_all_addresses seq 70 permit AB60::1/128 ipv6 prefix-list ipv6_all_addresses seq 80 permit AB70::1/128 ipv6 prefix-list ipv6_all_addresses seq 90 deny AB80::1/128 ipv6 prefix-list ipv6_all_addresses seq 100 deny AB90::1/128 !--- Denies the routes AB80::1/128 & AB90::1/128. ! end |
注意:前缀列表具有以下命名限制:
不能与现有访问列表同名。
不能是名称“detail”或“summary”,因为它们是show ipv6 prefix-list命令中的关键字。
路由器 R2 |
---|
R2#show running-config version 15.0 ! hostname R2 ! ip cef ! ipv6 unicast-routing ! interface Loopback0 no ip address ipv6 address AB00::1/128 ipv6 ospf 10 area 0 ! interface Loopback1 no ip address ipv6 address AB10::1/128 ipv6 ospf 10 area 0 ! interface Loopback2 no ip address ipv6 address AB20::1/128 ipv6 ospf 10 area 0 ! interface Loopback3 no ip address ipv6 address AB30::1/128 ipv6 ospf 10 area 0 ! interface Loopback4 no ip address ipv6 address AB40::1/128 ipv6 ospf 10 area 0 ! interface Loopback5 no ip address ipv6 address AB50::1/128 ipv6 ospf 10 area 0 ! interface Loopback6 no ip address ipv6 address AB60::1/128 ipv6 ospf 10 area 0 ! interface Loopback7 no ip address ipv6 address AB70::1/128 ipv6 ospf 10 area 0 ! interface Loopback8 no ip address ipv6 address AB80::1/128 ipv6 ospf 10 area 0 ! interface Loopback9 no ip address ipv6 address AB90::1/128 ipv6 ospf 10 area 0 ! interface Serial0/0 no ip address ipv6 address 1010:1:1:1::10/64 ipv6 ospf 10 area 0 clock rate 2000000 ! ip forward-protocol nd ! ! ipv6 router ospf 10 router-id 1.1.1.1 log-adjacency-changes ! end |
要检验路由器R1收到的路由,请使用show ipv6 route ospf命令。
show ipv6 route ospf |
---|
在路由器 R1 中 R1#show ipv6 route ospf IPv6 Routing Table - 13 entries Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP U - Per-user Static route, M - MIPv6 I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 D - EIGRP, EX - EIGRP external O AB00::1/128 [110/64] via FE80::C007:EFF:FE58:0, Serial0/0 OI AB10::1/128 [110/64] via FE80::C007:EFF:FE58:0, Serial0/0 OI AB20::1/128 [110/64] via FE80::C007:EFF:FE58:0, Serial0/0 OI AB30::1/128 [110/64] via FE80::C007:EFF:FE58:0, Serial0/0 OI AB40::1/128 [110/64] via FE80::C007:EFF:FE58:0, Serial0/0 OI AB50::1/128 [110/64] via FE80::C007:EFF:FE58:0, Serial0/0 OI AB60::1/128 [110/64] via FE80::C007:EFF:FE58:0, Serial0/0 OI AB70::1/128 [110/64] via FE80::C007:EFF:FE58:0, Serial0/0 !--- Note that the routes AB80::1/128 and AB90::1/128 !--- originated from lo 8 and lo 9 are not listed here. |
要显示有关IPv6前缀列表或前缀列表条目的信息,请使用show ipv6 prefix-list detail命令。
show ipv6 prefix-list |
---|
在路由器 R1 中 R1#show ipv6 prefix-list detail Prefix-list with the last deletion/insertion: ipv6_all_addresses ipv6 prefix-list ipv6_all_addresses: count: 10, range entries: 0, sequences: 10 - 100, refcount: 3 seq 10 permit AB00::1/128 (hit count: 1, refcount: 5) seq 20 permit AB10::1/128 (hit count: 1, refcount: 1) seq 30 permit AB20::1/128 (hit count: 1, refcount: 2) seq 40 permit AB30::1/128 (hit count: 1, refcount: 1) seq 50 permit AB40::1/128 (hit count: 1, refcount: 3) seq 60 permit AB50::1/128 (hit count: 1, refcount: 1) seq 70 permit AB60::1/128 (hit count: 1, refcount: 2) seq 80 permit AB70::1/128 (hit count: 1, refcount: 1) seq 90 deny AB80::1/128 (hit count: 1, refcount: 2) seq 100 deny AB90::1/128 (hit count: 1, refcount: 1) R1#show ipv6 prefix-list summary Prefix-list with the last deletion/insertion: ipv6_all_addresses ipv6 prefix-list ipv6_all_addresses: count: 10, range entries: 0, sequences: 10 - 100, refcount: 3 !--- This command displays detailed or !--- summarized information about all IPv6 prefix lists. |
命令输出解释程序(仅限注册用户)(OIT) 支持某些 show 命令。使用 OIT 可查看对 show 命令输出的分析。
目前没有针对此配置的故障排除信息。
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
10-Sep-2018 |
初始版本 |