简介
本文档介绍如何在接口上为 IPv6 启用开放最短路径优先 (OSPF) 版本 3 协议。
先决条件
要求
在接口上启用OSPF for IPv6之前,您必须:
使用的组件
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
规则
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
背景信息
开放最短路径优先 (OSPF) 是一种 IP 路由协议。它是一种链路状态协议,与距离矢量协议相对。
链路状态协议根据连接源计算机和目标计算机的链路状态做出路由决策。
链路状态是接口及其与相邻网络设备的关系的描述。
接口信息包括接口的 IPv6 前缀、网络掩码、连接网络类型、该网络所连接的路由器等。
此信息在各种类型的链路状态通告(LSA)中传播。RFC 2740中描述的OSPF版本3支持IPv6。
配置
本部分提供有关如何配置本文档所述功能的信息。
注意:使用命令查找工具/a>查找有关本文档中使用的命令的详细信息。
注意:只有注册思科用户才能访问内部思科工具和信息。
网络图
本文档使用以下网络设置:
网络图
配置
图中所示的是路由器的 OSPFv3 配置:
末节路由器 |
ipv6 unicast-routing
ipv6 cef
!
interface GigabitEthernet0/0
no ip address
ipv6 address FD01:ABAB::/64 eui-64 ipv6 enable
ipv6 ospf 1 area 2 ipv6 ospf network point-to-point
!
ipv6 router ospf 1
router-id 10.3.3.3
area 2 stub
!
|
ABR1 路由器 |
ipv6 unicast-routing
ipv6 cef
!
interface GigabitEthernet1
no ip address
speed auto
ipv6 address FD03::1/124
ipv6 enable
ipv6 ospf 1 area 0
!
interface GigabitEthernet2
no ip address
ipv6 address FD02:ABAB::/64 eui-64
ipv6 enable
ipv6 ospf 1 area 2 ipv6 ospf network point-to-point
!
ipv6 router ospf 1
router-id 10.1.1.1
area 2 stub no-summary
!
|
ASBR 路由器 |
ipv6 unicast-routing
ipv6 cef
!
interface GigabitEthernet1
no ip address
ipv6 address FD03::2/124
ipv6 enable
ipv6 ospf 1 area 0
!
interface GigabitEthernet2
no ip address
ipv6 address FD03::1:1/124
ipv6 enable
ipv6 rip EXT enable
!
ipv6 router ospf 1
router-id 10.2.2.2
default-metric 25
redistribute rip EXT metric-type 1 include-connected
!
ipv6 router rip EXT
redistribute ospf 1 match internal external 1 external 2 include-connected
! |
外部路由器 |
ipv6 unicast-routing ipv6 cef
!
interface Loopback0
no ip address
ipv6 address FD04:ABAB::/64 eui-64
ipv6 enable
ipv6 rip EXT enable
!
interface GigabitEthernet0/0
no ip address
ipv6 address FD03::1:2/124
ipv6 enable
ipv6 rip EXT enable
!
ipv6 router rip EXT
|
验证
使用本部分可确认配置能否正常运行。
Output Interpreter工具支持某些show命令。使用 OIT 可查看对 show 命令输出的分析。
show ipv6 ospf database 命令显示路由器的链路状态数据库 (LSDB)。
注意:只有思科注册用户才能访问思科内部工具和信息。
Stub_Router#show ipv6 ospf database
OSPFv3 Router with ID (10.3.3.3) (Process ID 1)
Router Link States (Area 2)
ADV Router Age Seq# Fragment ID Link count Bits
10.1.1.1 5 0x8000000F 0 1 B
10.3.3.3 38 0x8000000E 0 1 None
Inter Area Prefix Link States (Area 2)
ADV Router Age Seq# Prefix
10.1.1.1 5 0x80000002 ::/0
Link (Type-8) Link States (Area 2)
ADV Router Age Seq# Link ID Interface
10.1.1.1 5 0x8000000A 8 Gi0/0
10.3.3.3 292 0x80000005 2 Gi0/0
Intra Area Prefix Link States (Area 2)
ADV Router Age Seq# Link ID Ref-lstype Ref-LSID
10.1.1.1 5 0x8000000B 0 0x2001 0
10.3.3.3 548 0x80000002 0 0x2001 0
show ipv6 ospf database router命令显示路由器发出和接收的Router LSA。路由器 LSA 不传输地址或前缀信息。
Stub_Router#show ipv6 ospf database router
OSPFv3 Router with ID (10.3.3.3) (Process ID 1)
Router Link States (Area 2)
Routing Bit Set on this LSA
LS age: 141
Options: (V6-Bit, R-Bit, DC-Bit)
LS Type: Router Links
Link State ID: 0
Advertising Router: 10.1.1.1
LS Seq Number: 8000000F
Checksum: 0x9C2C
Length: 40
Area Border Router
Number of Links: 1
Link connected to: another Router (point-to-point)
Link Metric: 1
Local Interface ID: 8
Neighbor Interface ID: 2
Neighbor Router ID: 10.3.3.3
LS age: 174
Options: (V6-Bit, R-Bit, DC-Bit)
LS Type: Router Links
Link State ID: 0
Advertising Router: 10.3.3.3
LS Seq Number: 8000000E
Checksum: 0xBBF
Length: 40
Number of Links: 1
Link connected to: another Router (point-to-point)
Link Metric: 1
Local Interface ID: 2
Neighbor Interface ID: 8
Neighbor Router ID: 10.1.1.1
LSA 传输的 Options 字段包含以下位:
show ipv6 ospf database link self-originate命令显示链路LSA承载特定于链路的地址。
Stub_Router#show ipv6 ospf database link self-originate
OSPFv3 Router with ID (10.3.3.3) (Process ID 1)
Link (Type-8) Link States (Area 2)
LS age: 650
Options: (V6-Bit, R-Bit, DC-Bit)
LS Type: Link-LSA (Interface: GigabitEthernet0/0)
Link State ID: 2 (Interface ID)
Advertising Router: 10.3.3.3
LS Seq Number: 80000005
Checksum: 0x8578
Length: 56
Router Priority: 1
Link Local Address: FE80::5054:FF:FE00:3A
Number of Prefixes: 1
Prefix Address: FD01:ABAB::
Prefix Length: 64, Options: None
由于末节路由器属于完全残域,因此,ABR1 路由器仅将默认路由发送到末节路由器。
Stub_Router#show ipv6 route
IPv6 Routing Table - default - 5 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
lA - LISP away, a - Application
OI ::/0 [110/2] via FE80::5054:FF:FE00:15, GigabitEthernet0/0
C FD01:ABAB::/64 [0/0]
via GigabitEthernet0/0, directly connected
L FD01:ABAB::5054:FF:FE00:3A/128 [0/0]
via GigabitEthernet0/0, receive
O FD02:ABAB::/64 [110/2]
via FE80::5054:FF:FE00:15, GigabitEthernet0/0
L FF00::/8 [0/0]
via Null0, receive
ABR1 路由器是区域边界路由器。
ABR1#show ipv6 ospf
Routing Process "ospfv3 1" with ID 10.1.1.1
Supports NSSA (compatible with RFC 3101)
Supports Database Exchange Summary List Optimization (RFC 5243)
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an area border router
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 50 msecs
Minimum hold time between two consecutive SPFs 200 msecs
Maximum wait time between two consecutive SPFs 5000 msecs
Initial LSA throttle delay 50 msecs
Minimum hold time for LSA throttle 200 msecs
Maximum wait time for LSA throttle 5000 msecs
Minimum LSA arrival 100 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Retransmission limit dc 24 non-dc 24
EXCHANGE/LOADING adjacency limit: initial 300, process maximum 300
Number of external LSA 2. Checksum Sum 0x011699
Number of areas in this router is 2. 1 normal 1 stub 0 nssa
Graceful restart helper support enabled
Reference bandwidth unit is 100 mbps
RFC1583 compatibility enabled
Area BACKBONE(0)
Number of interfaces in this area is 1
SPF algorithm executed 17 times
Number of LSA 8. Checksum Sum 0x05579B
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Area 2
Number of interfaces in this area is 1
It is a stub area, no summary LSA in this area
Generates stub default route with cost 1
SPF algorithm executed 20 times
Number of LSA 7. Checksum Sum 0x0380EA
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
ABR1 路由器从 ASBR 路由器接收外部路由(RIP 路由)。
ABR1#show ipv6 route
IPv6 Routing Table - default - 8 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, R - RIP, H - NHRP, I1 - ISIS L1
I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP
EX - EIGRP external, ND - ND Default, NDp - ND Prefix, DCE - Destination
NDr - Redirect, RL - RPL, O - OSPF Intra, OI - OSPF Inter
OE1 - OSPF ext 1, OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1
ON2 - OSPF NSSA ext 2, la - LISP alt, lr - LISP site-registrations
ld - LISP dyn-eid, lA - LISP away, le - LISP extranet-policy
lp - LISP publications, a - Application, m - OMP
O FD01:ABAB::/64 [110/2]
via FE80::5054:FF:FE00:3A, GigabitEthernet2
C FD02:ABAB::/64 [0/0]
via GigabitEthernet2, directly connected
L FD02:ABAB::5054:FF:FE00:15/128 [0/0]
via GigabitEthernet2, receive
C FD03::/124 [0/0]
via GigabitEthernet1, directly connected
L FD03::1/128 [0/0]
via GigabitEthernet1, receive
OE1 FD03::1:0/124 [110/26] via FE80::5054:FF:FE00:3E, GigabitEthernet1 OE1 FD04:ABAB::/64 [110/26] via FE80::5054:FF:FE00:3E, GigabitEthernet1
L FF00::/8 [0/0]
via Null0, receive
ASBR 路由器是网络的自治系统边界路由器。它通过 Serial 0/0 接口连接到 RIP 网络。
ASBR#show ipv6 ospf
Routing Process "ospfv3 1" with ID 10.2.2.2
Supports NSSA (compatible with RFC 3101)
Supports Database Exchange Summary List Optimization (RFC 5243)
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes (with default metric 25) from,
rip EXT with metric-type 1 include-connected
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 50 msecs
Minimum hold time between two consecutive SPFs 200 msecs
Maximum wait time between two consecutive SPFs 5000 msecs
Initial LSA throttle delay 50 msecs
Minimum hold time for LSA throttle 200 msecs
Maximum wait time for LSA throttle 5000 msecs
Minimum LSA arrival 100 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Retransmission limit dc 24 non-dc 24
EXCHANGE/LOADING adjacency limit: initial 300, process maximum 300
Number of external LSA 2. Checksum Sum 0x011699
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Graceful restart helper support enabled
Reference bandwidth unit is 100 mbps
RFC1583 compatibility enabled
Area BACKBONE(0)
Number of interfaces in this area is 1
SPF algorithm executed 10 times
Number of LSA 8. Checksum Sum 0x05579B
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
ASBR#show ipv6 rip
RIP process "EXT", port 521, multicast-group FF02::9, pid 678
Administrative distance is 120. Maximum paths is 16
Updates every 30 seconds, expire after 180
Holddown lasts 0 seconds, garbage collect after 120
Split horizon is on; poison reverse is off
Default routes are not generated
Periodic updates 267, trigger updates 11
Full Advertisement 1, Delayed Events 0
Interfaces:
GigabitEthernet2
Redistribution:
Redistributing protocol ospf 1 with transparent metric (internal, external 1 & 2, ) include-connected
故障排除
使用本部分可排除配置故障。
注意:使用 debug 命令之前,请参阅有关 Debug 命令的重要信息。
debug ipv6
在末节路由器上启用 OSPFv3 之后,即发送 OSPFv3 类型 1 Hello 消息到 FF02::5 多播地址。收到来自ABR1路由器的Hello数据包后,它们会协商主/辅助关系,然后开始发送DBD数据包。
Stub_Router#debug ipv6 ospf events
Stub_Router#debug ipv6 ospf packet
Stub_Router#debug ipv6 ospf adj
*Mar 8 17:47:01.324: OSPFv3-1-IPv6 PAK : Gi0/0: OUT: FE80::5054:FF:FE00:3A->FF02::5: ver:3 type:1 len:36 rid:10.3.3.3 area:0.0.0.2 chksum:A0F9 inst:0
*Mar 8 17:47:03.307: OSPFv3-1-IPv6 PAK : Gi0/0: IN: FE80::5054:FF:FE00:15->FF02::5: ver:3 type:1 len:36 rid:10.1.1.1 area:0.0.0.2 chksum:A31C inst:0
*Mar 8 17:47:03.308: OSPFv3-1-IPv6 ADJ Gi0/0: Added 10.1.1.1 to nbr list
*Mar 8 17:47:03.308: OSPFv3-1-IPv6 PAK : Gi0/0: OUT: FE80::5054:FF:FE00:3A->FE80::5054:FF:FE00:15: ver:3 type:1 len:40 rid:10.3.3.3 area:0.0.0.2 chksum:470D inst:0
*Mar 8 17:47:03.320: OSPFv3-1-IPv6 PAK : Gi0/0: IN: FE80::5054:FF:FE00:15->FE80::5054:FF:FE00:3A: ver:3 type:1 len:40 rid:10.1.1.1 area:0.0.0.2 chksum:4707 inst:0
*Mar 8 17:47:03.321: OSPFv3-1-IPv6 ADJ Gi0/0: 2 Way Communication to 10.1.1.1, state 2WAY
*Mar 8 17:47:03.321: OSPFv3-1-IPv6 ADJ Gi0/0: Nbr 10.1.1.1: Prepare dbase exchange
*Mar 8 17:47:03.322: OSPFv3-1-IPv6 ADJ Gi0/0: Send DBD to 10.1.1.1 seq 0x983C9C0 opt 0x11 flag 0x7 len 28
*Mar 8 17:47:03.322: OSPFv3-1-IPv6 PAK : Gi0/0: OUT: FE80::5054:FF:FE00:3A->FE80::5054:FF:FE00:15: ver:3 type:2 len:28 rid:10.3.3.3 area:0.0.0.2 chksum:7A33 inst:0
*Mar 8 17:47:03.328: OSPFv3-1-IPv6 PAK : Gi0/0: IN: FE80::5054:FF:FE00:15->FE80::5054:FF:FE00:3A: ver:3 type:2 len:148 rid:10.1.1.1 area:0.0.0.2 chksum:141A inst:0
*Mar 8 17:47:03.329: OSPFv3-1-IPv6 ADJ Gi0/0: Rcv DBD from 10.1.1.1 seq 0x983C9C0 opt 0x11 flag 0x2 len 148 mtu 1500 state EXSTART
*Mar 8 17:47:03.330: OSPFv3-1-IPv6 ADJ Gi0/0: NBR Negotiation Done. We are the MASTER
*Mar 8 17:47:03.330: OSPFv3-1-IPv6 ADJ Gi0/0: Nbr 10.1.1.1: Summary list built, size 7
*Mar 8 17:47:03.331: OSPFv3-1-IPv6 ADJ Gi0/0: Send DBD to 10.1.1.1 seq 0x983C9C1 opt 0x11 flag 0x1 len 128
*Mar 8 17:47:03.331: OSPFv3-1-IPv6 PAK : Gi0/0: OUT: FE80::5054:FF:FE00:3A->FE80::5054:FF:FE00:15: ver:3 type:2 len:128 rid:10.3.3.3 area:0.0.0.2 chksum:F771 inst:0
*Mar 8 17:47:03.334: OSPFv3-1-IPv6 PAK : Gi0/0: IN: FE80::5054:FF:FE00:15->FE80::5054:FF:FE00:3A: ver:3 type:3 len:64 rid:10.1.1.1 area:0.0.0.2 chksum:C6FA inst:0
*Mar 8 17:47:03.335: OSPFv3-1-IPv6 PAK : Gi0/0: IN: FE80::5054:FF:FE00:15->FE80::5054:FF:FE00:3A: ver:3 type:2 len:28 rid:10.1.1.1 area:0.0.0.2 chksum:7C3D inst:0
DBD 数据包交换之后,路由器即发送链路状态请求 (LS REQ) 和链路状态更新 (LS UPD) 消息,以建立其 LSDB。在连续的 LS REQ 和 LS UPD 消息之后且状态达到 FULL 时,路由器继续交换 Hello 数据包。
Stub_Router#
*Mar 8 17:47:03.337: OSPFv3-1-IPv6 ADJ Gi0/0: Rcv LS REQ from 10.1.1.1 length 64 LSA count 4
*Mar 8 17:47:03.337: OSPFv3-1-IPv6 ADJ Gi0/0: Send LS UPD to FE80::5054:FF:FE00:15 length 172 LSA count 4
*Mar 8 17:47:03.338: OSPFv3-1-IPv6 PAK : Gi0/0: OUT: FE80::5054:FF:FE00:3A->FE80::5054:FF:FE00:15: ver:3 type:4 len:172 rid:10.3.3.3 area:0.0.0.2 chksum:D2CE inst:0
*Mar 8 17:47:03.339: OSPFv3-1-IPv6 ADJ Gi0/0: Rcv DBD from 10.1.1.1 seq 0x983C9C1 opt 0x11 flag 0x0 len 28 mtu 1500 state EXCHANGE
*Mar 8 17:47:03.339: OSPFv3-1-IPv6 ADJ Gi0/0: Exchange Done with 10.1.1.1
*Mar 8 17:47:03.340: OSPFv3-1-IPv6 ADJ Gi0/0: Send LS REQ to 10.1.1.1 length 40
*Mar 8 17:47:03.340: OSPFv3-1-IPv6 PAK : Gi0/0: OUT: FE80::5054:FF:FE00:3A->FE80::5054:FF:FE00:15: ver:3 type:3 len:40 rid:10.3.3.3 area:0.0.0.2 chksum:FD46 inst:0
*Mar 8 17:47:03.343: OSPFv3-1-IPv6 PAK : Gi0/0: IN: FE80::5054:FF:FE00:15->FE80::5054:FF:FE00:3A: ver:3 type:4 len:72 rid:10.1.1.1 area:0.0.0.2 chksum:825E inst:0
*Mar 8 17:47:03.345: OSPFv3-1-IPv6 ADJ Gi0/0: Rcv LS UPD from Nbr ID 10.1.1.1 length 72 LSA count 2
*Mar 8 17:47:03.345: OSPFv3-1-IPv6 ADJ Gi0/0: Synchronized with 10.1.1.1, state FULL
*Mar 8 17:47:03.346: %OSPFv3-5-ADJCHG: Process 1, Nbr 10.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
相关信息